help > Customizing dicom header
Showing 1-7 of 7 posts
Display:
Results per page:
May 9, 2023  05:05 PM | Greg Wade - Johns Hopkins
Customizing dicom header
Hi Chris,
I'm trying to run mri_reface on a set of data, but I need additional Dicom information to be retained in the header.
I have tried adding my header fields to the tag_blocklist variable in the ADIRnii2dicom script where nii2dicom gets defined. However, when I rerun reface, it still outputs only the standard Dicom header fields. Do I need to change something else to include these headers in the output dicom file? 
Or is there a version of mri_reface that doesn't change the header? I have other anonymization scripts to remove PHI, and am more interested in using mri_reface more so for the removal of facial features from the scans.  

Thanks,
Greg Wade
May 22, 2023  02:05 PM | Greg Wade - Johns Hopkins
RE: Customizing dicom header
Sorry, it seems I was confused. I wasn't loading in the original dicom directory into nii2dicom properly, so it was only writing out the translational variables into the header. 
Now that I'm using the correct information I was able to output the entirety of the dicom header to the refaced image after adjusting the input variables in nii2dicom. 

Thanks anyway, this is an incredibly helpful tool!
Nov 17, 2023  10:11 PM | Christopher Schwarz - Mayo Clinic
RE: Customizing dicom header

Hi Greg, I know this is many months later, but I'm sorry I missed your message. I thought I was subscribed to this forum, but apparently I was only subscribed to the "general discussion" subforum. I'm glad you were able to figure it out! We preserve basically every DICOM tag that we can. The only ones in tag_blocklist are there because we are overwriting them elsewhere or because they would indicate that the image was mosaic or enhanced, when that would no longer be true after this process.


 


Thanks,


Chris

Aug 5, 2024  06:08 PM | Justin Kirby
RE: Customizing dicom header

Hi Chris,


When you process DICOM data do you generate unique UIDs for things like Series Instance UID and SOP Instance UID?  Or are those directly copied from the original data?  In general, I think for our purposes we'd want all relevant UIDs to be new ones that uniquely distinguish this modified series from the original.  


Also, do you populate the De-identification Method Code Sequence to indicate the Clean Recognizable Visual Features Option has been applied?


Thanks,


Justin

Aug 6, 2024  12:08 AM | Christopher Schwarz - Mayo Clinic
RE: Customizing dicom header

Justin,


When you use the DICOM-based workflow, it does NOT assign new UIDs for study and series instance UID (copies them verbatim), but it DOES add 113102 "Clean Recognizable Visual Features Option" to DeidentificationMethodCodeSequence. SOPInstanceUID and MediaStorageSOPInstanceUID are assignesd a new UID, however. I based this on the idea that it's new DICOM files, but it's still the original study and series. We also assume that this would typically be used in tandem with some other DICOM deidentification suite, which would typically assign new Study and Series UIDs while de-identifying other DICOM tags, so having our software change them would be redundant in most reasonable workflows.


Chris


 


Originally posted by Justin Kirby:



Hi Chris,


When you process DICOM data do you generate unique UIDs for things like Series Instance UID and SOP Instance UID?  Or are those directly copied from the original data?  In general, I think for our purposes we'd want all relevant UIDs to be new ones that uniquely distinguish this modified series from the original.  


Also, do you populate the De-identification Method Code Sequence to indicate the Clean Recognizable Visual Features Option has been applied?


Thanks,


Justin



 

Aug 6, 2024  01:08 AM | Justin Kirby
RE: Customizing dicom header

Hi Chris,


In our use case we intend to keep both the defaced and original series for potential use.  I agree that leaving the Study Instance UIDs alone makes sense as we want the defaced series to show up in the same study as the original series when we present the data to users who have access to both versions.   However, since the pixel data is different between the series, we don't think it's still "the same series" and should receive a new Series Instance UID.  


We could certainly address modifying the Series UID in other parts of our workflow, but I think If you're already going to the trouble of generating new SOPInstanceUIDs and MediaStorageSOPInstanceUIDs it would make logical sense to generate a new Series UID as well.


Best,


Justin

Aug 7, 2024  08:08 PM | Christopher Schwarz - Mayo Clinic
RE: Customizing dicom header

Justin,
I don't think I want to make this change for everyone, and it seems like something that wouldn't have enough usage to warrant making it an option at the top levels of the run-scripts, so anyone calling it would have to modify some code at one level or another in order to use it.


However, unlike the core of mri_reface, ADIR_nii2dicom.py is open source.


If you look at line 665:
metaOut.file_meta.MediaStorageSOPInstanceUID = pydicom.uid.generate_uid(prefix=uid_root)


you should accomplish what you want by copying this and changing it to


metaOut.file_meta.SeriesInstanceUID = pydicom.uid.generate_uid(prefix=uid_root)


Does that work for you?


Best,
Chris