Why some DICOM info cannot be added to the Header?

7 views (last 30 days)
Hello all,
I am creating a DICOM file using MatLab and adding data to the header. What I could not understand or figure out is when when I used for example the following code:
info.(dicomlookup('0010', '0010'))='name'
to enter the patient name it worked, as well as many other metadata. However, when I tried entering some other info, it did not give me an error at first, but after creating the dicom file then trying reading the specific data in the dicom info, it kept saying reference to non existed field.
For example, I tried entering clinic name using the following line: info.(dicomlookup('0008', '0080'))
It did not give me an error when creating the file, but after I tried to dicomread what has already been written, it said:
(Reference to non-existent field 'InstitutionName').
I used the same method for other data like patient name and it worked though. Can anyone please help me understand how to do this. I also used different versions at school hoping that it is just a bug but with no luck!
Thanks in advance!
Ali

Accepted Answer

Nalini Vishnoi
Nalini Vishnoi on 6 May 2015
Edited: Walter Roberson on 6 May 2015
Hello Mohammed,
This behavior seems to be related to the 'CreateMode' option of the dicomwrite function. It is set to 'Create' by default. If you set it to 'Copy' everything works fine. I have tested the following example with MATLAB R2014a and it seems to work fine:
>> X = dicomread('CT-MONO2-16-ankle.dcm');
>> info = dicominfo('CT-MONO2-16-ankle.dcm');
>> info.(dicomlookup('0010', '0010'))='name';
>> info.(dicomlookup('0008', '0080')) = 'Abc XyZ';
>> dicomwrite(X, 'ct_file.dcm', info,'CreateMode','Copy');
>> metadata = dicominfo('ct_file.dcm');
>> metadata.PatientName
>> metadata.InstitutionName
I hope this information and example helps.
Nalini
  1 Comment
mohammed
mohammed on 9 May 2015
Hi Nalini,
Thanks for your answer. That certainly helped and worked. However, I it did not accept strings for exposure time and current. It accepted strings for the KVP. I was able to work around it and get the current in, but it had a strange behavior when entering the exposure.
It rounds the number, i.e. if the number is 0.6 it makes it 1. So, I thought maybe I should multiply it by 1000 to make it in milliseconds. However, when adding 400 it takes it as 1.
Your help is appreciated since I have a deadline :/
Thanks Mohammed Ali

Sign in to comment.

More Answers (0)

Categories

Find more on DICOM Format in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!