Private tag support
Moderator: Moderator Team
-
- Posts: 7
- Joined: Wed, 2023-02-08, 18:18
Private tag support
Dear Dev team,
I’m trying to extend dcmtk to support private tags via my own xyz.dic. I was able to generate or convert my xyz.dic to xyz.h, as shown below:
(0011,"Jhu-X",10) LO JhuGroup11 1 PrivateTag
(0011,"Jhu -X",01) CS PatientType 1 PrivateTag
(0011,"Jhu -X",02) CS PatientStatus 1 PrivateTag
(0011,"Jhu -X",03) LO PlanUuid 1 PrivateTag
(0011,"Jhu -X",04) LO TrackingMaskUuid 1 PrivateTag
(0011,"Jhu -X",05) LO PatientUuid 1 PrivateTag
(0011,"Jhu -X",06) LO PatientPictureUuid 1 PrivateTag
The generated tags are:
#define DCM_PatientUID DcmTagKey(0x0011, 0x0003)
#define DCM_PatientType DcmTagKey(0x0011, 0x0001)
#define DCM_PatientStatus DcmTagKey(0x0011, 0x0002)
#define DCM_PlanUuid DcmTagKey(0x0011, 0x0003)
#define DCM_TrackingMaskUuid DcmTagKey(0x0011, 0x0004)
#define DCM_PatientUuid DcmTagKey(0x0011, 0x0005)
#define DCM_PatientPictureUuid DcmTagKey(0x0011, 0x0006)
#define DCM_JhuGroup11 DcmTagKey(0x0011, 0x0010)
When adding tags to DICOM file in the following way:
dcmDS->putAndInsertString(DCM_JhuGroup11, "Jhu-X");
dcmDS->putAndInsertString(DCM_PatientType, "Phantom");
dcmDS->putAndInsertString(DCM_PatientStatus, "New");
…
Only DCM_JhuGroup11 is added successfully.
Can you help me get my other tags added? Basically I'd like to operate (read/write) private tags like public ones by extending the public dictionary.
Thanks,
Jack
I’m trying to extend dcmtk to support private tags via my own xyz.dic. I was able to generate or convert my xyz.dic to xyz.h, as shown below:
(0011,"Jhu-X",10) LO JhuGroup11 1 PrivateTag
(0011,"Jhu -X",01) CS PatientType 1 PrivateTag
(0011,"Jhu -X",02) CS PatientStatus 1 PrivateTag
(0011,"Jhu -X",03) LO PlanUuid 1 PrivateTag
(0011,"Jhu -X",04) LO TrackingMaskUuid 1 PrivateTag
(0011,"Jhu -X",05) LO PatientUuid 1 PrivateTag
(0011,"Jhu -X",06) LO PatientPictureUuid 1 PrivateTag
The generated tags are:
#define DCM_PatientUID DcmTagKey(0x0011, 0x0003)
#define DCM_PatientType DcmTagKey(0x0011, 0x0001)
#define DCM_PatientStatus DcmTagKey(0x0011, 0x0002)
#define DCM_PlanUuid DcmTagKey(0x0011, 0x0003)
#define DCM_TrackingMaskUuid DcmTagKey(0x0011, 0x0004)
#define DCM_PatientUuid DcmTagKey(0x0011, 0x0005)
#define DCM_PatientPictureUuid DcmTagKey(0x0011, 0x0006)
#define DCM_JhuGroup11 DcmTagKey(0x0011, 0x0010)
When adding tags to DICOM file in the following way:
dcmDS->putAndInsertString(DCM_JhuGroup11, "Jhu-X");
dcmDS->putAndInsertString(DCM_PatientType, "Phantom");
dcmDS->putAndInsertString(DCM_PatientStatus, "New");
…
Only DCM_JhuGroup11 is added successfully.
Can you help me get my other tags added? Basically I'd like to operate (read/write) private tags like public ones by extending the public dictionary.
Thanks,
Jack
-
- DCMTK Developer
- Posts: 2541
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: Private tag support
Apparently, the VR is missing for your private tags. By the way, there is a "Howto" on adding private data elements to a DICOM dataset: https://support.dcmtk.org/redmine/proje ... rivateData
-
- Posts: 7
- Joined: Wed, 2023-02-08, 18:18
Re: Private tag support
Hi J. Riesmeier,
I'm able to add private tags via the instructions provided by "Howto" already. However, I don't want to use that approach of registering private tags at runtime. My understanding is that private tag support can also be achieved by extending the dicom.dic as described in https://support.dcmtk.org/docs/file_datadict.html so that private tags will be able to be used in the same way as public tags.
So I did the following:
1. create my own myprivate.dic by following your private.dic
2. generate private.h using myprivate-mkdeftag.h
What other steps do I need to do in order to use those private tags defined in myprivate.dic?
BTW, you pointed out that "VR missing"? I did have VR defined in my private tag definition, e.g., (0011,"Jhu-X",10) LO JhuGroup11 1 PrivateTag.
Thanks,
Jingkun
I'm able to add private tags via the instructions provided by "Howto" already. However, I don't want to use that approach of registering private tags at runtime. My understanding is that private tag support can also be achieved by extending the dicom.dic as described in https://support.dcmtk.org/docs/file_datadict.html so that private tags will be able to be used in the same way as public tags.
So I did the following:
1. create my own myprivate.dic by following your private.dic
2. generate private.h using myprivate-mkdeftag.h
What other steps do I need to do in order to use those private tags defined in myprivate.dic?
BTW, you pointed out that "VR missing"? I did have VR defined in my private tag definition, e.g., (0011,"Jhu-X",10) LO JhuGroup11 1 PrivateTag.
Thanks,
Jingkun
-
- DCMTK Developer
- Posts: 2541
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: Private tag support
That's correct.My understanding is that private tag support can also be achieved by extending the dicom.dic as described in https://support.dcmtk.org/docs/file_datadict.html so that private tags will be able to be used in the same way as public tags.
This is not really necessary, and your DcmTagKey definitions also seem to be wrong [*], e.g. instead ofgenerate private.h using myprivate-mkdeftag.h
Code: Select all
#define DCM_PatientUID DcmTagKey(0x0011, 0x0003)
Code: Select all
#define DCM_PatientUID DcmTagKey(0x0011, 0x1003, "Jhu-X")
HTH
[*] The mkdeftag tool does not support DcmTagKey definitions for private tags, AFAICR. This is because creating DCM_xxx names from the private tags in the "private.dic" file that is shipped with the DCMTK is probably not possible.
-
- Posts: 7
- Joined: Wed, 2023-02-08, 18:18
Re: Private tag support
Hi J. Reismeier,
In
#define DCM_PatientUID DcmTagKey(0x0011, 0x1003, "Jhu-X"), DcmTagKey can't take 3 parameters though. Did I miss any point?
Thanks,
Jingkun
In
#define DCM_PatientUID DcmTagKey(0x0011, 0x1003, "Jhu-X"), DcmTagKey can't take 3 parameters though. Did I miss any point?
Thanks,
Jingkun
-
- DCMTK Developer
- Posts: 2541
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: Private tag support
Sorry, I wanted to refer to DcmTag (not DcmTagKey), which has two constructors that allow for specifying the Private Creator identifier as an optional parameter (see documentation).
-
- Posts: 7
- Joined: Wed, 2023-02-08, 18:18
Re: Private tag support
Hi J. Reismeier,
That does the trick!
I'm able to write and read my private tags as expected.
Your help is greatly appreciated!
Thanks,
Jingkun
That does the trick!
I'm able to write and read my private tags as expected.
Your help is greatly appreciated!
Thanks,
Jingkun
Who is online
Users browsing this forum: Bing [Bot], George, Google [Bot] and 1 guest