Pseudonimize (f)MRI data in DICOM format
To share (f)MRI DICOM images with other researchers, the data has to be pseudonimized. This entails two steps:
- Anonymization of all images (i.e. removing identifiable personal and potentially identifiable information from the DICOM header)
- Defacing high-resolution anatomical images (i.e. removing anterior pxiel data that might allow for reconstructing facial features)
pseuDICOM will perform both of these steps in one go and, unlike most defacing tools, output the final result again in DICOM format.
- Install FSL
- Install MRIcroGL (includes a binary for dcm2niix)
- Download pseuDICOM
- Install with
(replace X.X.X with latest release version)
pip3 install pseuDICOM-X.X.X.zip
If you are working on the compute cluster of the Donders Institute, please follow the following steps:
- Load Anaconda3 module by running command:
module load anaconda3
- Create new environment in home directory by running command:
cd && python3 -m venv pseudicom_env
- Activate new environment by running command:
source pseudicom_env/bin/activate
- Update pip and install wheel as well as numpy and nibabel (both needed for quickshear installation):
pip3 install -U pip wheel numpy nibabel
- Download pseuDICOM
- Install with
(replace X.X.X with latest release version)
pip3 install pseuDICOM-X.X.X.zip
An simple example running pseuDICOM on data from a single session with default arguments:
from pseudicom import pseudonimize_dicoms
pseudonimize_dicoms("path/to/session_dir")
A more advanced example running pseuDICOM on the data of an entire study with some custom arguments:
import os
import glob
from pseudicom import pseudonimize_dicoms
for subject_dir in glob.glob("path/to/study_dir/sub*"):
for session_dir in glob.glob(os.path.join(subject_dir, "ses-,ri*)):
pseudonimize_dicoms(session_dir,
anatomy_keywords=["t1","AAHead_Scout"],
tags_to_clear=[
"(0010, 0010)", # Patient's Name
"(0010, 0030)", # Patient's Birth Date
])
Please note that pseuDICOM always assumes that DICOM images are organized in dedicated run/series subdirectories!
If you are working on the compute cluster of the Donders Institute, please follow the following steps:
- Start a new interactive job by running command:
qsub -I -l 'procs=8, mem=64gb, walltime=24:00:00'
- Load the dcm2niix module by running command:
module load dcm2niix
- Activate environment by running command:
source pseudicom_env/bin/activate
- Write script
mystudy_pseudicom.py
(see above for example) - Run script by running command:
python3 mystudy_pseudicom.py