Functional not in MNI space

I’m having issues normalizing a functional image to mni space for a subset of my participants. 4 out of 64 participants, all with the same scanning parameters, do not output files in mni space.

Their t1w images are fine. They get preprocessed and normalized and the warp field file gets created, but the final (preproc, mni sapce) functional image is where the problem occurs. The bold_space-mni_preproc file gets created but isn’t actually in mni space. What’s even odder is that the space-T1w_preproc image never actually gets created, which I believe is required for ANTs to normalize to mni space and output the final preproc image.

I found an old post indicating that old data in a working directory could be to blame, but I’ve re-run the participants using a new directory with the same outcome. I also included a verbose flag for one of the participants, but I don’t see any errors or anything to be concerned about really.

Ideally, I’d like to process everything in fmriprep, but I’m willing to preprocess up to registration/normalization, manually perform those tasks using ANTs, then perform ica-aroma. The only issue is that the preprocessed functional never gets written to the directory.

The jobs complete without throwing errors and the report doesn’t list anything either. I’m using fmriprep v1.1.4 with singularity on a cluster. The verbose logs don’t indicate that we’re exceeding the memory limit or anything, but could that be to blame? Is there a flag that I can include to halt fmriprep at the coregistration step so that I can manually perform the other steps?

1 Like

Please have a look at this BIDS -> fmriprep transforms to (3.5 x 3.75 x 3.75) MNI space? post and see if it explains what is going on.

Could you share the command line you used when running fmriprep? T1w needs to be listed in --output-space commmand line flag for outputs in T1w space files to be created.

Thanks for responding, sorry for the delay.

I’m looking into your first suggestion and will get back to you.

I included T1w in the output space. I’m using a script that feeds in a few variables, but this is the important bit:

srun singularity run $image $bidsdir $outdir participant -w $workdir --participant_label $subject --task-id rest --nthreads 14 --omp-nthreads 14 --mem-mb 64000 --output-space {T1w,template,fsnative} --low-mem --use-aroma --fs-license-file $outdir/license.txt --no-submm-recon --write-graph --fs-no-reconal -vv

I’m surprised this did not throw and error. --output-space should be a space delimited list. For example --output-space T1w template fsnative

Hi Chris,
we tried exactly that, but it returned an error.

fmriprep-docker --mem-mb=32000 --output-space T1w template --fs-license-file=$outdir/license.txt -w $workdir $bidsdir $outdir participant

the error states: ‘fmriprep: error: argument --output-space: invalid choice: ‘/$bidsdir/’ (choose from ‘T1w’, ‘template’, ‘fsnative’, ‘fsaverage’, ‘fsaverage6’, ‘fsaverage5’)’

Wrong order - try

fmriprep-docker $bidsdir $outdir participant --mem-mb=32000 --output-space T1w template --fs-license-file=$outdir/license.txt -w $workdir

Seems to work, thanks!

1 Like

Hi,

I reprocessed the four participants that had issues and they all look more or less the same. The image in T1w space is again not being outputted.

I don’t think the issue with MNI space you reference above applies to this situation, but if you have a method of verifying, I’ll run it and see.

In the meantime, I’m still having the same issues as before: no image in T1w space and the MNI image is offset.

Could you share the HTML reports (with figures which should be in a separate subfolder)?

Could you also describe in detail (including software used) how you asses MNI image offset and provide some screenshots?

PS is @bryjack0890 and @Josephine the same person?

Hi,

Here’s the report: link

My method for checking the space is opening the _space-MNI152… using fsleyes and overlaying the 2mm MNI standard. I’ve attached screenshots of those views.

No we’re not the same person :slight_smile:

As evident from the “EPI to T1 registration” part of the report the coregistration heuristic did not do well:

Could you try rerunning FMRIPREP with --force-bbr option?

Hi Chris,
The output from this command showed some problems with BOLD registration, both bold2t1w and bold2mni, variable across subjects (worked for some, didn’t work for most).
See below a screenshot (I’m not allowed to upload more than one apparently)

Seems that there is something wrong with the tissue segmentation of the T1w. Could you share the full report?

Does this work?
https://drive.google.com/file/d/1XoGuNoY3rl7t1U54NO_Bp6AhlMgWwfYi/view?usp=sharing

Thanks for sharing. It seems that your input BOLD image is upside down for some reason. Some things to try:

  • See if this has been fixed in the latest release of FMRIPREP (1.2.3)
  • Find the source data and convert the input images from dicoms using dcm2niix (if you have not done this before)

Hi Chris,

Thanks for the advise. Upgrading FMRIPrep did not fix the problem, but re-converting the PAR/RECs to nifti using dicm2nii seemed to do the trick, so I’ll go ahead with that.
Something interesting, when I use:
fmriprep-docker $bidsdir $outdir participant --mem-mb=32000 --output-space T1w template --fs-license-file=$outdir/license.txt -w $workdir
three new (but empty) folders called --output space T1w template, T1w, and template are created in my home directory…

Cheers,
Josephine

Hi @Josephine, can you show the line starting with RUNNING: docker that is printed before fMRIPrep starts when you run that command? I was unable to reproduce the issue on fmriprep-docker version 1.2.4 with valid bidsdir, outdir and workdir variables, but it’s possible that missing variables (or spaces in these variables) could produce an argument parsing issue that presents in the way you describe.

Hi @effigies,
I have upgraded fmriprep since, but the line you are asking for states:

RUNNING: docker run --rm -it -v /usr/local/freesurfer6/license.txt:/opt/freesurfer/license.txt:ro -v /$datadir:/data:ro -v /$outputdir:/out -v /$workflowdir:/scratch poldracklab/fmriprep:1.1.6 /data /out participant --mem-mb=32000 --output-space T1w template -w /scratch

Cheers,
Josephine

Hi @Josephine. That command line looks fine to me (I’m assuming $datadir, $outputdir and $workflowdir are your own substitutions for the purposes of not sharing your directory structure with the Internet). As long as none of those variables has a space in it, I’m not sure how you could be getting the empty folders you describe. Are you still seeing that behavior?