how to prossess multiple dicom images?
조회 수: 3 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (1개)
Jayanti
2025년 7월 8일
편집: Jayanti
2025년 7월 8일
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:
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 DICOM Format에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!