New to fMRIprep

Hello everyone,
i’m new to fMRIprep and need help learning it. Any suggestions on where I can find resources and tutorials for it?

Thanks

Hi @Allen_Roy and welcome to Neurostars!

If you already have your data in BIDS format, you can run it via Docker or Singularity via instructions here: Usage Notes — fmriprep version documentation

Some things would help us help you better:

  1. Do you already have experience with computing containers such as Docker or Singularity?
  2. Do you have a dataset in mind, and is it in BIDS format (or do you not know what that means yet)?

Best,
Steven

Hey Steven,
Thank you for your response. I have installed docker and the sample data that I’m using to learn is in BIDS format. However, when I try to run it, it throws an error. I don’t understand whats wrong with it.

Hi @Allen_Roy,

Your file script.sh can’t be in the BIDS root directory, it should live in a folder called code in the root directory.

Best,
Steven

Hi @Steven,
Thanks a lot, the script issue was solved. However, it looks like the sample dataset that im trying to work with has some issues. Can you direct me to some datasets that’s a bit easier to play around for beginners?

Thanks

You can look at OpenNeuro for BIDS-valid datasets.

Im using this dataset, however, when im trying to run, its throwing this error.

Hi, are you passing in the root directory of the BIDS dataset? Such that inside it, you see the sub-xx folders?

It would help to see your command for fMRIPrep.

Hey Steven,

I think i was doing a lot of things wrong. I want to start over and crosscheck if I did everything correctly. Is there a manual or tutorial where i can get step by step guidance right from the installation?

Thanks

You can try looking at steps here: fmriprep - Behavioral Neuroimaging Core User Manual and here: fMRIPrep Demonstration — Andy's Brain Book 1.0 documentation but some of the information may be outdated or specific to certain use cases. The fmriprep website I linked earlier also has lots of helpful information.
Without you explaining what you have tried and all the errors you are getting, it is difficult to assist with your specific problems.

Best,
Steven


The script and the error. I don’t know whats wrong. Could it be because I’m running it on WSL?

Are you sure that’s your full command, it ends after the --fs-license-file argument before the working directory is mentioned. It is easier if you copy and paste the code here, using the </> button to format the text as code.

That being said, it appears that your variable named $nprocs has not been defined.


subject=$1
nprocs=$4
mem=4 # 400

#Convert virtual memory from gb to mb
mem=`echo "${mem//[!0-9]/}"`
mem_mb=`echo $(((mem*1000)-5000))`

docker run -ti --rm \
  -v $rdd:/data:ro \
  -v $odd:/out \
  -v $wkd:/work \
  -v $licd:/licensedir \
  nipreps/fmriprep:latest \
  --participant-label "$subject" \
  --output-spaces T1w func \
  --nprocs "$nprocs" --mem "$mem_mb" \
  --stop-on-first-crash \
  --fs-license-file /licensedir/license.txt \
  -w $HOME

this is the entire code

Hi @Allen_Roy,

It looks like subject and nrpocs are positional arguments in your overall script, so how are you submitting this script? Maybe you can add a echo $nprocs before the fmriprep command to make sure the value you expect is being passed in correctly.

Also,

This makes your mem_mb -1000! So you probably want to change that too.

Best,
Steven

Hey,

Can you help me rewrite this script? Like how would you write it?

It’s written fine, just change mem to 40. Again, how are you submitting this script?

Im trying to run it like other bash scripts. Is that not how you do it?

The reason I ask is that subject and nprocs are the first and fourth positional argument in your script, respectively (as indicated by the $1 and $4). So I want to make sure that your input arguments are ordered properly when you submit the script, as your error was due to to nprocs being undefined.

I would also use your predefined work directory ($wkd or /work as you rename it in the container) instead of $HOME as your work directory (-w argument).

Are these variables ($rdd, $odd, $wkd, $licd) defined somewhere?

Best,
Steven

Hey @Steven,

Thanks for the suggestion, i’ve changed the script. The nprocs error is gone, however, when i try to run the script it throws this error “fmriprep: error: Path does not exist: </home//fmriprepdemo>.” I cant figure whats wrong with it.

#!/usr/bin/env bash

subject=1
nprocs=4
mem=6 # 400
rdd=$HOME/fmriprepdemo_lang-prod
odd=$HOME/fmriprepdemo_lang-prod/sub-01/output
wkd=$HOME/wkdir
licd=$HOME/FREESURFER
docker run -ti --rm \
  --memory="$mem""g" \
  -v $wkd:/work \
  -v $licd:/licensedir \
  nipreps/fmriprep:latest $rdd $odd \
participant \
  --participant-label $subject \
  --output-spaces T1w func \
  --nprocs $nprocs \
  --fs-no-reconall \
  --mem $mem \
  --low-mem \
  --stop-on-first-crash \
  --fs-license-file /licensedir/license.txt \
  -w $HOME

Is it possible to use fmriprep-docker in your environment? It was designed to avoid tedious wrangling of docker command lines.