help > DICOM attributes modified by mri_reface
Showing 1-3 of 3 posts
Display:
Results per page:
Oct 29, 2026  09:10 AM | Paul Wright - University College London
DICOM attributes modified by mri_reface

Greetings Dr Schwarz et al.


I just started testing mri_reface on DICOM images. I had some questions about the conversion process.


Several DICOM attributes are modified. Some are logging that deidentification was done (0012,006x). Others I'm less sure about. Leaving out the former, I saw these changes in my test image:


(0008,0013) InstanceCreationTime: deleted
(0008,0018) SOPInstanceUID: modified [redacted]
(0008,0033) ContentTime: deleted
(0019,1015) Private [Siemens MR header: SlicePosition_PCS]: deleted
(0020,1041) SliceLocation: deleted
(0028,0101) BitsStored: modified 12 -> 16
(0028,0102) HighBit: modified 11 -> 15
(0028,0103) PixelRepresentation: modified 0 -> 1
(0028,0107) LargestImagePixelValue: modified 11 -> 10
(0028,1050) WindowCenter: deleted
(0028,1051) WindowWidth: deleted
(0029,1010) Private [Siemens CSA header: CSAImageHeaderInfo]: deleted
(0051,100D) Private [Siemens MR header: SlicePositionText]: deleted
(0054,0081) NumberOfSlices: added -> 176
(0054,0101) NumberOfTimeSlices: added -> 1


The SOP instance UID makes sense: it says the instance was created by pydicom.


I think the (0028,010x) tags are modified because the pixel data are converted to float when read into nibabel. The largest value could change if the slice includes a face voxel (this is slice 1, so it's probably low because it's mostly air).


The private tag (0029,1010) Siemens CSA header: CSAImageHeaderInfo is listed as preserved in the LONI deidentification protocol (not required though).


I'm considering restoring some of these in a separate postprocessing pass. Can you comment on this, particularly is replacing any tags may be invalid.


Many thanks


Paul


 

  Edited (Oct 29, 2026  03:10 PM)
Oct 30, 2026  09:10 PM | Christopher Schwarz - Mayo Clinic
RE: DICOM attributes modified by mri_reface

Paul,
The ADIR_nii2dicom software we include+use in 0.3.x is writing new DICOM from the de-faced .nii, then copying only what it confidently knows won't mismatch with the newly created DICOM. So, InstanceNumber 1 may be entirely a different part of the image and could even be sliced with a totally different orietnation, vs. the original InstanceNumber 1. It's not trying to replace only PixelData or necessarily figure out/match the original ordering in the orignial DICOM. Bits, creation time, SOPInstanceUID, LargestImagePixelValue are all modified to be correct for the new data. 


For the CSA, that comes back to "only what it confidently knows won't mismatch with the newly created DICOM." It only copies the tags that are completely consistent within each volume (not necessarily in the whole series but at least in each volume). For the CSA, since it's a binary, we don't have a way to remove only certain parts. If anything in the CSA includes some info that varies for each slice (e.g. slice timing, max intensities, things like that), the whole thing is gone. The whole thing is not a perfect system but it preserves quite a bit more than any of the other nii->DICOM converters/replacers I was able to find at the time.


These challenges and others are why we've been rewriting the whole thing ground-up with an alternate approach "ADIR_DicomPixelReplacer" that probably works more like you're expecting. It also supports enhanced DICOM natively, which we needed for our Philips MEGRE support. With the new function, we'll be able to keep more tags more consistently, since it will decidedly preserve the original slice orderings. So for this, I acknowledge that we can do better, and we'll have that soon! On the other hand, it wasn't a big priority because AFAIK there's nothing too important in the CSA for the image types that we de-face. If we de-faced diffusion it would be different, but fortunately we don't have to. The need for the rewrite was mainly driven by Philips MEGRE not getting valid dcm2niix outputs after dcuncat. 


As for copying tags back post-hoc, there's probably at least one line of the CSA that won't be accurate anymore when you do that. How problematic that is vs. removing it entirely is up to you to assess. Certainly you shouldn't copy back the "modified" set of tags as those are changed for a good reason.


Chris

Nov 2, 2026  08:11 AM | Paul Wright - University College London
RE: DICOM attributes modified by mri_reface

Dear Chris


Thank you for the detailed explanation. I saw from the code it misses out anything that varies per slice, so I figured that was the reasoning. Also, it makes sense that the pixel-related attributes have to change because the image was modified (not just changing the face, but I think nibabel by default converts everything to float).


As you say, the per-image CSA header is useful for things like DWI (maybe ASL too) and we're not defacing those. The LONI deidentification protocol says to preserve this tag, but I agree it's probably not needed for the images we reface. There are some defaced images already in LONI so I'll see if those have Siemens CSA header at image level.


Kudos on working on a deeper DICOM pixel replacer.


Thanks again.


Paul