How can I copy the metadata from one dicom to another?

Briefly, I need to convert my dicoms to analyze to manipulate them, and then need to convert them back. Some header info gets lost during this process, which I need. I found the dicomwrite section in the Documentation Center, but Matlab is not reading the image in my dicom file, so this does not work. Is there a method of saving header info to a dicom without changing the image?

Answers (1)

Perhaps I'm missing something, but can't you read the image in and then write it out with modified info?
For example:
info = dicominfo('CT-MONO2-16-ankle.dcm');
X = dicomread('CT-MONO2-16-ankle.dcm');
modify info
info.PatientName.FamilyName = 'Sean';
dicomwrite(X, 'sc_file.dcm',info);
%%verify
infonew = dicominfo('sc_file.dcm');
infonew.PatientName.FamilyName

4 Comments

The dicomread command isn't working with the converted-back-from-analyze dicom files. it reads:
Warning: Extra pixel data ignored.
> In dicomread>processRawPixels at 694
In dicomread>newDicomread at 219
In dicomread at 80
X =
Empty array: 256-by-256-by-1-by-0
I'm uncertain as to why, as my dicom viewer has no issue with the files. I was hoping there was some way to circumvent this step.
How did you convert them from Analyze?
I tried it two different ways, with a program called SPIN (Signal Processing in NMR) and with MIPAV (downloaded from NIH). In both cases, SPIN (the dicom viewer I use) will open up each stack of images and allow me to scroll through them correctly.
Hi Natalie,
Please contact technical support and reference this thread.

Sign in to comment.

Asked:

on 11 Jun 2014

Commented:

on 16 Jun 2014

Community Treasure Hunt

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

Start Hunting!