Hi,
I've found that certain data sets have two instances of the same tag, meaning that, when findAndGetOFStringArray is used for the read, the second tag is ignored.
OFCondition findAndGetOFStringArray(const DcmTagKey &tagKey,
OFString &value,
const OFBool searchIntoSub = OFFalse);
Is there any solution to this? Or, do more recent versions of DCMTK facilitate multiple reads of duplicate tags?
According to this:
https://forum.dcmtk.org/viewtopic.php?t=509
DCMTK, by default, throws out the second value of any duplicated tag.
I am using 3.6.0 and realize this is now an old version and this previous posting is also quite old. This could be a reason to update!
Thank you in advance for any help.
Jonathan.
Reading second instance of a duplicated Tag
Moderator: Moderator Team
Re: Reading second instance of a duplicated Tag
Just to follow up, we realized that findAndGetElements returns _all_ elements with the same name, so one simply need loop over the returned values to get them all.
DCMTK is great!
Jonathan.
DCMTK is great!
Jonathan.
-
- DCMTK Developer
- Posts: 2509
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: Reading second instance of a duplicated Tag
Thank you for posting the solution to your problem.
So, there are no duplicates but the data elements with the same attribute tag are stored on different nesting levels or in different sequences / items.
So, there are no duplicates but the data elements with the same attribute tag are stored on different nesting levels or in different sequences / items.
Re: Reading second instance of a duplicated Tag
Yes, no problems. Happy to help as this forum has been really useful to us and invariably DCMTK has an excellent solution! So to be quite explicit for other readers, the approach we use is via the DcmStack, in which we can populate all results:
DcmStack resultStack;
fileformat.getDataset()->findAndGetElements(DCM_CodeMeaning, resultStack);
while (!resultStack.empty())
{
DcmStackNode tmp = resultStack.pop();
DcmObject* val = tmp.value();
}
And indeed, they are not duplicates as you point out. Just nested items.
Thanks,
Jonathan.
DcmStack resultStack;
fileformat.getDataset()->findAndGetElements(DCM_CodeMeaning, resultStack);
while (!resultStack.empty())
{
DcmStackNode tmp = resultStack.pop();
DcmObject* val = tmp.value();
}
And indeed, they are not duplicates as you point out. Just nested items.
Thanks,
Jonathan.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 1 guest