Visual Neuroscience Lab
  • Home
  • Neurodesktop
  • Behavioral
  • Labmeeting
  • DICOM to GLM
  • MRI
  • People
  • Other Topics
  • Archive
  1. MRI: from DICOM to GLM Analysis
  2. 03 - Defacing
  • Home
  • Neurodesktop
  • MRI: from DICOM to GLM Analysis
    • 01 - DICOM to BIDS
    • 02 - T1w for PBn
    • 03 - Defacing
    • 04 - Removing Noise Scan
    • 05 - fmriprep
    • 06 - first level GLM
    • Troubleshooting
  • MRI
    • Retinotopic Mapping
    • 3D printing a brain
    • 7T anatomical analysis on neurodesk
    • MRI BIDS and OSF
    • fMRIprep analysis
    • Old MRI setup
    • Update to the MRI lab setup
    • Physiological noise correction
  • Behavioral
    • Vision tests
    • BIDS for behavioral studies
    • Custom-built chin rests
  • People
    • Stipends and prizes for master students
    • Coffee time
    • Participant compensation
    • Things to do if you are leaving the lab
    • Scientific writing in practice
    • Interns
    • Pflichtpraktikum
  • Other Topics
    • Calculating a priori sample size using G Power
    • Gamma correction
    • Contribute to the website
    • Lab Members Only!!!
  • Labmeeting
  • Archive

On this page

  • 1 General Information
  • 2 Defacing your T1w-Scan
    • 2.1 Start Pydeface (v.2.0.2)
    • 2.2 Get the path to your original T1w scan
    • 2.3 The pydeface command
    • 2.4 The next steps
  1. MRI: from DICOM to GLM Analysis
  2. 03 - Defacing

03 - Defacing

MRI
Preprocessing
Neurodesk
Step by step description of how to deface your data
Author

MG

Published

April 13, 2025

1 General Information

When we acquired data “ourselves” (and start with the dicom files), we have to deface the T1w-scan! (When we get our data from the MRI-Lab, it will already be defaced)

To deface your T1w-scan, you first need a T1w nifti file! If you currently have DICOM files, you have to convert them to nifti’s first!

Defacing you T1w scans is an important preprocessing step that has to be done beforerunning fmriprep. If you run fmriprep without prior defacing, you´ll probably run into errors!

Important (if you promised participants that they´ll get their T1w scan): Since we get already defaced images when not testing ourselves, every participant only gets the defaced T1w-scans. Thus, you have to do the defacing before sending the file to your participant!

2 Defacing your T1w-Scan

2.1 Start Pydeface (v.2.0.2)

To deface your t1w, you first have to open pydeface:

  1. Click on the Birds-Symbol at the bottom left

  2. Hover Neurodesk

  3. Hover All Applications

  4. Scroll down until you find pydeface

  5. Click on pydeface 2.0.2 Pydeface 2.0.2

After it opens, it may need some time to load everything - be patient!

Finally, it should look like this: Pydeface Started

2.2 Get the path to your original T1w scan

  1. Navigate to the anatomical scan of the participant within your BIDS directory

  2. Right-click on the anatomical nifti file

  3. Select `Copy Path(s) Get Path(s) of anat-scan

2.3 The pydeface command

  1. Go back to the terminal window, where pydeface is loaded (or start it again)

  2. Type pydeface

  3. Enter the path to your T1w scan (right-click + paste or type in the path)

  4. Type --outfile

  5. Repeat Step 3 (with this approach, you “overwrite” the initial T1w with the then defaced T1w file)

  6. Type --force

It should look like this: Pydeface Command

pydeface /home/jovyan/Website/bids/sub-999/ses-1/anat/sub-999_ses-1_T1w.nii.gz --outfile /home/jovyan/Website/bids/sub-999/ses-1/anat/sub-999_ses-1_T1w.nii.gz --force

Then, press enter. Again, it might take a few moments, until pydeface finishes, be patient! At the end, it should look like this: Pydeface Finished

2.4 The next steps

Congratulations, you successfully defaced a T1w-scan and you are one step closer to analyzing your data!

To continue in your journey to your Analysis, please return to the Overview-Page to check what to do next.

Alternatively, here is a list of potential next steps to continue with

  1. Remove Denoising Scans from your data?

  2. run fmriprep

Back to top