Hi there,
I have been trying to add some private tags of my own using DCMTK to a DICOM file without success.
I have firstly created a project with the mkdicbi.cxx file
Then I modified the private.dic with the following:
(0029,"XXX",00) UL MyGroupLength 1
(0029,"XXX",01) DS MinTemperature 1
(0029,"XXX",02) DS MaxTemperature 1
(0029,"XXX",10) DS CameraTemperatureResolution 1
Then I generated the dcdictzz.cxx with the new private data and rebulid all the entire project.
Done all that, I put that and initially seems to work:
ds->putAndInsertString( DcmTagKey(0x0029, 0x0001), "25");
ds->putAndInsertString( DcmTagKey(0x0029, 0x0002), "35");
ds->putAndInsertString( DcmTagKey(0x0029, 0x0010), "1");
...
but then when I dump the file I get the following:
(0029,0001) UL 25 # 4, 1 PrivateGroupLengthToEnd
(0029,0010) LO [1] # 2, 1 PrivateCreator
Can anyone, please help me trying to know what happens here...thanks in advanced
cheers,
Carmelo
Issue adding Private tags
Moderator: Moderator Team
Issue adding Private tags
I used to have an interest in writing viral code and lost interest quickly when Win95 came out. Hell how could any of us in the scene write a more invasive program than Win95. It made us all obsolete.
-
- OFFIS DICOM Team
- Posts: 1445
- Joined: Tue, 2004-11-02, 17:22
- Location: Oldenburg, Germany
- Contact:
First of all, read the section in DICOM part 5 that explains how private elements work, including the reservation element.
An attribute that is encoded in private.dic as (0029,"XXX",00) means that in the dataset you find the following structure:, or, more general,.
As you see, "MyGroupLength" will never actually be a group length attribute, because the element number will always be >= 0x1000.
Secondly, when inserting new private elements into a dataset, you should explicitly pass the value representation because the dictionary lookup does not work at that point for private attributes where the VR depends on the reservation element value. Instead of using, use
An attribute that is encoded in private.dic as (0029,"XXX",00) means that in the dataset you find the following structure:
Code: Select all
(0029,0010) LO [XXX]
(0029,1000) UL 1234 # MyGroupLength
Code: Select all
(0029,00YY) LO [XXX]
(0029,YY00) UL 1234 # MyGroupLength
As you see, "MyGroupLength" will never actually be a group length attribute, because the element number will always be >= 0x1000.
Secondly, when inserting new private elements into a dataset, you should explicitly pass the value representation because the dictionary lookup does not work at that point for private attributes where the VR depends on the reservation element value. Instead of using
Code: Select all
ds->putAndInsertString( DcmTagKey(0x0029, 0x0001), "25");
Code: Select all
ds->putAndInsertString( DcmTag(0x0029, 0x1001, EVR_DS), "25");
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot], Majestic-12 [Bot] and 1 guest