Behavior and Neuroimaging Core User Manual
  • About
  • Infrastructure Overview
  • XNAT
    • Getting Started
    • Accessing XNAT
    • BIDS Ready Protocols
    • New XNAT projects
    • Uploading Data
    • Downloading Data
  • Demo Dataset
    • Introduction
    • How to access it
    • Protocol Information
    • Basic analysis example: checks task
  • XNAT to BIDS
    • Getting Started
    • XNAT2BIDS Software
    • Exporting to BIDS using Oscar
      • Oscar Utility Script
        • Running xnat2bids using default configuration
        • Running xnat2bids with a custom configuration
        • Syncing your XNAT project & Oscar data directory
        • Extra tools & features
      • Step-wise via Interact Session
    • BIDS Validation
      • Oscar
      • Docker
    • Converting non-MR data
      • Physiological data
      • EEG data
  • XNAT TO BIDS (Legacy)
    • Oscar SBATCH Scripts
  • BIDS and BIDS Containers
    • Introduction to BIDS
    • mriqc
    • fmriprep
    • BIDS to NIMH Data Archive (NDA)
  • Analysis Pipelines
    • Freesurfer
    • đźš§CONN Toolbox
    • FSL topup and eddy
    • Tractography: DSI Studio
    • Brown University MRS Data Collection and Preprocessing Protocol
    • LC Model
      • Installation
      • Example Run
      • Running LCModel on your own data
    • Quantitative Susceptibility Mapping (QSM)
  • Standalone Tools
    • Multi-session spectroscopy with voxalign
    • dicomsort: a tool to organize DICOM files
    • ironmap
    • convert enhanced multi-frame DICOMs to legacy single-frame
    • DICOM anonymization
  • MRF GUIDES
    • MRI simulator room
      • Motion Trainer: Balloon Task
      • Simulating scanner triggers
    • Stimulus display & response collection
    • Eyetracking at the scanner
    • Exporting data via scannershare
    • EEG in the scanner
    • Exporting spectroscopy RDA files
  • Community
    • MRF/BNC user community meetings
Powered by GitBook
On this page
  • Running fmriprep
  • Getting a different version than what is installed in Oscar.

Was this helpful?

  1. BIDS and BIDS Containers

fmriprep

a BIDS app that runs a standardized and reproducible preprocessing pipeline on structural and functional MRI data

PreviousmriqcNextBIDS to NIMH Data Archive (NDA)

Last updated 7 months ago

Was this helpful?

Running

1. Write a batch script

We keep up-to-date Singularity images for fmriprep for the community. (Look in /oscar/data/bnc/simgs/nipreps/ to see which versions we currently have available.) In order to run fmriprep on Oscar, you'll need to write a batch script. Here is an example:

demodat_fmriprep_example.sh -- Filename and not part of the script!
#!/bin/bash
#SBATCH -N 1
#SBATCH -c 8
#SBATCH --mem=32G
#SBATCH --time 18:00:00
#SBATCH -J fmriprep
#SBATCH --output fmriprep-log-%J.txt
#SBATCH --mail-user example-user@brown.edu
#SBATCH --mail-type ALL

#---------CONFIGURE THESE VARIABLES--------------
export_dir=/oscar/data/<group>/<user>/xnat-exports/bnc/study-demodat
participant_label=005
fmriprep_version=24.1.0
#---------END OF VARIABLES------------------------

singularity run --cleanenv                                         \
  --bind ${export_dir}:/data                    \
  --bind /oscar/scratch/${USER}:/scratch                            \
  --bind /oscar/data/bnc/licenses:/licenses                         \
  /oscar/data/bnc/simgs/nipreps/fmriprep-${fmriprep_version}.sif    \
  /data/bids /data/bids/derivatives/fmriprep-${fmriprep_version}   \
  participant --participant-label ${participant_label}             \
  --output-spaces T1w MNI152NLin2009cAsym MNI152NLin6Asym:res-2    \
  --fs-license-file /licenses/freesurfer-license.txt               \
  -w /scratch/fmriprep                                             \
  --omp-nthreads 16 --nthreads 16 --stop-on-first-crash

✋Understanding the batch script

  • The first part of the script configures the variables (e.g., number of cores, memory, etc) for your JOB. Make sure to update the email address if you'd like to get email updates about your job.

  • The second part invokes fmriprep singularity image. Keep in mind the following considerations:

    • Singularity containers run as your user, and therefore should have the same read/write permissions as your local user in the cluster

    • Singularity containers only share $HOME with the Oscar file system. Therefore, any other location that we want to read and write to/from, needs to be specified using the --bind hostfolder:containerfolder input. This includes any directory in your home directory that is a symbolic link. For instance $HOME/data usually points to /oscar/data/<group> in that case we must bind /oscar/data/<group>

    • You must specify the location inside the container of the FreeSurfer license.

2. Run the batch script

cd /path/to/sbatch/script
sbatch demodat_fmriprep_example.sh

âś‹ Troubleshooting:

fmriprep may fail for many reasons. Here are few tips:

  • Freesurfer is often difficult to get to completion, if it helps troubleshooting, you can turn FreeSurfer reconstruction off by adding the flag --fs-no-reconall

⚠️ At least as of fmriprep version 23.1.3, susceptibility distortion correction performs very poorly if you supply phase difference field maps like we have in the demodat dataset, actually making distortion worse. Distortion correction performance is much better with the 20.2.7 LTS version of fmriprep, which we also have available on Oscar.

Let us know if you are interested in this documentation!

Getting a different version than what is installed in Oscar.

To build the image, you can run:

version=22.0.0
singularity build fmriprep-${version}.sif docker://nipreps/fmriprep:${version}

To support scientific reproducibility, it is recommended to use a specific tag e.g., 22.0.0 instead of latest

For more information about managing your job, see the

Familiarize yourself with the inputs and don't hesitate to ask the developers questions. Good places to look/ask for help are their GitHub issues and the

If you wish to use a version not available under /oscar/data/bnc/simg/nipreps, you'll need to build the image. Singularity images can be large, therefore consider using a place with sufficient quota and changing the default location singularity uses to cache these files. Please see .

Replace version in the command above with the desired docker tag. You can find the latest tags of fmriprep

fmriprep
Oscar documentation
Neurostars forum
Oscar documentation
here