De-resolution of Dicom Image

3 次查看(过去 30 天)
Ducs
Ducs 2019-10-25
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.
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

回答(1 个)

Bjorn Gustavsson
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

类别

Help CenterFile Exchange 中查找有关 DICOM Format 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by