how to prossess multiple dicom images?

6 vues (au cours des 30 derniers jours)
Dimitra Z
Dimitra Z le 26 Juil 2017
Modifié(e) : Jayanti le 8 Juil 2025
hello everyone, I have a project to do in matlab and I face some problems. here is a part of my code:
metadata=dicominfo('filename.dcm'); p=metadata.(dicomlookup('0010','0040')); %sex q=metadata.(dicomlookup('0010','1030')); %weight z=metadata.(dicomlookup('0028','1053')); %rescale slope a=metadata.(dicomlookup('0008','0032')); %aquisition time h=metadata.RadiopharmaceuticalInformationSequence.Item_1.RadionuclideHalfLife; %half life i=metadata.RadiopharmaceuticalInformationSequence.Item_1.RadionuclideTotalDose; %injection dose t=metadata.RadiopharmaceuticalInformationSequence.Item_1.RadiopharmaceuticalStartTime; %injection time
my problem is that I want to ask for the path and matlab automatically select the whole image sequence so I don't want to add the image name in my code. so, I would probably like a similar function as dicominfo.
thank you

Réponses (1)

Jayanti
Jayanti le 8 Juil 2025
Modifié(e) : Jayanti le 8 Juil 2025
Hi Dimitra,
To process a sequence of DICOM images without manually specifying each file name, you can automate the file selection using MATLAB’s built-in functions. It will allows to dynamically read all DICOM files in a folder and extract relevant metadata such as patient weight, acquisition time.
folderPath = uigetdir('', 'Select folder containing DICOM images');
% Get a list of all DICOM files in the selected folder
dicomFiles = dir(fullfile(folderPath, '*.dcm'));
"uigetdir" opens a folder selection dialog, so you don’t need to hardcode file names. After that it will gather all ".dcm" files from the selected folder.
for k = 1:length(dicomFiles)
% Get the full file path
filePath = fullfile(folderPath, dicomFiles(k).name);
% Your implementation
end
To access individual files you can then loop through the images as above.
I am also attaching the documentation link on "uigetdir" for your reference:

Catégories

En savoir plus sur DICOM Format dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by