Skip to content

can-lab/pseuDICOM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 

Repository files navigation

pseuDICOM

Pseudonimize (f)MRI data in DICOM format

by Florian Krause

Introduction

To share (f)MRI DICOM images with other researchers, the data has to be pseudonimized. This entails two steps:

  1. Anonymization of all images (i.e. removing identifiable personal and potentially identifiable information from the DICOM header)
  2. 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.

Prerequisites

  1. Install FSL
  2. Install MRIcroGL (includes a binary for dcm2niix)
  3. Download pseuDICOM
  4. Install with
    pip3 install pseuDICOM-X.X.X.zip
    
    (replace X.X.X with latest release version)

Donders cluster

If you are working on the compute cluster of the Donders Institute, please follow the following steps:

  1. Load Anaconda3 module by running command: module load anaconda3
  2. Create new environment in home directory by running command: cd && python3 -m venv pseudicom_env
  3. Activate new environment by running command: source pseudicom_env/bin/activate
  4. Update pip and install wheel as well as numpy and nibabel (both needed for quickshear installation): pip3 install -U pip wheel numpy nibabel
  5. Download pseuDICOM
  6. Install with
    pip3 install pseuDICOM-X.X.X.zip
    
    (replace X.X.X with latest release version)

Usage

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!

Donders cluster

If you are working on the compute cluster of the Donders Institute, please follow the following steps:

  1. Start a new interactive job by running command: qsub -I -l 'procs=8, mem=64gb, walltime=24:00:00'
  2. Load the dcm2niix module by running command: module load dcm2niix
  3. Activate environment by running command: source pseudicom_env/bin/activate
  4. Write script mystudy_pseudicom.py (see above for example)
  5. Run script by running command: python3 mystudy_pseudicom.py

About

Pseudonimize (f)MRI data in DICOM format

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages