Adding Private Tag Data to the private.dic File

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
dave
Posts: 67
Joined: Fri, 2004-11-05, 18:20
Location: Houston, Texas, USA

Adding Private Tag Data to the private.dic File

#1 Post by dave »

I need to add private tags to the data dictionary.

As I'm using the windows precompiled binaries, will I need to recompile the binaries after adding the entries, specifically dcm2xml.exe, or will this binary read from the external text files?

I read in one of the help documents that the binaries can either have the data dictionaries compiled into the application, read from the external files, or both.

I tried adding an entry into private.dic for a known private tag, but when converting to xml, the VR still equals ?? and the name still equals "Unknown Tag & Data" .

Thanks very much.

dave

:?

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

Re: Adding Private Tag Data to the private.dic File

#2 Post by Jörg Riesmeier »

Dave,
dave wrote:I read in one of the help documents that the binaries can either have the data dictionaries compiled into the application, read from the external files, or both.
this is correct. Did you check that the environment variable DCMDICTPATH really points to your private dictionary?

Jörg

dave
Posts: 67
Joined: Fri, 2004-11-05, 18:20
Location: Houston, Texas, USA

#3 Post by dave »

I will create the DCMDICTPATH environmental variable with the correct value, i.e., it will point to the private.dic file included with the download and where I have added new entries.

So without this variable set, were the windows binaries using compiled in data dictionaries?

Thanks for you help, Jörg.

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#4 Post by Jörg Riesmeier »

Dave,

under Windows the default is to have a built-in data dictionary, i.e. usually it is not required to set the environment variable. But if you set the variable the built-in dictionary is still used and the entries from the external dictionary file are added to it when the application starts.

Details can be found in the text document "datadict.txt" (apparently a little out-dated but most of the text is still correct).

Jörg

dave
Posts: 67
Joined: Fri, 2004-11-05, 18:20
Location: Houston, Texas, USA

#5 Post by dave »

Not having much luck here. But perhaps I'm making some faulty assumptions.

This is a tag from the dicom file I converted using dcm2xml.exe:

<element tag="300b,1001" vr="??" vm="1" len="2" name="Unknown Tag & Data" binary="yes">31\30</element>

and this is the tab separated entry I added to private.dic (the VR and NAME are bogus values...)

(300b,"MDACC",1001) PN TestElement 1

I've added the DCMDICTPATH env variable including the file name.

I've restarted the computer, but still no changes to the above tag information.

Anything obvious that I've missed?

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#6 Post by Jörg Riesmeier »

dave wrote:(300b,"MDACC",1001) PN TestElement 1
Hmm, does your test file contain the private creator element (300b,0010) with a value of "MDACC" :?:

Jörg

dave
Posts: 67
Joined: Fri, 2004-11-05, 18:20
Location: Houston, Texas, USA

#7 Post by dave »

Nope. So I just took it out.

Now the data dictionary entry looks like this:

(300b,1001) DS TestElement 1

( the VR for this tag actually is "DS", I just checked )


and the XML output looks like this:


<element tag="300b,1001" vr="DS" vm="1" len="2" name="Unknown Tag & Data">10</element>

So some progress has been made in that the env var is set up correctly and the application is reading it. :)

I'm curious as to the change in the value '31\30' to '10' . This is the value associated with the element, isn't it? Any idea why this might have changed.

BTW, thanks so much, Jörg, for engaging an obvious newbie to DICOM like myself.

dave

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#8 Post by Jörg Riesmeier »

Dave,

but without private creator element the private tag (300b,1001) is not properly reserved according to part 5 of the DICOM standard :!:
dave wrote:I'm curious as to the change in the value '31\30' to '10' . This is the value associated with the element, isn't it? Any idea why this might have changed.
If the VR is unknown DCMTK uses OB (Other Byte) for the output, i.e. a sequence of bytes. DS (Decimal String) is the string representation of a decimal number. In your case the number 10 is stored as the string "10". The binary representation of this string is 0x31 0x30 - voilà :)

Jörg

dave
Posts: 67
Joined: Fri, 2004-11-05, 18:20
Location: Houston, Texas, USA

#9 Post by dave »

but without private creator element the private tag (300b,1001) is not properly reserved according to part 5 of the DICOM standard
Would this be a concern for me? I am just converting the DICOM file with dcm2xml.exe to xml for web display. Wouldn't this be more important for the Application Entities that are actually creating the objects?

In this entry from private.dic included with the download:

(7003,"SIEMENS MED",10) LT Header 1

isn't "SIEMENS MED" assigned to this tag by whatever AE created the object?

dave

dave
Posts: 67
Joined: Fri, 2004-11-05, 18:20
Location: Houston, Texas, USA

#10 Post by dave »

Jörg,

A better question would have been "what do you mean by private creator element"?

(7003,"SIEMENS MED",10) LT Header 1

Is that what "SIEMENS MED" is?

dave

Michael Onken
DCMTK Developer
Posts: 2048
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#11 Post by Michael Onken »

Hi David,

every private tag you use in your dicom file must have a reservation context. This reservation tag looks like gggg,00xx, where gggg is a private (=odd) group number and 10<xx<FF. The tag gggg,00xx then reserves a range of private tags from gggg,xx00-gggg,xxFF for the private creator, that you set with the value of the reservation tag.

In your case:

Your tag (300b,1001) is a private tag and therefore it needs a reservation. Following the rule above, the related reservation tag number is (300b,0010).

(300b,0010)="MDACC" reserves for private creator "MDACC" the tag range 300b,1000-300b,10FF. The reservation tag needs to be found in the dicom file, not in the dictionary.

E.g: This line from private.dic means:
(0027,"GEMS_IMAG_01",06) SL ImageArchiveFlag 1
0027,xx06 is a valid tag, if in the same file there is a reservation 0027,00xx="GEMS_IMAG_01"

When DCMTK sees a private tag in your file it looks for the related reservation tag. If it can be found, it reads the private creator name, that is set there. Next, it looks at your dictionary for private tags and checks all matching tags (same group/element numbers), whether it can find one with the same private creator name. If so, searching was successful.

Please read section 7.8 in part 5 of the DICOM standard (only 1 page).

Best Regards
Michael Onken :D

dave
Posts: 67
Joined: Fri, 2004-11-05, 18:20
Location: Houston, Texas, USA

#12 Post by dave »

Thank you very much, Michael, for you detailed response. Reading the standard is always good advice :idea: as is interacting with the experts.

Thanks,

dave

Post Reply

Who is online

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