CHARGE_spatialWMH
Spatial WMH patterns
Description
This repository provides the code to perform analysis of spatial WMH distribution using the Bullseye segmentation.
Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
Installation
Use this python code and execute in an environment including FreeSurfer version 6.0.0p1 or above, nipype== OR use singularity container with pre-installed environment:
Usage
Own environments:
- have FreeSurfer version 7.3.1 (or at least>=6.0.0p1)
- activate python==3.9 environment with nipype==1.8.6, nibabel==? (
beseg
)- e.g. installation via conda:
conda create -n below python nipype nibabel
pip install pandas
- e.g. installation via conda:
- provide table of subjects to run and/or select them in ll. 83 ff in
run_bullseye_WMH_segmentation.py
- run
python run_bullseye_WMH_segmentation.py
Singularity container with all environments pre-installed
- type
Support
Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
License
For open source projects, say how it is licensed.
General information
The pipeline includes the following steps:
- the bullseye WM parcellation (
bullseye_pipeline.py
entirely taken from this github repositoy) It provides an (anatomy-independent) spatial localization based on an radial component (ie, lobes) and a depth component. It can be used to obtain region-specific quantification of white matter parameters (eg, a similar approach has been used to quantify regional white matter hyperintensity load in this and this papers).
The internals of the process are explained in this blog post.
- the bullseye parcellation is the intersection of a lobar parcellation and a depth parcellation
- the lobar parcellation consists of 4 lobes per hemisphere (frontal, parietal, temporal and occipital) + 1 consisting of the basal ganglia and thalamus as an additional region: (4*2) + 1 = 9 lobes
- the depth parcellation consists of 4 equidistant parcels spanning from the surface of the ventricles to the internal surface of the cortex
Required FreeSurfer input
However, not all the FreeSurfer output is required. The following is the mandatory portion of FreeSurfer data that is required by the pipeline:
-
scansdir
-
subject-id1
-
mri
aseg.mgz
-
label
lh.aparc.annot
rh.aparc.annot
-
surf
lh.white
rh.white
lh.pial
rh.pial
-
-
subject-id2
...
-
-
the coregistration of WMH probability map to FreeSurfer space (
create_flairreg_pipeline.py
) old version: baseline only WMH probability maps are binarized at 0.1, coregistered to FreeSurfer space and binarized again at 0.1 for counting number of voxels in each parcel. Binary maps from longitudinal pipeline are also thresholded at 0.1 before extrating. latest version (11/23): WMH probability maps are coregistered to FreeSurfer space and summed up in the respective parcels. -
the extraction of bullseye parcellated WML volumes (in
utils.py
) The bullseye parcellation is masked by the lesion map, a histogram is created and unassigned lesion volume + 36 WM parcellation volumes are extracted and saved in text file. Order:- undefined
- 51, 52, 53, 54 : BG + depth
- 111, 112, 113, 114: lh frontal + depth
- 121, 122, 123, 124: lh occipital + depth
- 131, 132, 133, 134: lh temporal + depth
- 141, 142, 143, 144: lh parietal + depth
- 211, 212, 213, 214: rh frontal + depth
- 221, 222, 223, 224: rh occipital + depth
- 231, 232, 233, 234: rh temporal + depth
- 241, 242, 243, 244: rh parietal + depth
Output directory structure
After execution of the pipeline a directory output_dir
is created with the following structure:
-
output_dir
-
subject-id1
bullseye_wmparc.nii.gz
ples_lpa_mFLAIR_bl_thr0.1_bin_warped.nii.gz
ples_lpa_mFLAIR_bl_warped.nii.gz
res.txt
-
subject-id2
...
-
containing, respectively, the final bullseye parcellation, the WMH map (thresholded and binarized lesion map) and the results file (res.txt refers to thresholded WMH maps, res_HSB.txt to the sum of probabilities)