Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit 47e42c6

Browse files
authored
Merge pull request #8 from flywheel-apps/GEAR-1479_Hypothalamic
Gear 1479 hypothalamic ENH - add hypothalamic subunits processing ENH - add option for postprocessing only.
2 parents 9bbc0b8 + 45d9fbd commit 47e42c6

File tree

7 files changed

+243
-101
lines changed

7 files changed

+243
-101
lines changed

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM freesurfer/freesurfer:7.1.1 as base
1+
FROM freesurfer/freesurfer:7.2.0 as base
22

33
LABEL maintainer="[email protected]"
44

@@ -69,4 +69,6 @@ COPY run.py ${FLYWHEEL}/run.py
6969

7070
# Configure entrypoint
7171
RUN chmod a+x ${FLYWHEEL}/run.py
72+
73+
7274
ENTRYPOINT ["/flywheel/v0/run.py"]

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
# freesurfer-recon-all
2-
Gear that runs FreeSurfer [v7.1.1 Release (July 27, 2020)](https://surfer.nmr.mgh.harvard.edu/fswiki/ReleaseNotes) based on the official FS docker container.
2+
Gear that runs FreeSurfer [v7.2.0 Release (July 19, 2021)](https://surfer.nmr.mgh.harvard.edu/fswiki/ReleaseNotes) based on the official FS docker container.
33

44
To run this gear you need to select structural MRI file(s) as inputs and set configuration parameters. Minimally, the "anatomical" input file and a Freesurfer license need to be provided.
55

6-
Note: the current version of Freesurfer has known issues with using the `-parallel` flag that caused recon-all to fail stochastically. These have been patched in this gear. In case there are more, recon-all will be retried if it fails the first time.
6+
Note: Known issues: it was recently discovered there may be some inaccuracies in the talairach registration (subject/mri/talairach.xfm) when a volume has been defaced and the face voxels are replaced with 0s. We have found some problems in the 1000 Functional Connectomes anatomical data where the defacing is very aggressive. No problems were found in the UK BioBank data. Mostly, this is not relevant, but it can affect the estimated intracranial volume (eTIV) which can then affect group results
7+
when volume or surface area are being corrected by eTIV. This was discovered by comparing the eTIV from version 5.3 with that of versions 6.0 and 7.X.
78

89
# Inputs
910

1011
![Inputs](README_img/inputs.png)
1112

1213
### anatomical (required)
1314

14-
Anatomical NIfTI file, DICOM archive, or previous freesurfer-recon-all zip archive.
15+
Anatomical NIfTI file, DICOM archive, or previous freesurfer-recon-all zip archive (required for gear-postprocessing-only option).
1516

1617
### Expert Options File (optional)
1718
A user-created file containing special options to include in the command string. The file should contain as the first item the name of the command, and the items following it on rest of the line will be passed as the extra options. See [Freesurfer documentation](https://surfer.nmr.mgh.harvard.edu/fswiki/recon-all#ExpertOptionsFile) for more information and examples.
@@ -56,6 +57,10 @@ Text from license file generated during FreeSurfer registration.
5657
Copy the contents of the license file and paste it into this argument.
5758
There are [three ways](https://docs.flywheel.io/hc/en-us/articles/360013235453-How-to-include-a-Freesurfer-license-file-in-order-to-run-the-fMRIPrep-gear-) to provide the license to this gear.
5859

60+
### gear-hypothalamic_subunits (optional)
61+
62+
After running recon-all run Segmentation of hypothalamic subunits (mri_segment_hypothalamic_subunits) on the subject. See: [https://surfer.nmr.mgh.harvard.edu/fswiki/HypothalamicSubunits](https://surfer.nmr.mgh.harvard.edu/fswiki/HypothalamicSubunits) For more information.
63+
5964
### gear-hippocampal_subfields (optional)
6065

6166
Generates an automated segmentation of the hippocampal subfields based on a statistical atlas built primarily upon ultra-high resolution (~0.1 mm isotropic) ex vivo MRI data. See: [https://surfer.nmr.mgh.harvard.edu/fswiki/HippocampalSubfieldsAndNucleiOfAmygdala](https://surfer.nmr.mgh.harvard.edu/fswiki/HippocampalSubfieldsAndNucleiOfAmygdala) for more info. Choosing this option will write `<subject_id>_HippocampalSubfields.csv` to the final results. The values in this spreadsheet will also be attached to the analysis as "Custom Information" ("info" metadata) so they can be found using search and in views. (Default=true)
@@ -90,11 +95,13 @@ After running recon-all, run gtmseg on the subject. This creates a high-resoluti
9095

9196
Desired subject ID. This is used to name the resulting FreeSurfer output directory. The subject_id can only have file-name-safe characters (no spaces, special characters, etc.) because this will be used as the name of a directory for the subject. NOTE: If using a previous Gear output as input the subject code will be parsed from the input archive.
9297

98+
### gear-postprocessing-only (optional)
99+
Allows post-processing steps (such as gear-hypothalamic_subunits, gear-brainstem_structures, etc) to be run WITHOUT rerunning recon-all. For this option to work, a completed recon-all output zip file must be passed as input to this gear.
100+
93101
# Workflow
94102
This gear runs recon-all on the provided inputs with the given configuration options. See [https://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurferWiki](https://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurferWiki) in general and [https://surfer.nmr.mgh.harvard.edu/fswiki/ReconAllDevTable](https://surfer.nmr.mgh.harvard.edu/fswiki/ReconAllDevTable) in particular for complete details.
95103

96104
# Outputs
97105
All files that are the results of recon-all in the Freesurfer subject directory are compressed into a single zip archive. See the tutorial "Introduction to Freesurfer Output" tutorial [here](https://surfer.nmr.mgh.harvard.edu/fswiki/Tutorials) for details.
98106

99-
100107
This gear was created using the [bdis-app-template](https://github.com/flywheel-apps/bids-app-template). For documentation on how to run the tests in this gear, please see that README file.

manifest.json

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "freesurfer-recon-all",
3-
"label": "FreeSurfer 7.1.1: run recon-all",
3+
"label": "FreeSurfer 7.2.0: run recon-all",
44
"description": "FreeSurfer version 7.1.1 Release (July 27, 2020). This gear takes an anatomical NIfTI file and performs all of the FreeSurfer cortical reconstruction process. Outputs are provided in a zip file and include the entire output directory tree from Recon-All. Configuration options exist for setting the subject ID and for converting outputs to NIfTI, OBJ, and CSV. FreeSurfer is a software package for the analysis and visualization of structural and functional neuroimaging data from cross-sectional or longitudinal studies. It is developed by the Laboratory for Computational Neuroimaging at the Athinoula A. Martinos Center for Biomedical Imaging. Please see https://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurferSoftwareLicense for license information.",
5-
"version": "1.1.0_7.1.1",
5+
"version": "1.1.1_7.2.0",
66
"custom": {
7-
"docker-image": "flywheel/freesurfer-recon-all:1.1.0_7.1.1",
7+
"docker-image": "flywheel/freesurfer-recon-all:1.1.1_7.2.0",
88
"gear-builder": {
99
"category": "analysis",
10-
"image": "flywheel/freesurfer-recon-all:1.1.0_7.1.1"
10+
"image": "flywheel/freesurfer-recon-all:1.1.1_7.2.0"
1111
},
1212
"flywheel": {
1313
"suite": "FreeSurfer"
@@ -117,6 +117,11 @@
117117
"type": "boolean",
118118
"default": false,
119119
"description": "After running recon-all run gtmseg on the subject. (Default=False)."
120+
},
121+
"gear-hypothalamic_subunits": {
122+
"type": "boolean",
123+
"default": false,
124+
"description": "After running recon-all run Segmentation of hypothalamic subunits (mri_segment_hypothalamic_subunits) on the subject. (Default=False)."
120125
},
121126
"gear-hippocampal_subfields": {
122127
"description": "Generates an automated segmentation of the hippocampal subfields based on a statistical atlas built primarily upon ultra-high resolution (~0.1 mm isotropic) ex vivo MRI data. Choosing this option will write <subject_id>_HippocampalSubfields.csv to the final results. See: https://surfer.nmr.mgh.harvard.edu/fswiki/HippocampalSubfields for more info. (Default=true)",
@@ -171,6 +176,11 @@
171176
"description": "Text from license file generated during FreeSurfer registration. *Entries should be space separated*",
172177
"type": "string",
173178
"optional": true
179+
},
180+
"gear-postprocessing-only": {
181+
"default": false,
182+
"description": "If a previous recon-all .zip file is given as input, do not re-run recon-all, instead only run the additional post-processing commands",
183+
"type": "boolean"
174184
}
175185
},
176186
"environment": {

0 commit comments

Comments
 (0)