필터 지우기
필터 지우기

DICOMヘッダーの抽出

조회 수: 5 (최근 30일)
RYO ARATA
RYO ARATA 2022년 9월 8일
댓글: RYO ARATA 2022년 9월 10일
DICOM画像からdicominfoにてヘッダー情報を構造体配列として抽出できたのですが、これをxlsxファイルとして出力する方法をご享受ください。

채택된 답변

Kojiro Saito
Kojiro Saito 2022년 9월 8일
構造体配列は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
RYO ARATA
RYO ARATA 2022년 9월 10일
変換できました!ありがとうございます。

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 DICOM Format에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!