Can Group and Element hexadecimal Numbers be used (e.g. via dicomlookup) to access DICOM metadata faster than with 'structure diving'?

1 view (last 30 days)
Instead of diving into the structure fields as exemplified in the following code:
planinfo = dicominfo('RT-Plan\DICOMfile.dcm')
fractionnames = fieldnames(planinfo.FractionGroupSequence);
numberofBeams = length(fractionnames); numberoffractions = 0; totaldose = 0;
for loop = 1:numberofBeams
numberoffractions = numberoffractions + ...
planinfo.FractionGroupSequence.(fractionnames{loop}).NumberOfFractionsPlanned;
totaldose = totaldose + ...
planinfo.FractionGroupSequence.(fractionnames{loop}).ReferencedBeamSequence.Item_1.BeamDose...
*planinfo.FractionGroupSequence.(fractionnames{loop}).NumberOfFractionsPlanned;
end
if ~isequal(planinfo.FractionGroupSequence.Item_1.ReferencedBeamSequence.Item_1.BeamDoseSpecificationPoint,...
planinfo.FractionGroupSequence.(fractionnames{loop}).ReferencedBeamSequence.Item_1.BeamDoseSpecificationPoint)
warning(['Beam Dose Specification Point differs for Referenced',...
' Beam Number ',...
num2str(planinfo.FractionGroupSequence.(fractionnames{loop}).ReferencedBeamSequence.Item_1.ReferencedBeamNumber)])
disp(['Referenced Beam Number ',...
num2str(planinfo.FractionGroupSequence.Item_1.ReferencedBeamSequence.Item_1.ReferencedBeamNumber),...
' has Beam Dose Specification Point: ',...
num2str(planinfo.FractionGroupSequence.Item_1.ReferencedBeamSequence.Item_1.BeamDoseSpecificationPoint),','])
disp(['whereas Referenced Beam Number ',...
num2str(planinfo.FractionGroupSequence.(fractionnames{loop}).ReferencedBeamSequence.Item_1.ReferencedBeamNumber),...
' has Beam Dose Specification Point: ',
num2str(planinfo.FractionGroupSequence.(fractionnames{loop}).ReferencedBeamSequence.Item_1.BeamDoseSpecificationPoint),'.'])
end
can this be shortened to something more like
sum(NumberOfFractionsPlanned)
sum(NumberOfBeams(i)*NumberOfFractionsPlanned(i)*BeamDose(i))
by specifying the Attribute we're interested in, rather than its Structural location? Looking at the dicomlookup documentation, I do not see a use other than to replace the field name itself. I do not see the utility of this, as it is often longer than the field name itself:
>> dicomlookup('300A','0080')
ans =
NumberOfBeams
>> planinfo.FractionGroupSequence.Item_2.(dicomlookup('300A','0080'))
ans =
1
I wish to quickly manipulate a given Attribute across many Items within a structure field, e.g. all the NumberOfBeams within the FractionGroupSequence:
>> planinfo.FractionGroupSequence
ans =
Item_1: [1x1 struct]
Item_2: [1x1 struct]
Item_3: [1x1 struct]
Item_4: [1x1 struct]
Item_5: [1x1 struct]
without having to specify the full hierarchy of where that Attribute is buried. Does MATLAB not yet have a command to do this? I wonder if there is one, given how dicomlookup accepts the hexadecimal Numbers as input.
As you can see from my opening examples, being required to specify the location of the Attribute is cumbersome due to the extreme length of the metadata structure, so this more direct method would be useful indeed to maintain code legibility and save time.
Do you see any other ways to shorten code?

Answers (0)

Categories

Find more on DICOM Format in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!