How to resize multiple dicom images in subfolders and save them?

9 ビュー (過去 30 日間)
Shourya
Shourya 2022 年 3 月 24 日
編集済み: Shourya 2022 年 4 月 14 日
I have multiple subfolders with many MR dicom images with different size. How can I resize them into 128x128 and save them in the same subfolders at once? Thank you in advance!

採用された回答

yanqi liu
yanqi liu 2022 年 3 月 25 日
fd = fullfile(pwd, 'dcms');
fs = ls(fullfile(fd, '*.dcm'));
for i = 1 : size(fs,1)
im = dicomread(fullfile(fd, strtrim(fs(i,:))));
im = imresize(im, [128 128], 'bilinear');
imwrite(im, fullfile(fd, [strtrim(fs(i,:))) '_128x128.dcm']));
end
  11 件のコメント
Rik
Rik 2022 年 4 月 14 日
Your error seems due to your dicom file, so not something we can debug for you remotely. Unless you use a custom dicom reader and haven't told us yet.
Shourya
Shourya 2022 年 4 月 14 日
編集済み: Shourya 2022 年 4 月 14 日
@Rik Thank you for your response. I am not using any dicom reader. I am not sure what is the issue. I just have MR images saved in .dcm format. They are just image files without any metadata. I don't know how to confirm if the images are readable, there are thousands of images with many folders.

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

その他の回答 (0 件)

カテゴリ

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