De-resolution of Dicom Image

5 visualizzazioni (ultimi 30 giorni)
Ducs
Ducs il 25 Ott 2019
Risposto: Bjorn Gustavsson il 25 Ott 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

Risposte (1)

Bjorn Gustavsson
Bjorn Gustavsson il 25 Ott 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

Categorie

Scopri di più su DICOM Format in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by