BRAIN_Mask

Brain Masking, mask file will be added to the global variables in the result file

Command:

dmriprep

Module version:

0.1

Module type:

prep

Attributes:

utility

Notes:

BRAIN_Mask README

Source:

dtiplayground/dmri/preprocessing/modules/BRAIN_Mask

Protocol options

method

Method to extract the brain

Type:

list

Default:

fsl

Choices:
  • fsl – Use FSL for Brainmasking

  • synthstrip – SynthStrip deep learning brain extraction (built in, torch; FreeSurfer’s mri_synthstrip only if asked for or without torch)

  • hdbet – HD-BET deep learning brain extraction of the average b0 (hd-bet command, e.g. installed in a separate Python environment)

  • medianOtsu – dipy median_otsu, median filter and Otsu threshold of the average b0

  • customMask – Use custom Brainmasking

averagingMethod

Averaging method by which the source image is generated for the mask

Type:

list

Default:

idwi

Choices:
  • direct_average – Direct average on baseline images. If no baseline is found then average whole volume

  • idwi – Geometric mean of baseline images. If no baseline is found then whole images will be used.

n4BiasCorrection

N4 bias field correction (SimpleITK) of the image the mask is computed from (the average baseline, also the b0 input of SynthStrip), against an intensity inhomogeneity that makes the mask cut into the darker side of the brain; not applied to the AD input of SynthStrip (a diffusivity has no bias field). The corrected image and the field are written to the module folder (mask_input_n4*.nii.gz)

Type:

boolean

Default:

false

Used when:

method is fsl,synthstrip,hdbet,medianOtsu

n4ShrinkFactor

The bias field is estimated on the image shrunk by this factor (faster, the field being smooth) and applied at full resolution

Type:

integer

Default:

4

Used when:

n4BiasCorrection is True

betFractionalThreshold

FSL bet fractional intensity threshold (-f, between 0 and 1); smaller values give a larger brain outline, larger values a smaller one

Type:

float

Default:

0.5

Used when:

method is fsl

synthstripInput

Image SynthStrip is applied to

Type:

list

Default:

ad

Used when:

method is synthstrip

Choices:
  • ad – Axial diffusivity of a DTI fit of the image (diffusion weighted volumes up to b=1500)

  • b0 – Average of the baseline (b=0) images

synthstripBorder

Mask border threshold in mm (mri_synthstrip -b); larger values give a larger mask

Type:

float

Default:

1.0

Used when:

method is synthstrip

synthstripNoCSF

Exclude the CSF from the brain border (mri_synthstrip –no-csf)

Type:

boolean

Default:

false

Used when:

method is synthstrip

synthstripImplementation

The built-in SynthStrip (torch; the model weights are downloaded on first use) or FreeSurfer’s mri_synthstrip; both give the same masks

Type:

list

Default:

auto

Used when:

method is synthstrip

Choices:
  • auto – The built-in version, or FreeSurfer’s mri_synthstrip when torch isn’t installed

  • freesurfer – FreeSurfer’s mri_synthstrip (7.3+), an external program

  • builtin – SynthStrip network run in dtiplayground (torch)

synthstripPath

FreeSurfer home directory or path of mri_synthstrip (synthstripImplementation freesurfer, or auto without torch); if empty, $FREESURFER_HOME and the PATH are searched

Type:

filepath-remote

Default:

not set

Used when:

method is synthstrip

hdbetDevice

Device HD-BET runs on

Type:

list

Default:

auto

Used when:

method is hdbet

Choices:
  • auto – GPU (cuda) if the torch of hd-bet sees one, otherwise CPU

  • cuda – GPU (cuda)

  • cpu – CPU

hdbetTTA

Test time augmentation (mirroring); disabling it (–disable_tta) is faster, mainly on CPU, at a slight cost in quality

Type:

boolean

Default:

true

Used when:

method is hdbet

hdbetPath

Path of the hd-bet command or of the Python environment (or its bin directory) it is installed in; if empty, the environment of dtiplayground and the PATH are searched

Type:

filepath-remote

Default:

not set

Used when:

method is hdbet

medianOtsuRadius

Radius (in voxels) of the median filter applied before the Otsu threshold

Type:

integer

Default:

4

Used when:

method is medianOtsu

medianOtsuNumpass

Number of median filter passes

Type:

integer

Default:

4

Used when:

method is medianOtsu

medianOtsuDilate

Number of binary dilation iterations applied to the mask (0 for none)

Type:

integer

Default:

0

Used when:

method is medianOtsu

modality

Modality of the input image

Type:

list

Default:

t2

Choices:
  • t2 – T2 Modality

  • fa – Fractional Anistropy

customMaskPath

Provide custom mask to override default

Type:

filepath-remote

Default:

not set

Used when:

method is customMask