Create Loop to convert DICOM to Tiff

4 ビュー (過去 30 日間)
Courtney
Courtney 2023 年 12 月 8 日
回答済み: Anton Kogios 2023 年 12 月 8 日
Hello,
I am trying to create a loop that will convert my DICOM files to Tiff files. I know for one file I would use this:
I = dicomread('1255-600.dcm');
imwrite(I, '1255-600.tif');
But I am struggling with how to turn this into a loop that doesn't overwrite the last loop for the over 800 files where my file names are consecutive. For example, '1255-600.dcm', '1255-601.dcm', 1255-602.dcm', ect.

回答 (1 件)

Anton Kogios
Anton Kogios 2023 年 12 月 8 日
Do you mean something like:
for i = 600:1400
I = dicomread(sprintf('1255-%i.dcm',i));
imwrite(I, sprintf('1255-%i.tif',i));
end
An alternative to using sprintf for the filename is:
"1255-"+i+".dcm"

カテゴリ

Help Center および File ExchangeDICOM Format についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by