DICOM private fields not written correctly with custom dicomdict

7 views (last 30 days)
I've created a dicom dict text file that contains (among other things) a floating point private tag (9003,1038).
>> current_dicom_dict = dicomdict('get_current')
current_dicom_dict =
'/Users/brian/apps/copilot/share/dicom-dict-cp.txt'
>> !cat /Users/brian/apps/copilot/share/dicom-dict-cp.txt | tail -n 1
(9003,1038) FL DaysSincePriorStudy 1
The value of this tag is correctly set in the metadata struct:
>> metadata_out.Private_9003_1038
ans =
single
24.3231
I write the file with DICOMWRITE and read the file metadata back in with DICOMINFO:
dicomwrite(dat, 'test.dcm', metadata_out, 'CreateMode', 'copy', 'WritePrivate', 1);
metadata_in = dicominfo('test.dcm');
The metadata that I read back in failed to parse the private field correctly:
>> metadata_in.Private_9003_1038
ans =
4×1 uint8 column vector
176
149
194
65
Why is my private field not parsed correctly by DICOMINFO?

Answers (1)

Jayanti
Jayanti on 21 Aug 2025 at 9:23
Edited: Jayanti on 21 Aug 2025 at 9:25
Hi Brian,
It looks like the issue might be due to the fact that "dicominfo" is not using your custom DICOM dictionary when reading the file back.
So before calling "dicominfo", set your custom dictionary like below:
dicomdict('set', current_dicom_dict);
For more details please refer to the below offical documentation link on "dicomdict":

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!