0
votes

Using DCM4CHE to retrieve values based on the tag name in plain xml is pretty straightforward.

For example if I want to retrieve the value of the attribute AccessionNumber:

String accessiongNumber = attribute.getString(Tag.AccessionNumber);

But what is the best approach when dealing with Sequence? I want to retrieve a value using its Tag name, but the value is 5 layers deep inside a Sequence.

In this case, I can get to the Sequence I want with:

Sequence recordSequence = attribute.getSequence(Tag.RecordSequence);

Is there a way to retrieve a value by its tag directly once I have the sequence that the value is embedded in?

1
recordSequence.get(#).getString(Tag.Something)tom

1 Answers

1
votes

Try using the Attributes.getNestedDataset methods. These will get you the attributes in the sequence. Something like:

Attributes refStudy = attribute.getNestedDataset(Tag.ReferencedStudySeequence, 0);
String refSopiuid = refStudy.getString(Tag.ReferencedSOPInstanceUID);