Read Modify and Write Siemens XA30 DICOM headers with all fields.
17 views (last 30 days)
Show older comments
Hello
I'm trying to modify new Siemens XA30 DICOM headers. I only need to change a few fields (like Subject ID) but I need to preserve everything in the header. Based on the documentation, it looks to me that something like:
%--------
info=dicominfo(dicomFIleName);
info.PatientName.FamilyName='SOMETHINGELSE';
info.PatientID='SOMETHINGELSE';
dicomanon( dicomFileName, dicomFIleName, 'update', info, 'WritePrivate', true );
%------
should work. However, this wipes out a large number of fields like "ScanningSequence" and "SequenceVariant" as well as a large amount of the needed details about the scan (slice timing, totalreadouttime, etc.), basically ruining the header.
Is there either an alternative that would keep all the header information intact, or a plan to update the set of dicom functions in Matlab to more fully support the new Siemens format?
Thanks
0 Comments
Answers (2)
Manoj Mirge
on 21 Apr 2023
Hi Jason,
The syntax “dicomanon(file_in,file_out)” removes confidential medical information from the DICOM file file_in and creates a new file file_out with the modified values. That is why your new file has some fields removed from it.
To achieve the intended result, you can use the dicomwrite function.
You can achieve your desired result using the below code:
x=dicomread(dicomFileName);
info=dicominfo(dicomFileName);
% Modify the metadata
info.PatientName.FamilyName='SOMETHINGELSE';
info.PatientID='SOMETHINGELSE';
% Write the modified metadata in same file
dicomwrite(x,dicomFileName,info,"CreateMode","copy");
% This will modify your dicom file’s header.
You can read more about dicomwrite function here:
Hope this helps.
See Also
Categories
Find more on DICOM Format in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!