Read Modify and Write Siemens XA30 DICOM headers with all fields.

17 vues (au cours des 30 derniers jours)
Jason
Jason le 11 Avr 2023
Commenté : Jason le 24 Avr 2023
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

Réponses (2)

Manoj Mirge
Manoj Mirge le 21 Avr 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.
  1 commentaire
Jason
Jason le 24 Avr 2023
Looks like I mistakenly commented (below) on my own question and not to this response.
As noted below, this answer does not work. The same problems of missing fields that should not be removed or altered exists.

Connectez-vous pour commenter.


Jason
Jason le 21 Avr 2023
Thank you for the response however that doesn't work.
dicomanon with update and the original output of dicominfo should just put the header back in, but dicomwrite is probably the better method. However, both are stripping fields that are not "confidential medial information" (and dicomwrite shouldn't be stripping at all). In a T1, fields like
"ScanningSequence"
"SequenceVariant"
"ScanOptions"
"ImageTypeText"
"NonlinearGradientCorrection"
"PartialFourier"
"BaseResoluytion"
"ShimSetting"
"TxRefAmp"
"PhaseResolution"
"RecieveCoilName"
RecieveCoilSctiveElements"
"PulseSequenceDetails"
"CoilCombinationMethod"
"MatricCoilCode"
"ParallelReductionFactorInPlane"
"DwellTime"
are all missing using dicomwrite or dicomanon. Some of those are important, but regardless of whether their important or not, they shouldn't be lost reading and writing the file.
Thank you.

Catégories

En savoir plus sur DICOM Format dans Help Center et File Exchange

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by