You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add the longitudinal outputs compatibility script for FreeSurfer longitudinal Hippocampal subfields (#722)
* Add the longitudinal compatibility and conversion script for other longitudinal tools such as FreeSurfers longitudinal hippocampal subfields (segmentHA).
* Add documentation for long_compat_segmentHA.py in doc/scripts/long_compat_segmentHA and doc/overview/LONG.
* Cleaning, formatting, do and ruff fixes and errors
---------
Co-authored-by: Martin Reuter <[email protected]>
Copy file name to clipboardExpand all lines: doc/overview/LONG.md
+22-8Lines changed: 22 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ FastSurfer has a dedicated pipeline to quantify longitudinal changes in T1-weigh
4
4
5
5
## What is Longitudinal Processing
6
6
7
-
In longitudinal studies, MRIs of the same participant are acquired at different time points. Usually, the goal is to quantify potentially subtle anatomical changes representing early disease effects or effects of disease-modifying therapies or drug studies. In these situations, we know that most of the anatomy will be very similar, as compared to cross-sectional differences between participants. Longitudinal processing, as opposed to independent processing of each MRI, tries to make use of the joint information to reduce variance across time, leading to more sensitive estimates of longitudinal changes. This methodological approach leads to increased statistical power to detect subtle changes and, therefore, permits either finding smaller effects or reducing the number of participants needed to detect such an effect - saving time and money. Our paper for the FreeSurfer longitudinal stream (Reuter et al. [2012](https://doi.org/10.1016/j.neuroimage.2012.02.084)) nicely highlights these advantages, such as increased reliability and sensitivity, and describes the general idea.
7
+
In longitudinal studies, MRIs of the same participant are acquired at different time points. Usually, the goal is to quantify potentially subtle anatomical changes representing early disease effects or effects of disease-modifying therapies or drug studies. In these situations, we know that most of the anatomy will be very similar, as compared to cross-sectional differences between participants. Longitudinal processing, as opposed to independent processing of each MRI, tries to make use of the joint information to reduce variance across time, leading to more sensitive estimates of longitudinal changes. This methodological approach leads to increased statistical power to detect subtle changes and, therefore, permits either finding smaller effects or reducing the number of participants needed to detect such an effect - saving time and money. Our paper for the FreeSurfer longitudinal stream (Reuter et al. [2012](https://doi.org/10.1016/j.neuroimage.2012.02.084)) nicely highlights these advantages, such as increased reliability and sensitivity, and describes the general idea.
8
8
9
9
Generally, the idea is to:
10
10
- Align images across time robustly into an unbiased mid-space (Reuter et al. [2010](https://doi.org/10.1016/j.neuroimage.2010.07.020)).
@@ -46,7 +46,7 @@ The above command will, of course, be slightly different when using your preferr
46
46
47
47
```bash
48
48
singularity exec --nv \
49
-
--no-home \
49
+
--no-mount cwd,home \
50
50
-B /home/user/my_mri_data:/data \
51
51
-B /home/user/my_fastsurfer_analysis:/output \
52
52
-B /home/user/my_fs_license_dir:/fs_license \
@@ -90,25 +90,39 @@ HOWEVER, this requires that you process these cases also through the longitudina
90
90
## Behind the Scenes
91
91
92
92
`long_fastsurfer.sh` is just a helper script and will perform the following individual steps for you:
93
-
1.[Template Init] It will prepare the subject template by calling `long_prepare_template.sh`:
93
+
1.**Template Init**: It will prepare the subject template by calling `long_prepare_template.sh`:
94
94
```bash
95
95
long_prepare_template.sh \
96
96
--tid <templateID> \
97
97
--t1s <T1_1><T1_2> ... \
98
98
--tpids <tID1><tID2>
99
99
```
100
100
This will register (align) all time point images into the unbiased mid-space using `mri_robust_template`, after an initial segmentation and skull stripping. It will also create the template image, kind of a mean image across time. For single time point cases, it will align the input into a standard upright position.
101
-
2.[Template Seg] Next, the template image will be segmented via a call to `run_fastsurfer.sh --sid <templateID> --base --seg_only ...` where the `--base` flag indicates that the input image will be taken from the already existing template directory.
102
-
3.[Template Surf] This is followed by the surface processing of the template `run_fastsurfer.sh --sid <templateID> --base --surf_only ...`, which can be combined with the previous step.
103
-
4.[Long Seg] Next, the segmentation of each time point, which can theoretically run in parallel with the previous two steps, is performed `run_fastsurfer.sh --sid <tIDn> --long <templateID> --seg_only ...`,
104
-
5.[Long Surf] Again followed by the surface processing for each time point: `run_fastsurfer.sh --sid <tIDn> --long <templateID> --surf_only`. This step needs to wait until 3. and 4. (for this time point) are finished. In this step, for example, surfaces are initialized with the ones obtained on the template above and only fine-tuned, instead of being recreated from scratch.
101
+
2.**Template Seg**: Next, the template image will be segmented via a call to `run_fastsurfer.sh --sid <templateID> --base --seg_only ...` where the `--base` flag indicates that the input image will be taken from the already existing template directory.
102
+
3.**Template Surf**: This is followed by the surface processing of the template `run_fastsurfer.sh --sid <templateID> --base --surf_only ...`, which can be combined with the previous step.
103
+
4.**Long Seg**: Next, the segmentation of each time point, which can theoretically run in parallel with the previous two steps, is performed `run_fastsurfer.sh --sid <tIDn> --long <templateID> --seg_only ...`,
104
+
5.**Long Surf**: Again followed by the surface processing for each time point: `run_fastsurfer.sh --sid <tIDn> --long <templateID> --surf_only`. This step needs to wait until 3. and 4. (for this time point) are finished. In this step, for example, surfaces are initialized with the ones obtained on the template above and only fine-tuned, instead of being recreated from scratch.
105
105
106
106
Internally, we use `brun_fastsurfer.sh` as a helper script to process multiple time points in parallel (in the LONG steps 4. and 5.). Here, `--parallel_seg` can be passed to `long_fastsurfer.sh` to specify the number of parallel runs during the segmentation step (4), which is usually limited by GPU memory, if run on the GPU. Further, `--parallel_surf` specifies the number of parallel surface runs on the CPU and is most impactful. It can be combined with `--threads_surf 2` (or higher) to switch on parallelization of the two hemispheres in each surface block.
107
107
108
-
## Final Statistics:
108
+
## Final Statistics
109
109
110
110
The final results will be located in `$SUBJECTS_DIR/tID1` ... for each time point. These directories will have the same structure as a regular FastSurfer/FreeSurfer output directory. Therefore, you can use the regular downstream analysis tools, e.g. to extract statistics from the stats files. Note that the surfaces are already in vertex correspondence across time for each participant. For group analysis, one would still need to map thickness estimates to the fsaverage spherical template (this is usually done with `mris_preproc`). For longitudinal statistics using the (recommended) linear mixed effects models, see our R toolbox [FS LME R](https://github.com/Deep-MI/fslmer), which can also analyze the mass-univariate situation, e.g. for cortical thickness maps. Alternatively, you can use this Matlab package: [LME Matlab](https://github.com/NeuroStats/lme) and our Matlab tools for time-to-event (survival) analysis: [Survival](https://github.com/NeuroStats/Survival).
111
111
112
+
Note, that followup tools, e.g. Longitudinal Hippocampus and Amydala pipeline, require additional files. These files can be generated by running the [FastSurfer longitudinal outputs script `recon_surf/long_compat_segmentHA.py`](../scripts/long_compat_segmentHA.rst) on top of the longitudinal processing directory.
`long_compat_segmentHA.py` is a compatibility script. It creates files that are not created by the FastSurfer longitudinal pipeline, but needed by other longitudinal tools such as FreeSurfer's longitudinal Hippocampus and Amygdala processing.
5
+
6
+
7
+
Full commandline interface of recon_surf/long_compat_segmentHA.py
0 commit comments