You can use dcm2niix to retain personally identifying information by using the -ba n
option to (bids anonymization: no
).
Consider the dcm_qa datasets converted with the command dcm2niix -ba n -f %s_%t_%p ~/dcm_qa
. In this case, the file 25_20140310133834_fMRI_MB_asc.json
will include the details:
"SeriesInstanceUID": "1.3.12.2.1107.5.2.32.35131.2014031013014324219590803.0.0.0",
"StudyInstanceUID": "1.3.12.2.1107.5.2.32.35131.30000014022817282751500000052",
"StudyID": "1",
"PatientName": "stc_test",
"PatientID": "crlab",
"PatientBirthDate": "1980-07-07",
"PatientSex": "M",
"PatientWeight": 100.698,
...
"AcquisitionTime": "14:01:49.417500",
"AcquisitionDateTime": "2014-03-10T14:01:49.417500",
Note that DICOM filenames are typically the mediaObjectInstanceUID, which are unique for each DICOM images, and a single BIDS NIfTI file may be concatenate images from thousands of DICOM images. However, all the images should share a SeriesInstanceUID (0020,000E) that you could look up with your DICOM database system.
You could use dcm2niix to rename your DICOMs so that all images that share the SeriesInstanceUID are in a single folder where the folder name matches the SeriesInstanceUID using the %j
in the naming:
dcm2niix -r -f %t/%s_%p/%j/%4r_%o.dcm ~/path/to/DICOMs
For many users, a key aspect of DICOM to BIDS conversion is to hide personally identifiable information, and depending on where you live this may be regulated by federal laws. Therefore, you should be very careful about retaining these UIDs in datasets you are sharing. For the USA, you will want to ensure you meet the Safe Harbor principles, but laws are much stricter for EU data. The first part of the UID does reveal details of the system that generated those images, and the latter part often reveals date stamps (e.g. I suspect your data was acquired on 4 October 2023 at 9:36am). As @effigies noted, without the -ba n
option, dcm2niix will store the AcquisitionTime
in the JSON but not the AcquisitionDate (for Siemens data, the time of day helps align the images with physiological data).