Convert dcm file to text file

5 ビュー (過去 30 日間)
mohd akmal masud
mohd akmal masud 2023 年 7 月 13 日
コメント済み: Simon Chan 2023 年 7 月 14 日
Dear all,
I have the dicom image as attached (1.3.12.2.1107.5.6.1.1131.30330121041902101908100000087.dcm in folder image). That have 360 slices.
Then my lecturer convert it into text file as attached (in folder Projections) just till slice no. 104. He used ImageJ software.
He asked their students to convert it using Matlab as my assignment.
Anyone can help me?

採用された回答

Simon Chan
Simon Chan 2023 年 7 月 14 日
You may use function dicomread to read the DICOM image.
Then you can use function writematrix to write each frame into a text file.
  2 件のコメント
mohd akmal masud
mohd akmal masud 2023 年 7 月 14 日
Dear @Simon Chan, can you write the command for me please?
Simon Chan
Simon Chan 2023 年 7 月 14 日
Noticed your results using ImageJ has rotated 90 degrees and hence function rot90 is used in the code.
Try the following:
I = dicomread('xxx.dcm'); % Your dicom file
Nz = size(I,ndims(I)); % Number of frames
for k = 1:Nz
writematrix(rot90(I(:,:,1,k)),sprintf('%03d.txt',k)); % Write into txt file
end

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by