Reading and re-writing a Dicom file (header) with private tags
I have an RT ION dicom plan file which has a big nested header file with a lot of private tags.
I have opened the header file and processed everything I need to process and want to write it back into an updated DICOM RT plan file.
The plan file writes back. However, all the private or unknown tags that are not in the DICOM dictionary (dicom-dict.txt file) get read and re-written with a Private_ prefix e.g. Private_0300_0309 and the values under these tags is usually garbled.
Things I’ve tried so far:
I just let the private tags stay in as they are but then my re-written file has trouble being read again by the planning system I want to re-send, so that’s a no go.
I have all the information about the type of these DICOM tags (VR, VM, etc) and I have added a few of them to the dicom-dict.txt file but it makes no difference, and they still get read as private_ tags and get re-written as private tags.
I have tried using the ‘wiriteprivate’ modifier with dicomwrite but it doesn’t help because the tags are probably still showing up as private tags.
(dicomwrite([], FNnew, DICinfo, ‘CreateMode’, ‘copy’ , ‘WritePrivate’, true)
Is there any way to manually change the name of the tag/variable and assign the correct values or something? I can read the garbled values under these private tags using the char function on the transpose of the value. eg. char(variable’) but there’s not much I can do with that information unless I can re-write the name of the variable/tag and remove the private_ prefix of the tag name.
Or is there something I’m missing with teh dicom-dict.txt file? Do I need to force matlab to refresh or read it, or check if my additional tags in the dicom-dict.txt file have been read and accepted properly?
I’ve already spent a lot of time looking for a solution and I feel like a solution is right around the corner but I can’t figure it out.
Any help would be greatly appreciated.I have an RT ION dicom plan file which has a big nested header file with a lot of private tags.
I have opened the header file and processed everything I need to process and want to write it back into an updated DICOM RT plan file.
The plan file writes back. However, all the private or unknown tags that are not in the DICOM dictionary (dicom-dict.txt file) get read and re-written with a Private_ prefix e.g. Private_0300_0309 and the values under these tags is usually garbled.
Things I’ve tried so far:
I just let the private tags stay in as they are but then my re-written file has trouble being read again by the planning system I want to re-send, so that’s a no go.
I have all the information about the type of these DICOM tags (VR, VM, etc) and I have added a few of them to the dicom-dict.txt file but it makes no difference, and they still get read as private_ tags and get re-written as private tags.
I have tried using the ‘wiriteprivate’ modifier with dicomwrite but it doesn’t help because the tags are probably still showing up as private tags.
(dicomwrite([], FNnew, DICinfo, ‘CreateMode’, ‘copy’ , ‘WritePrivate’, true)
Is there any way to manually change the name of the tag/variable and assign the correct values or something? I can read the garbled values under these private tags using the char function on the transpose of the value. eg. char(variable’) but there’s not much I can do with that information unless I can re-write the name of the variable/tag and remove the private_ prefix of the tag name.
Or is there something I’m missing with teh dicom-dict.txt file? Do I need to force matlab to refresh or read it, or check if my additional tags in the dicom-dict.txt file have been read and accepted properly?
I’ve already spent a lot of time looking for a solution and I feel like a solution is right around the corner but I can’t figure it out.
Any help would be greatly appreciated. I have an RT ION dicom plan file which has a big nested header file with a lot of private tags.
I have opened the header file and processed everything I need to process and want to write it back into an updated DICOM RT plan file.
The plan file writes back. However, all the private or unknown tags that are not in the DICOM dictionary (dicom-dict.txt file) get read and re-written with a Private_ prefix e.g. Private_0300_0309 and the values under these tags is usually garbled.
Things I’ve tried so far:
I just let the private tags stay in as they are but then my re-written file has trouble being read again by the planning system I want to re-send, so that’s a no go.
I have all the information about the type of these DICOM tags (VR, VM, etc) and I have added a few of them to the dicom-dict.txt file but it makes no difference, and they still get read as private_ tags and get re-written as private tags.
I have tried using the ‘wiriteprivate’ modifier with dicomwrite but it doesn’t help because the tags are probably still showing up as private tags.
(dicomwrite([], FNnew, DICinfo, ‘CreateMode’, ‘copy’ , ‘WritePrivate’, true)
Is there any way to manually change the name of the tag/variable and assign the correct values or something? I can read the garbled values under these private tags using the char function on the transpose of the value. eg. char(variable’) but there’s not much I can do with that information unless I can re-write the name of the variable/tag and remove the private_ prefix of the tag name.
Or is there something I’m missing with teh dicom-dict.txt file? Do I need to force matlab to refresh or read it, or check if my additional tags in the dicom-dict.txt file have been read and accepted properly?
I’ve already spent a lot of time looking for a solution and I feel like a solution is right around the corner but I can’t figure it out.
Any help would be greatly appreciated. dicom, dicomwrite, private tags, private MATLAB Answers — New Questions