smriprep icon indicating copy to clipboard operation
smriprep copied to clipboard

Inconsistent freesurfer outputs

Open araikes opened this issue 5 years ago • 2 comments

Hi all, I'm hoping you can help me clear something up. A colleague in my lab wanted to run Freesurfer on some data for an analysis. I have been advocating for an in-lab workflow that includes BIDS-Apps/Freesurfer and fMRIPrep. She was interested in understanding how Freesurfer runs, so she ran it via command line.

As an internal cross-validation test, I ran one of the same subjects using the BIDS-Apps docker as well as fMRIPrep. We came up with three different sets of values, so I ran all of the methods again. I'm writing this at home right now so I can't put together any surface images, but I'm attaching the lh.aparc.a2009s.stats files as examples.

Long story short, command line Freesurfer gave the same outputs twice. BIDS-Apps/Freesurfer gave the same results twice (but different from command line FS). fMRIPrep gave different stats for each run and different from the other two methods.

Any thoughts? Thanks in advance.

Commands run (each was run twice and I altered the output path to differentiate, e.g., bids-freesurfer, bids-freesurfer-02):

Command line FS (freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.0-2beb96c):

>recon-all -i $BIDSDIR/nifti/sub-UAHC101/anat/sub-UAHC101_run-001.nii.gz -s sub-HC101 -sd $BIDSDIR/derivatives/freesurfer-commandline -all

BIDS-Apps FS:

docker run -i --rm -v $BIDSDIR/nifti:/bids_dataset:ro -v $BIDSDIR/derivatives:outputs -v $BIDSDIR/code/license.txt:/license.txt bids/freesurfer:latest /bids_dataset /outputs/bids-freesurfer \
--participant_label "UAHC101" --refine_pial T1only --3T true --skip_bids_validator --license_file "/license.txt"

fMRIPrep (also ran the resting state scan, since I was already running it):

docker run -i --rm \
        -v $BIDSDIR/nifti:/nifti:ro \
        -v $BIDSDIR/derivatives:/outputs  \
        -v $BIDSDIR/code/license.txt:/opt/freesurfer/license.txt \
        poldracklab/fmriprep:1.4.1 \
        /nifti /outputs/fmriprep \
        participant \
        --participant-label "UAHC101" \
        --skip_bids_validation \
        --omp-nthreads 1 \
        --nthreads 12 \
        --mem_mb 30000 \
        --task-id "rest" \
        --output-spaces T1w fsaverage MNI152NLin2009cAsym \
        --ignore fieldmaps \
        --use-syn-sdc \
        --dummy-scans 5 \
        --notrack"

freesurfer-outputs.zip

araikes avatar Jul 21 '19 23:07 araikes

As @satra likes to point out every time fMRIPrep comes up, the FreeSurfer of fMRIPrep is not FreeSurfer.

fMRIPrep inserts the skull-stripped brain into freesurfer and for that reason, I have to agree with Satra, we modified the default behavior of FreeSurfer enough to always call attention to this.

Regarding the test-retest reliability, minimal differences are also expected. The reason is that brain extraction uses ANTs which introduces minimal differences with every run, when using multithreading. One could fix this either running it on one single cpu (and expect 2-8x times the wait) or specially compiled without certain optimizations (and expect an increase in runtime as well). How large are the differences?

Regarding the BIDS apps I don't know the source for inconsistencies, could it be the version?

oesteban avatar Jul 22 '19 05:07 oesteban

Hi @oesteban You're obviously right about @satra 's point. And I know that. I was just surprised by the fact of inconsistency across all three options.

However, I figured out what did it. The command line run did not have the -3T flag. Running it with that yielded the same outcomes as the BIDS-Apps version.

Regarding the run-to-run differences for fMRIPrep, I will let you know. I'll run it a couple of times on the larger dataset and see what shakes out.

Last question, for the moment. In a cross-sectional dataset, if I run Freesurfer first via the BIDS_App version and then run fMRIPrep to reuse those outputs, will it render the outputs "less usable" (used loosely) because it transforms them into fMRIPrep-surfer outputs, as in the italicized comment above?

araikes avatar Jul 23 '19 05:07 araikes