How to add a private DICOM tag using ClearCanvas library?

357 views Asked by At

Did anyone add a private DICOM tag to a DICOM file successfully using ClearCanvas library?

The following code snippet is just what I am trying to add a private tag to the DICOM file dataset. But I can not find it when I open the saved DICOM file by MicroDicom viewer.

DicomTag tag = DicomTag.GetPrivateCreatorTag(0X7FE1, 0X0010); DataSet[tag].SetStringValue("Left");

Does anyone know the reason?

2

There are 2 answers

2
Amit Joshi On

I never used the toolkit but I can see the problem in your code.

You are creating the private tag correctly and also setting its value properly.
But, you are not adding that newly created private tag to dataset.

I am not sure about syntax. You have created a tag. Now, you need to load the file in which you want to add that tag. You access the DICOM dataset instance and add the new tag to its indexer. Then save the file.

0
HappyMouse2008 On

My colleague found out the reason for me. The code snippet of the creation for the private tag is as following,

new DicomTag((uint)group << 16 | (uint)(element >> 8), "Private Creator", "PrivateCreator", DicomVr.LOvr, false, 1, 1, false);

the element number will shift left 8 bits, so when i set it to 0X0010, the element number will be set to zero. When I change it to 0x0100, the private tag will be found by MicroDicom viewer.