nipreps / smriprep

Structural MRI PREProcessing (sMRIPrep) workflows for NIPreps (NeuroImaging PREProcessing tools)
https://nipreps.github.io/smriprep
Apache License 2.0
134 stars 39 forks source link

Any smriprep fix for Freesurfer 7.3.2 FLAIR Pial Surface placement bug? #414

Open nordicpioneer opened 9 months ago

nordicpioneer commented 9 months ago

Hi! I was made aware of the FLAIR Pial Surface placement bug reported by the freesurfer devs. This bug was not pathed until version 7.4.0, while smriprep is still using version 7.3.2.

Are there any plans to fix this bug/update to version 7.4.0 in the near future? We are currently considering using fMRIPrep/smriprep with FLAIR for surface refinement in our preprocessing plan, but need this issue answered before we proceed.

According to the release notes an alternative to upgrading to version 7.4.0 is to supply expert options via a global-expert-option.txt file:

Pial surface placement with FLAIR images has a bug which has existed since the start of version 7. This bug causes the pial surface to not extend nearly far enough. This has been fixed in the development version and so will be present in the next version. You can fix it in previous v7 releases by creating (or adding to) $SUBJECTS_DIR/global-expert-options.txt with this line "PlaceMMPialSurf --mm_min_inside 50 --mm_max_inside 200 --mm_min_outside 10 --mm_max_outside 50

Is this somehow possible by suppling extra flags with smriprep/fmriprep?

effigies commented 9 months ago

If there's an easy patch to make sure 7.3.2 behaves better, that would be good.

I'm currently a bit hesitant to upgrade to 7.4 in our Docker images, as it increases the size of Docker images by several hundred megabytes and I haven't had time to go through it and see what we can safely exclude from the installation.

Is this somehow possible by suppling extra flags with smriprep/fmriprep?

This is possible by just pre-populating the subjects directory with a global-expert-option.txt file. The directory can be provided with the --fs-subjects-dir, or else it will be generated in the output directory. fMRIPrep will create it in $OUTPUT/sourcedata/freesurfer, while I believe sMRIPrep still creates it in $OUTPUT/freesurfer.

effigies commented 9 months ago

Here's where we validate/create a FreeSurfer subjects directory:

https://github.com/nipreps/niworkflows/blob/b1e9c5d771cf813d2c652724cead8303d34e657b/niworkflows/interfaces/bids.py#L895-L980

If we check the FreeSurfer version and it's at least 7 but less than 7.4, then we could add this file ourselves.

nordicpioneer commented 9 months ago

Thanks! We will try this.

This is possible by just pre-populating the subjects directory with a global-expert-option.txt file. The directory can be provided with the --fs-subjects-dir, or else it will be generated in the output directory. fMRIPrep will create it in $OUTPUT/sourcedata/freesurfer, while I believe sMRIPrep still creates it in $OUTPUT/freesurfer.