Skip to content

Logo Logo

De-Identify DICOM Files Using the CLI

Introduction

It is important to remove personal health information (PHI) or de-identify data before importing it to Flywheel. The Flywheel de-identification profile allows you to configure de-identification settings for each DICOM field. Use the profile when you import existing DICOM files via the Flywheel CLI. See our De-identification overview guide for more information on de-identifying data in Flywheel.

This article explains how to use a de-id profile to de-identify data that is uploaded using the Flywheel CLI. This de-identification method is recommended if your dataset has unique de-identification needs. Otherwise, you can add a de-id profile directly to a project, group, or your entire site so all data is de-identified the same.

Instruction Steps

Step 1: Create a De-id Profile

A de-id profile is a set of instructions for what to do with metadata that may include PHI. De-id profiles can transform or remove standard DICOM tags such as PatientName, StudyDate, and PatientAge, as well as private tags unique to your institution.

Learn how to create your own de-id profile.

Step 2: Test your De-identification Profile

We recommend testing the profile on your computer before uploading data. This makes sure Personal health information (PHI) is not uploaded to Flywheel.

Test your de-id profile using the fw deid command.

Step 3: Add your De-id Profile to the CLI Config

The most robust way for implementing your de-id profile is to add it to the CLI config file:

  1. Copy and paste the following config template into a plain text editor such as TextEdit, notepad, or Sublime:
#####
# Template and Group/Project Settings
#####

template:

#####
# Optional includes/excludes for directories and files 
#####

# Patterns of directories to include
# include-dirs:  
# - "*-DCM"

# Patterns of filenames to exclude
# exclude:  
# - "*.txt"
# - "*.xml"

#####
# De-identification Settings
#####

deid-profile: custom

deid-profiles:
- name: custom

  dicom:
#Add de-id profile here.
  1. Under the De-identification Settings section, add the de-id profile you created and tested in steps 1 and 2.
  2. Save the config as a YAML file. For example, config.yaml Verify that your config is valid YAML using an online validator tool.

Step 4: Upload your Data

  1. To use this config file in your command:
fw ingest template ~/Documents/DataToImport TemplateExample --config-file ~/Documents/ExampleConfig.yaml
  1. You'll see the following output when the Flywheel CLI is using the config file:
fw ingest template ~/Documents/DataToImport TemplateExample --config-file ~/Documents/ExampleConfig.yaml

Reading config options from: Users/AvaFranklin/Documents/ExampleConfig.yaml

Note

CLI arguments override anything set in the config file. For example:

If you add the flag --group Psychology , but the config file includes the line group: PsychLab, Flywheel will use Psychology as the group name.