DTI_Register

Register DTI to the fixed volume using DTI-Reg (ANTs) or the diffeomorphic tensor registration TensorSVF

Command:

dmriprep

Module version:

0.1

Module type:

prep

Attributes:

utility, indentity

Notes:

DTI_Register README

Source:

dtiplayground/dmri/preprocessing/modules/DTI_Register

Global variables

Values this module shares with the other modules of the pipeline (dmriprep run -g <name>=<value> sets one).

  • dti_path

  • displacement_field_path

  • inverse_displacement_field_path

  • registered_dti_path

  • initial_affine_path

  • registered_metric_paths

  • reference_dti_path

  • tensor_flip_applied

Command line variables

Values this module shares with the other modules of the pipeline (dmriprep run -g <name>=<value> sets one).

  • reference_dti

  • reference_normative_model

  • age

  • tensor_flip

Protocol options

method

Method to register the DTI: TensorSVF (default) or ANTs (DTI-Reg). TensorSVF aligns the principal directions better (white matter angle 7.2 vs 10.5 deg on 139 scans of 0-12 years) and, with the free water term, the ventricles (Dice 0.81 vs 0.70); use it with a referenceNormativeModel (the mean tensor of the age bin of the subject)

Type:

list

Default:

TensorSVF

Choices:
  • ANTs – DTI-Reg - diffeomorphic ANTS registration of the scalar images (FA), tensors resampled with reorientation

  • TensorSVF – Diffeomorphic registration of the tensors (orientation and shape) with a free water term when a free water fraction map is available (multi-shell); GPU when available, otherwise CPU (about 1.5 min on a GPU, 12 min on 4 CPU cores)

referenceImage

Reference (Fixed Image)

Type:

string

Default:

not set

referenceNormativeModel

Normative model of the reference atlas (folder with manifest.json and <age bin>/DTI_mean.nrrd, written by ‘dmrifiberprofile qc-registration –build-normative’). The DTI is then registered to the mean tensor of the age bin of the subject instead of the reference image; without an age, or a matching bin, the reference image is used

Type:

dirpath-remote

Default:

not set

age

Age of the subject in the unit of the age bins of the normative model (months); taken from ageCSV, or read from the image path with ageRegex, if not set (then ageFallback, if set). It overrides the others, so use ageFallback for an age of the images that have none

Type:

float

Default:

not set

ageCSV

CSV/TSV with the age of each scan (as ‘dmrifiberprofile qc-registration –age-csv’), for cohorts whose session names don’t carry the age. Subject and session columns are detected (participant_id/session_id and variants); one row per subject applies to all of its sessions. The subject and session of the scan are read from its path (sub-<id>, ses-<id>), else from the IBIS organization (a 6 digit id folder followed by a visit folder starting with V - …/999434/VSA-CVD/… is subject 999434, session SA-CVD; the table may name the session SA-CVD or VSA-CVD)

Type:

filepath-remote

Default:

not set

ageColumn

Name of the ageCSV column holding the age (default - auto-detect - age, age_months, candidate_age, …)

Type:

string

Default:

not set

ageSubjectColumn

Name of the ageCSV column holding the subject id (default - auto-detect - participant_id, subject_id, subject, id, candid, …)

Type:

string

Default:

not set

ageSessionColumn

Name of the ageCSV column holding the session / visit (default - auto-detect - session_id, session, visit, visit_label, …)

Type:

string

Default:

not set

ageUnits

Units of the age column of ageCSV and of ageFallback (converted to the months of the age bins); age and ageRegex are in months

Type:

list

Default:

months

Choices:
  • months – Ages of ageCSV and ageFallback are in months

  • years – Ages of ageCSV and ageFallback are in years

  • weeks – Ages of ageCSV and ageFallback are in weeks

  • days – Ages of ageCSV and ageFallback are in days

ageRegex

Regular expression for the age in the path of the input image (group 1), used when neither age nor ageCSV gives one

Type:

string

Default:

ses-(\d+)m

ageFallback

Age of an image that neither age, ageCSV nor ageRegex gives one, in ageUnits (months by default), with a warning in the log; without it such an image is registered to the reference image

Type:

float

Default:

not set

ANTsPath

ANTs installation directory (default is dtiplayground-tools/ANTs)

Type:

dirpath-remote

Default:

$ANTSDIR

ANTsMethod

ANTS method

Type:

string

Default:

useScalar-ANTS

registrationType

Registration Type

Type:

list

Default:

GreedyDiffeo

Choices:
  • GreedyDiffeo – Greedy Diffeo

similarityMetric

Similarity Metric

Type:

list

Default:

CC

Choices:
  • CC – Cross Correlation

similarityParameter

Similarity Parameter (radius of the CC metric)

Type:

number

Default:

2

ANTsIterations

Iteration parameter for ANTS

Type:

string

Default:

100x50x20

gaussianSigma

Gaussian Sigma

Type:

number

Default:

1

ANTsTransformationStep

Gradient step of the ANTS transformation

Type:

number

Default:

0.25

ANTsUseHistogramMatching

Match the histograms of the scalar images before the ANTS registration

