DICOMヘッダーの抽出

4 visualizaciones (últimos 30 días)
RYO ARATA
RYO ARATA el 8 de Sept. de 2022
Comentada: RYO ARATA el 10 de Sept. de 2022
DICOM画像からdicominfoにてヘッダー情報を構造体配列として抽出できたのですが、これをxlsxファイルとして出力する方法をご享受ください。

Respuesta aceptada

Kojiro Saito
Kojiro Saito el 8 de Sept. de 2022
構造体配列はwritestructでXML形式に出力できますが、そのままではExcel形式にならないので、struct2tableを使って構造体をテーブルに変換してからwritetableでファイル出力します。
サンプルコードです。
dataInfo = dicominfo('CT-MONO2-16-ankle.dcm');
dataInfoTbl = struct2table(dataInfo, 'AsArray', true);
writetable(dataInfoTbl, 'out.xlsx')
このDICOMデータではNameOfPhysiciansReadingStudyやOperatorsNameが構造体の入れ子になっているので、それもファイルに出力するには以下のように入れ子の構造体を配列に変換しておきます。
dataInfo = dicominfo('CT-MONO2-16-ankle.dcm');
fieldsNames = fieldnames(dataInfo);
for n=1:length(fieldsNames)
if isstruct(dataInfo.(fieldsNames{n}))
dataInfo.(fieldsNames{n}) = struct2array(dataInfo.(fieldsNames{n}));
end
end
dataInfoTbl = struct2table(dataInfo, 'AsArray', true);
writetable(dataInfoTbl, 'out.xlsx')
  1 comentario
RYO ARATA
RYO ARATA el 10 de Sept. de 2022
変換できました!ありがとうございます。

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre DICOM Format en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!