Adding Dictionary Entry...

169 views
Skip to first unread message

Paul Helmuth

unread,
Jun 13, 2014, 6:40:38 PM6/13/14
to fo-d...@googlegroups.com
All,

I found that the Dictionary (defined in DICOM Dictionary.xml?) is missing a tag that I need.

It's a standard tag and not retired (as of the 2011 version).

The tag is "(0054, 0010) Energy Window Vector"

I tried adding the info to the xml file and rebuilding the DICOM solution (to do all projects) but that doesn't seem to add the missing tag. I imagine there is something that needs to be built/run that will read the XML file and translate that into the tag/dictionary info available.

Could someone tell me how to update the dictionary tag info?

I assume that editing the XML file is the first step - what are the rest?

Thank you.
-Paul

Paul Helmuth

unread,
Jun 16, 2014, 3:53:51 PM6/16/14
to fo-d...@googlegroups.com
here's a little more inf, but I still don't know to alter the standard dictionary...

Okay - I see that the "DICOM Dictionary.xml.gz" file (under DICOM Dictionaries) is flagged as an embedded resource. Whereas the uncompressed xml file is flagged as content.

So - I thought maybe I would need to make a ".gz" from the uncompressed file and somehow that would then be built in to the Dicom.dll, but that doesn't seem to be so (at least not the way I'm going about it).

I created a new ".gz" file (from the original xml file, with the Energy Window Vector added) and then tried to build the solution. The projects are building, but I'm still not able to see "EnergyWindowVector" in the list of DicomTag items.

Anyone know how this dictionary stuff works?

-Thanks.

Paul Helmuth

unread,
Jun 16, 2014, 4:00:36 PM6/16/14
to fo-d...@googlegroups.com
Not sure if it matters, but I used 7-zip to create the ".gz" file.

I didn't get any errors, so I don't think that's a factor.

Paul Helmuth

unread,
Jun 16, 2014, 6:28:38 PM6/16/14
to fo-d...@googlegroups.com
Okay - I'm getting closer (but still not able to update the dictionary)...

It looks like there is a "LoadInternalDictionaries( )" method inside of the Properties #region of the DicomDictionary class (defined in DicomDictionary.cs)

This method appears to reference the ".gz" dictionary files that are flagged as "Embedded Resource".
So, it looks like I should be able to see my new dictionary tag if I edit the .xml file and then create the ".gz" file from the XML file containing the added tag.

But I'm missing something, because I am unable to see the new tag for some reason.?.?.?

-Paul

Mahesh Dubey

unread,
Jun 17, 2014, 3:45:36 AM6/17/14
to fo-d...@googlegroups.com
Hello;
     Some thing like :
 DicomDictionary.Default.Add(new DicomDictionaryEntry(DicomTag.Parse("0054, 0010"),"Energy Window Vector","Energy Window Vector",DicomVM.VM_1_n,false,DicomVR.US));

And to verify

 var entry=  Dicom.DicomDictionary.Default[DicomTag.Parse("0054, 0010")];

Mahesh

Paul Helmuth

unread,
Jun 17, 2014, 2:54:28 PM6/17/14
to fo-d...@googlegroups.com
Mahesh,

Thank you for posting.

This looks like a perfect example of how to load an additional tag to the Default dictionary at run-time.

However, what I would like to do is actually add the tag to the "internal/default" dictionary that is loaded from the library itself. 

Seems conceptually simple, but I'm still missing something.

My most recent attempt was to eliminate the gzip encoding of the dictionary XML resource - in case 7-zip did not create a compatible ".gz" format.
So, I removed the ".gz" as an embedded resource and made the uncompressed "XML" file as the embedded resource.
Then modified the LoadInternalDictionaries( ) method in the Properties #region of DicomDictionary class definition (in DicomDictionary.cs) as follows...


private static void LoadInternalDictionaries() {
lock (_lock) {
if (_default == null) {
_default = new DicomDictionary();
_default.Add(new DicomDictionaryEntry(DicomMaskedTag.Parse("xxxx", "0000"), "Group Length", "GroupLength", DicomVM.VM_1, false,                                          DicomVR.UL));
try {
     var assembly = Assembly.GetExecutingAssembly();
                             var stream = assembly.GetManifestResourceStream("Dicom.Dictionaries.DICOM Dictionary.xml");
                             var reader = new DicomDictionaryReader(_default, DicomDictionaryFormat.XML, stream);

                             reader.Process();

This all builds fine, but I'm still not seeing my new tag recognized as a DicomDictionaryEntry in the Default dictionary.

Anyone know what I'm missing?

Thanks.
-Paul

Paul Helmuth

unread,
Jun 17, 2014, 6:15:13 PM6/17/14
to fo-d...@googlegroups.com
Getting closer...

Okay - I can now see that the modification to "LoadInternalDictionaries( )" above - DOES in fact load the embedded XML resource "DICOM Dictionary.xml"  with my new tag.

Please excuse any erroneous use of terms in the following - I'm sure I'll have some of the terms wrong, but you should be able to understand what I am trying to say...

I realize now that there is some other mechanism that initializes the DicomTag entries that are defined at design-time. 
I think IntelliSense is what Microsoft would call it. But, when you enter "DicomTag." and a list of defined elements appears.

I need to get my new tag in to this initialization process as well so that I can use the element "name" in code. Which I can't do if it's not defined as a member of DicomTag at design time.

Hopefully this makes sense - and someone understands how the list of DicomTag items is initialized.

Many thanks,
-Paul

Mahesh Dubey

unread,
Jun 18, 2014, 6:06:45 AM6/18/14
to fo-d...@googlegroups.com
Hello;
        If I understood your question correctly... You have to edit DicomTag class see DicomTagGenerated.cs  and add the entry of new your tag.

Mahesh

Paul Helmuth

unread,
Jun 18, 2014, 10:10:37 AM6/18/14
to fo-d...@googlegroups.com
Mahesh,

Brilliant! - that was it exactly.

Thank you!

-Paul
Reply all
Reply to author
Forward
0 new messages