Type:

boolean

Default:

true

scalarMeasurement

Scalar image of the tensors used for the registration (DTI-Reg and BRAINSFit)

Type:

list

Default:

FA

Choices:
  • FA – Register the FA images of the tensors

  • MD – Register the MD images of the tensors

tensorCorrection

Correction of tensors with negative eigenvalues when computing the scalar images and resampling

Type:

list

Default:

abs

Choices:
  • abs – Negative eigenvalues are replaced by their absolute value

  • zero – Negative eigenvalues are set to zero

  • nearest – Nearest positive definite tensor

  • none – No correction

initialAffine

Initial affine transform of the DTI to the reference, refined by the ANTS registration

Type:

list

Default:

BRAINSFit

Choices:
  • BRAINSFit – Affine registration of the scalar images with BRAINSFit (fixed = reference, moving = DTI)

  • file – Use the transform given in initialAffineFile

  • none – No initial affine transform

initialAffineFile

ITK transform file (fixed = reference, moving = DTI), used if initialAffine is ‘file’

Type:

string

Default:

not set

tensorFlip

Correction of the tensor frame applied to the DTI before the registration. When empty (default): the global variable tensor_flip, else rotation (auto without an initial affine). none, auto (detected: agreement of the principal directions with the reference after the initial affine, or their coherence along the tracts without an initial affine), the axes to flip (e.g. x or x,z), voxel for components in the frame of the voxel axes (rotated into the space of the header; with flips e.g. voxel,x), or rotation (any rotation of the frame, flips and axis swaps included, that best aligns the principal directions with the reference after the initial affine; the default)

Type:

string

Default:

not set

freeWater

Free water term of TensorSVF (aligns the ventricles; for multi-shell data with a free water fraction map)

Type:

list

Default:

auto

Choices:
  • auto – The FW-tensor free water fraction (<prefix>FWf) of the DTI folder, else the NODDI fraction (<prefix>NODDI_FWF), each when the folder of the reference tensor has its mean map (FWF_mean, NODDI_FWF_mean - the age bins of the normative model have them); otherwise the tensors only (single shell data)

  • FWf – Free water fraction of the FW-tensor fit (<prefix>FWf, reference FWF_mean); an error when missing

  • NODDI_FWF – Free water fraction of NODDI (<prefix>NODDI_FWF, reference NODDI_FWF_mean); an error when missing

  • none – Register the tensors only

freeWaterImage

Free water fraction map of the DTI (default - found in the folder of the input DTI, see freeWater)

Type:

filepath-remote

Default:

not set

referenceFreeWater

Mean free water fraction map of the reference (default - FWF_mean / NODDI_FWF_mean in the folder of the reference tensor)

Type:

filepath-remote

Default:

not set

freeWaterWeight

Weight of the free water term (1 - larger weights overlap the ventricles slightly more but align the white matter of small ventricles worse)

Type:

number

Default:

1.0

tensorRegRegularization

Weight of the smoothness of the velocity field (0.15; below 0.1 the deformation may fold)

Type:

number

Default:

0.15

tensorRegSmoothing

Gaussian sigma (voxels) of the velocity field at each level

Type:

number

Default:

0.5

tensorRegLevels

Downsampling factors of the resolution levels, coarse to fine

Type:

string

Default:

4x2x1

tensorRegIterations

Iterations at each resolution level

Type:

string

Default:

200x150x100

tensorRegDevice

PyTorch device - auto (the GPU when available, otherwise the CPU), cpu, cuda or cuda:<n>

Type:

string

Default:

auto

tensorFlipFAThreshold

FA threshold of the white matter voxels used by the automatic flip detection

Type:

number

Default:

0.3

BRAINSFitTransforms

Comma delimited BRAINSFit transform stages (Rigid, ScaleVersor3D, ScaleSkewVersor3D, Affine), run in this order

Type:

string

Default:

Rigid,Affine

BRAINSFitInitializeTransformMode

Initialization of the BRAINSFit registration

Type:

list

Default:

useCenterOfHeadAlign

Choices:
  • useCenterOfHeadAlign – Align the centers of the heads

  • useMomentsAlign – Align the centers of mass and principal axes

  • useGeometryAlign – Align the image centers

  • Off – No initialization

BRAINSFitSamplingPercentage

Fraction (0-1) of the voxels sampled for the BRAINSFit metric. Default 0.5; smaller values are faster but less reproducible (BRAINSFit default 0.002 gave initial affines several mm apart between repeated runs)

Type:

number

Default:

0.5

registerMetrics

Apply the displacement field to the diffusion metrics in the folder of the input DTI that share its file name prefix (e.g. <scan>_dwi_QCed_FA.nii.gz for <scan>_dwi_QCed_tensor.nrrd). Tensor images (e.g. free-water corrected tensors) are resampled log-Euclidean with reorientation like the DTI, scalar images linearly. Written as registered_<name>

Type:

boolean

Default:

true

metricExclude

Comma delimited parts of file names that are not registered (e.g. brain masks); integer images and images that are neither scalar nor tensor are not registered either

Type:

string

Default:

mask