Can I read a single field using DICOMINFO?
Afficher commentaires plus anciens
Hi all,
Ive got a pretty large number of dicom files, and using "dicominfo" for each image is causing my GUI to run extremely slowly. I'd like to read a single field of the header that I am interested in, rather than having to read in the entire thing as I'm not using 99% of it.
Does anyone know how this might be accomplished?
Cheers Jim
Réponse acceptée
Plus de réponses (2)
ILÁN FRANCISCO CARRETERO JUCHNOWICZ
le 17 Juin 2020
3 votes
Hi,
I recently contacted MathWorks Support and they have advised me the following solution:
''there is an undocumented way you might be able to extract 'dicominfo' faster. Please see the following example.
>> obj = images.internal.dicom.DICOMFile('CT-MONO2-16-ankle.dcm');
>> info = obj.getAttributeByName('SeriesTime');
This method first creates an object to extract the attributesNames and then use 'getAttributeByName' to read the information of a particular attribute. "
I have tried the commands detailed above and it works really well and faster than the dicominfo function.
I hope it helps you!
2 commentaires
thatguy14
le 4 Mar 2021
This worked really well!
radha soni
le 20 Mai 2021
great solution thank you
drummer
le 22 Avr 2019
Well, some of the meta-data are the same from a set of dicom images you're working on.
There's this Dicom Library I use which is very useful to find the tag I want: https://www.dicomlibrary.com/dicom/dicom-tags/
So, if you want to extract a single header, do the following:
% reading the dicom
[file, path] = uigetfile('*.dcm');
addpath(path);
disp(['User selected ', fullfile(path, file)]);
info = dicominfo(file);
dicom = dicomread(file);
%extracting the header you want, for example:
sliceThickness = info.(dicomlookup('0018', '0050'))
%Then you can use it as a value to whateve calculation you want.
Notice that the dicominfo will work anyway. The diference is that you're using only the header you want.
It will be only necessary if the header value changes along the image. Otherwise, this might solve some problems.
1 commentaire
Walter Roberson
le 22 Avr 2019
The original poster had hoped to avoid doing dicominfo() on the files. The issue was not finding the tag: the issue was that dicominfo() spends a bunch of time interpreting all of the tags for the file, and that was slowing the user down a lot because they only needed a small number of specific tags.
Catégories
En savoir plus sur DICOM Format dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!