Why some DICOM info cannot be added to the Header?

10 次查看(过去 30 天)
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

采纳的回答

Nalini Vishnoi
Nalini Vishnoi 2015-5-6
编辑:Walter Roberson 2015-5-6
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 个评论
mohammed
mohammed 2015-5-9
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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 DICOM Format 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by