Skip to content

anatomical_segmentation

Subworkflow performing anatomical segmentation to produce WM, GM and CSF maps/masks. It handles two type of input channels, either an anatomical image (most likely T1) and/or freesurfer parcellations files. Depending on which channel is provided, the subworkflow will perform either of the following:
1) Channel with an anatomical image with run_synthseg parameter will result in using Freesurfer synthseg producing WM, GM
and CSF masks/maps.
2) Channel with an anatomical image will result in using FSL’s fast segmentation producing WM, GM,
and CSF masks/maps.
3) Channel with FreeSurfer’s parcellations files will result in using Scilpy’s tools to produce
WM, GM, and CSF masks. Probability maps will be produced by FSLFast. Typical next steps after this subworkflow would be to combine the resulting masks/maps with fODF data to perform TRACKING.

Keywords : Anatomical, Segmentation, Maps, Masks

Components : segmentation/fastseg, segmentation/freesurferseg, segmentation/synthseg, utils_options


TypeDescriptionMandatoryPattern
ch_imagefileThe input channel containing the anatomical images (typically T1s). If provided, the subworkflow will perform segmentation using FSL’s fast.

Structure : tuple val(meta), path(image)
  • meta [map] Metadata map.
  • image [file] Anatomical image file.
True*.\{nii,nii.gz\}
ch_freesurfersegfileThe input channel containing freesurfer parcellations files (aparc+aseg and wm_parc parcellations). If provided, the subworkflow will use Scilpy’s tools to convert the parcellations into masks.

Structure : tuple val(meta), path(aparc_aseg), path(wm_parc)
  • meta [map] Metadata map.
  • aparc_aseg [file] FreeSurfer aparc+aseg parcellation file.
  • wm_parc [file] FreeSurfer white matter parcellation file.
False*.mgz
ch_lesionfileThe input channel containing a lesion mask file to correct the white matter mask. The lesion mask must be a binary mask.

Structure : tuple val(meta), path(lesion)
  • meta [map] Metadata map.
  • lesion [file] Lesion mask file.
False*\{nii.nii.gz\}
ch_fs_licensefileThe input channel containing the FreeSurfer license.To get one, go to https://surfer.nmr.mgh.harvard.edu/registration.html. Optional. If you have already set your license as prescribed by Freesurfer (copied to a .license file in your $FREESURFER_HOME), this is not required.

Structure : tuple val(meta), path(fs_license)
  • meta [map] Metadata map.
  • fs_license [file] FreeSurfer license file.
False
optionsmapMap of options for the subworkflow.

  • run_synthseg (boolean) [Default: False]
    Whether to run SynthSeg for segmentation. If false, FSL’s fast will be used for segmentation.
True

TypeDescriptionMandatoryPattern
wm_maskfileChannel containing WM mask files. Will be outputted regardless of the selected segmentation method and inputs provided.

Structure : tuple val(meta), path(wm_mask)
  • meta [map] Metadata map.
  • wm_mask [file] White matter mask file.
True*.\{nii,nii.gz\}
gm_maskfileChannel containing GM mask files. Will be outputted regardless of the selected segmentation method and inputs provided.

Structure : tuple val(meta), path(gm_mask)
  • meta [map] Metadata map.
  • gm_mask [file] Gray matter mask file.
True*.\{nii,nii.gz\}
csf_maskfileChannel containing CSF mask files. Will be outputted regardless of the selected segmentation method and inputs provided.

Structure : tuple val(meta), path(csf_mask)
  • meta [map] Metadata map.
  • csf_mask [file] Cerebrospinal fluid mask file.
True*.\{nii,nii.gz\}
wm_mapfileChannel containing WM probability maps.

Structure : tuple val(meta), path(wm_map)
  • meta [map] Metadata map.
  • wm_map [file] White matter probability map file.
False*.\{nii,nii.gz\}
gm_mapfileChannel containing GM probability maps.

Structure : tuple val(meta), path(gm_map)
  • meta [map] Metadata map.
  • gm_map [file] Gray matter probability map file.
False*.\{nii,nii.gz\}
csf_mapfileChannel containing CSF probability maps.

Structure : tuple val(meta), path(csf_map)
  • meta [map] Metadata map.
  • csf_map [file] Cerebrospinal fluid probability map file.
False*.\{nii,nii.gz\}
segfileChannel containing the optional nifti segmentation volume from synthseg.

Structure : tuple val(meta), path(seg)
  • meta [map] Metadata map.
  • seg [file] SynthSeg segmentation file.
False*.\{nii,nii.gz\}
aparc_asegfileChannel containing the optional nifti cortical parcellation and segmentation volume from synthseg.

Structure : tuple val(meta), path(aparc_aseg)
  • meta [map] Metadata map.
  • aparc_aseg [file] SynthSeg aparc+aseg parcellation file.
False*.\{nii,nii.gz\}
resamplefileChannel containing the optional resampled images at 1mm.

Structure : tuple val(meta), path(resample)
  • meta [map] Metadata map.
  • resample [file] Resampled image file.
False*.\{nii.nii.gz\}
volumefileChannel containing the optional Output CSV file with volumes for all structures and subjects.

Structure : tuple val(meta), path(volume)
  • meta [map] Metadata map.
  • volume [file] Volumes CSV file.
False*.csv
qc_scorefileChannel containing the optional output CSV file with qc scores for all subjects.

Structure : tuple val(meta), path(qc_score)
  • meta [map] Metadata map.
  • qc_score [file] QC scores CSV file.
False*.csv
versionsfileFile containing software versions.

Structure : tuple path(versions)
  • versions [file] Versions YAML file.
Trueversions.yml


Last updated : 2026-03-17