dcm2xml to remove a tag

43 views
Skip to first unread message

Matt Granger

unread,
Dec 29, 2017, 3:41:47 AM12/29/17
to dcm4che
I am successfully using dcm2xml to modify the DICOM tags in a DICOM file, but I do not see if there is a way to entirely delete a DICOM tag instead of just setting it to an empty value.  For instance, I have an XML file with the data shown below.  You can see I am setting the accession number to "A1234567890" and I have set the Manufacturer  to an empty value.  Say I have a DICOM file named "test.dcm" which already contains both accession number and manufacturer tags and I use this xml2dcm command on it:

xml2dcm -f -i test.dcm -x new.xml -o testout.dcm

The accession number is correctly updated and the manufacturer tag will be an empty value.  Is there a way to format the XML file so the Manufacturer tag will be entirely removed?

<?xml version="1.0" encoding="UTF-8"?>
<NativeDicomModel xml:space="preserve">
 
<DicomAttribute keyword="AccessionNumber" tag="00080050" vr="SH">
 
<Value number="1">A1234567890</Value>
 
</DicomAttribute>
 
<DicomAttribute keyword="Manufacturer" tag="00080070" vr="LO">
 
<Value number="1"></Value>
 
</DicomAttribute>
</NativeDicomModel>

I've tried this as well and it still leaves an empty Manufacturer tag, too:

<?xml version="1.0" encoding="UTF-8"?>
<NativeDicomModel xml:space="preserve">
 
<DicomAttribute keyword="AccessionNumber" tag="00080050" vr="SH">
 
<Value number="1">A1234567890</Value>
 
</DicomAttribute>
 
<DicomAttribute keyword="Manufacturer" tag="00080070" vr="LO">
 
</DicomAttribute>
</NativeDicomModel>

Any ideas? Thanks!


Reply all
Reply to author
Forward
0 new messages