Note that there are some explanatory texts on larger screens.

plurals
  1. POWriting Private Dicom data in matlab without modifying the dictionary
    text
    copied!<p>I am reading a dicom file in matlab and modifying some data of it and trying to save it into another file, but while doing so, the private dicom data are either not written at all (when 'WritePrivate' is set to 0) or it's written as a UINT8 array which become incomprehensible and useless. I even tried to copy the data that I get in from the original dicom file to a new structure and write to a new dicom file but even though the private data remains fine in new structure it doesn't remain so in the new dicom file. Is there any way to keep this private data intact while copying in to a new dicom file without changing the matlab dicom dictionary?</p> <p>I have provided the following code to show what I'm trying to do.</p> <pre><code>X=dicomread('Bad011_4CH_01.dcm'); metadata = dicominfo('Bad011_4CH_01.dcm'); metadata.PatientName.FamilyName='LastName'; metadata.PatientName.GivenName='FirstName'; birthday=metadata.PatientBirthDate; year=birthday(1,1:4); newyear=strcat(year,'0101'); metadata.PatientBirthDate=newyear; names=fieldnames(metadata); h=metadata; dicomwrite(X,'example.dcm',h,'CreateMode','copy'); newh=dicominfo('example.dcm'); </code></pre> <p>Here the data in newh contains none of the private data. If I change the code to the following</p> <pre><code>dicomwrite(X,'example.dcm',h,'CreateMode','copy','WritePrivate',1); </code></pre> <p>In this case the private data gets totally changed to some UIN8 array and useless. The ideal solution for my task would be to enable keeping the private data in the newly created dicom file without changing the matlab dicom dictionary.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload