De-resolution of Dicom Image
2 ビュー (過去 30 日間)
古いコメントを表示
Beginner to Matlab with radiology background
I am going to decrease the resolution for butch of DICOM image (40,000 MRI images ) from around 500(or 600) squre to 128 square and save them into the new folder and subfolder in same arrangement.
I have tried butch image processing addon, but it seems pretty dumb for saving output.
I know that imresize() can change the resolution, but I want save output dicom images in the folder and subfolders with the same name and arrangement.
I have seen the answer in https://www.mathworks.com/matlabcentral/answers/445249-dicom-image-resize-error#answer_361372
could anyone help me generate some code
Read folder and subfolder with dicom file -> use imresize to chage the resolution to 128x128 -> save output dicom image in the same name and save them in the new created folder and subfolder with the same name
0 件のコメント
回答 (1 件)
Bjorn Gustavsson
2019 年 10 月 25 日
So you problem is that you cannot figure out how to save a file to a new same-name file in another directory?
If so something like this should be the pattern:
Dicomfiles = dir('*.dcm');
New_dir = 'Dir4newsmallimages';
mkdir(New_dir);
for iFile = 1:numel()
X = dicomread(Dicomfiles(iFile).name);
INFO = dicominfo(Dicomfiles(iFile).name);
% and whatever you need from the file
Xout = improcessing(X); % or whatever you need to do with the image
INFO = metadatafixing(INFO); % You might have to modify the meta-data to match Xout
outname = fullfile(New_dir,Dicomfiles(iFile).name)
dicomwrite(Xout, outname, INFO);
end
HTH
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!