Reading private sequences

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Kai Medis
Posts: 4
Joined: Tue, 2016-12-13, 12:26

Reading private sequences

#1 Post by Kai Medis »

Hi all,

I am trying to find / resolve the number of the private code meaning to open a sequence with group, element code 2005,140F. My dictionary contains:
(2005,"Philips MR Imaging DD 005",0F) SQ Philips MR Imaging Private Sequence 1

As you can see the number ‘14’ is not part of the dictionary, because it might be different for every file.

The following piece of code is clearly missing something, because found becomes false

DcmTag dcmTag ("Philips MR Imaging DD 005", 0x2005, 0x0F);
DcmItem* dataset (GetDataset (dcmTag));
bool found = dataset->tagExists (dcmTag);

But in the following code, found becomes true (here the number 14 is entered before 0F in the dcmTag constructor as element value)
DcmTag dcmTag ("Philips MR Imaging DD 005", 0x2005, 0x140F);
DcmItem* dataset (GetDataset (dcmTag));
bool found = dataset->tagExists (dcmTag);

Hardcoding the value to 0x140F from 0x0F is not an option: it should be derived from "Philips MR Imaging DD 005", 0x2005, 0x0F

I hope that someone can help me.

J. Riesmeier
DCMTK Developer
Posts: 2501
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Reading private sequences

#2 Post by J. Riesmeier »

This is just a wild guess but... the method DcmItem::tagsExists() takes a DcmTagKey as the first parameter, which does not know anything about the Private Creator string :(

Kai Medis
Posts: 4
Joined: Tue, 2016-12-13, 12:26

Re: Reading private sequences

#3 Post by Kai Medis »

Indeed. Therefore the value (i.e. the element number) must be resolved before checking if the tag exists. My question is: does DcmTk have methods to resolve this?

I.e. how to go from 0x2005,0x0F to 0x2005,0x140F using the private creator string with DcmTk?

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1437
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

Re: Reading private sequences

#4 Post by Marco Eichelberg »

There is no simple call to do what you want. You will indeed have to first iterate over the reservation elements (GGGG,00xx) to find the element with the reservation string representing "your" private group, and based on the tag of that reservation element determine the tag range of your private elements, i.e. (GGGG,xxyy).

It would perhaps be nice to have a method that would search by private reservation string within a given group GGGG, and return the tag range xx00, but that simply isn't there.

Kai Medis
Posts: 4
Joined: Tue, 2016-12-13, 12:26

Re: Reading private sequences

#5 Post by Kai Medis »

BTW: I noticed a bug in DcmTag class
The following constructor does a vr lookup which requires a privateCreator. But the creator is NULL
DcmTag::DcmTag(Uint16 g, Uint16 e)
: DcmTagKey(g, e),
vr(EVR_UNKNOWN),
tagName(NULL),
privateCreator(NULL),
errorFlag(EC_InvalidTag)
{
lookupVRinDictionary();//this method requires a correct privateCreator otherwise the outcome is random
}

Please add a proper constructor with extra argument the private creator. I.e.:
DcmTag::DcmTag(Uint16 g, Uint16 e, char* privateCreatorCode)
: DcmTagKey(g, e),
vr(EVR_UNKNOWN),
tagName(NULL),
privateCreator(privateCreatorCode),
errorFlag(EC_InvalidTag)
{
lookupVRinDictionary();//would result in a proper VR lookup now
}

J. Riesmeier
DCMTK Developer
Posts: 2501
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Reading private sequences

#6 Post by J. Riesmeier »

Thank you for the report but this has already been done (more than five years ago): http://git.dcmtk.org/?p=dcmtk.git;a=com ... 7283763458

Kai Medis
Posts: 4
Joined: Tue, 2016-12-13, 12:26

Re: Reading private sequences

#7 Post by Kai Medis »

Sorry, I noticed that we have version 3.6 and not 3.6.1 which contains the fix

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 1 guest