# TensorShapeExtract¶

`MLModule`
 genre `DTIImageProcessing` authors `Mathias Schlüter`, `Jan Klein` package `FMEwork/Release` dll `MLDTIStable` definition MLDTIStable.def see also `DiffusionTensorAnalysis` keywords `DTI`, `vector`, `tensor`

# Purpose¶

The module `TensorShapeExtract` extracts special shapes from DTI vector or tensor images.

# Details¶

When a tensor image is provided as input, the module assumes that the first three values in the u dimension correspond to the first eigenvector v1, the next three values to v2, and the latter three to v3. The module expects, that the length of those vectors equals the eigenvalues l1, l2, l3. As DTI tensor is positive-semidefinite the module clips the eigenvalues such that 1 >= l1 >= l2 >= l3.

When a vector image is provided as input the module outputs the vector's length independently of the selected mode.

The module internally, before any other calculation is done, maps all input values to [-1, 1] range using the following equation x * f + o, where x is the value to be mapped, f = 2/(InputImageMaxVal - InputImageMinVal) and o = -InputImageMinVal * f - 1.

If, after mapping step, a vector has length exceeding 1.2, the input vector or tensor to which this vector belongs, is assumed to be invalid and minimum input image voxel value is written on this voxel position to the output image.

The shapes set via `Shape Mode` are calculated using clipped eigenvalues and are clamped such that the shape is within [0, 1] range.

The calculated values are mapped back at the end using the equation y * f + o, where y is the value to be mapped back and:
• when y of scalar type, f = InputImageMaxVal - InputImageMinVal and o = InputImageMinVal.
• when y is a vector component, f = 0.5 * (InputImageMaxVal - InputImageMinVal) and o = f + InputImageMinVal.

# Input Fields¶

## input0¶

`name: ``input0``, type: ``Image`

DTI vector or tensor image.

# Output Fields¶

## output0¶

`name: ``output0``, type: ``Image`

# Parameter Fields¶

## Visible Fields¶

### Shape Mode¶

`name: ``shapeMode``, type: ``Enum``, default: ``FractionalAnisotropy`

Defines the mode of shape extraction.

Values:

Title Name Description
Strength Strength

Calculates the trace of the tensor.

Fractional Anisotropy FractionalAnisotropy

Calculates the fractional anisotropy of the tensor. Range of return value: [0,1] (0: isotropic, 1: anisotropic).

Relative Anisotropy RelativeAnisotropy

Calculates the normalized relative anisotropy of the tensor. Range of return value: [0,1] (0: isotropic, 1: anisotropic).

Volume Fraction VolumeFraction

Calculates the "remaining volume ratio" of the tensor. That means 1 - VolumeOfElipsoid/VolumeOfMeanSphere. Range of return value: [0,1] (0: isotropic, 1: anisotropic).

Linear Linear

Calculates the barycentric linear weight for the tensor. Range of return value: [0,1] (0: isotropic, 1: anisotropic).

Planar Planar

Calculates the barycentric planar weight for the tensor. Range of return value: [0,1] (0: 2d-isotropic, 1: 2d-anisotropic).

Spherical Spherical

Calculates the barycentric spheric weight for the tensor. Range of return value: [0,1] (1: isotropic, 0: anisotropic).

Linear Planar LinearPlanar

Calculates the barycentric linear plus half planar weight for the tensor. Range of return value: [0,1] (0: isotropic, 1: anisotropic).

Elongation Elongation

Calculates the elongation 1-(ev_2+...+ev_n)/(ev_1*(n-1)) for the tensor. Range of return value: [0,1] (0: isotropic, 1: anisotropic).

Direction Jitter DirectionJitter Calculates the orientation uncertainty for the tensor given some image noise. Range of return value: [0, 1] (0: anisotropic, 1: isotropic). For more info about used formule see paper: M.Schlüter et al. "White Matter Lesion Phantom for Diffusion Tensor Data and Its Application to the Assessment of Fiber Tracking".

### Output Mode¶

`name: ``outputMode``, type: ``Enum``, default: ``Shapes`

Defines the shape of the output.

Values:

Title Name Description
Shapes Shapes Calculates selected shape.
All Eigenvalues AllEigenvalues Outputs eigenvalues.
Linear Planar Spherical LinearPlanarSpherical

For each tensor calculates the following vector (s_M - value of selected shape mode):

Main Vector MainVector Outputs the first input vector.

### Use main vector scaling¶

`name: ``useMainVecScaling``, type: ``Bool``, default: ``TRUE`

If checked, the main vector is scaled by the calculated shape.

### Parameter¶

`name: ``parameter``, type: ``Double``, default: ``3`
This parameter is used only to calculate Strength and Direction Jitter shape parameters.
• Strength: the shape result is divided by the parameter value.
• Direction Jitter: the parameter is interpreted as noise.