De-resolution of Dicom Image

3 visualizaciones (últimos 30 días)
Ducs
Ducs el 25 de Oct. de 2019
Respondida: Bjorn Gustavsson el 25 de Oct. de 2019
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

Respuestas (1)

Bjorn Gustavsson
Bjorn Gustavsson el 25 de Oct. de 2019
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

Categorías

Más información sobre DICOM Format en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by