Purpose

The TypeArithmetic1 module offers a large number of operations to modify, convert and process images of non scalar data types such as vec3, vec3f, mat3, matf3, vector, quaterniond and complexd and many more.

Details

Internally all operations are calculated in double type, for example the 2 component types vecf2, complexf, complexd, complexld are implicitly handled as type vec2 and all 6 component types such as vecf6, Vector16, Vector and Vector64 are implicitly handled as vec6. The same holds for the quaternion types quaternionf, quaterniond, and quaternionld which are handled as vec4 values.

If you need explicit operations on complex voxels then use dedicated modules for complex arithmetic such as ComplexArithmetic1, ComplexArithmetic2, ComplexToReal or complex modules from ITK.

Windows

Default Panel

../../../Modules/ML/MLTypeSupport/mhelp/Images/Screenshots/TypeArithmetic1._default.png

Input Fields

input0

name: input0, type: Image

Output Fields

output0

name: output0, type: Image

Parameter Fields

Field Index

Const Components: String
DoubleParam1: Double
Index List: String
IntParam1: Integer
IntParam2: Integer
Operation: Enum

Visible Fields

Operation

name: operation, type: Enum, default: VecToFlippedVec, deprecated name: conversion

Defines the conversion operation.

Values:

Title Name Deprecated Name Description
Vec To Flipped Vec VecToFlippedVec   Converts vector voxels to vector voxels with opposite component order.
Vec To Mat VecToMat   Builds a matrix voxels with diagonal given by the vector voxel components.
Vec Normalize VecNormalize   Normalization of the vector voxels.
Vec Normalize To Length VecNormalizeToLength   Normalization of the vector voxels to an arbitrary length.
Vec Length VecLength   Length of the vector voxels.
Vec Length2 VecLength2   Squared length of all vector components.
Comp Sum CompSum VecCompSum Sum of all components.
Comp Mul CompMul VecCompMul Product of all components.
Comp Max Abs CompMaxAbs VecCompMaxAbs Maximum of absolute values of components.
Comp Min Abs CompMinAbs   Maximum of absolute values of components.
Comp Scale CompScale   Scales all components with DoubleParam1 which becomes visible when this mode is selected.
Max Comp Pos MaxCompPos VecMaxCompDim Calculates the position of the maximum component value; if more than one is found then the first is taken.
Min Comp Pos MinCompPos   Calculates the position of the minimum component value; if more than one is found then the first is taken.
Comp Max CompMax VecCompMax Maximum vector component.
Comp Min CompMin VecCompMin Minimum vector component.
Mat To Transposed Mat MatToTransposedMat   Transposes the matrix voxels.
Mat To Inverse Mat MatToInverseMat   Inverts the matrix voxels or - if that is not possible - sets the identity.
Mat To Determinant MatToDeterminant   Determinant of the matrix voxels as scalar values.
Mat Trace MatTrace   Calculates the trace of matrix voxels as scalar values.
Mat Diagonal To Vec MatDiagonalToVec   Calculates diagonal elements of matrix voxels as vectors of the matrix dimension.
Mat To Submatrix MatToSubmatrix   Develop a matrix to particular row or line, selected in IntParam1 and IntParam2 which become visible when this mode is selected.
Mat Column0To Vec MatColumn0ToVec   Extracts column 0 from the matrix voxels to vector voxels of the matrix dimension.
Mat Column1To Vec MatColumn1ToVec   Extracts column 1 from the matrix voxels to vector voxels of the matrix dimension.
Mat Column2To Vec MatColumn2ToVec   Extracts column 2 from the matrix voxels to vector voxels of the matrix dimension.
Mat Column3To Vec MatColumn3ToVec   Extracts column 3 from the matrix voxels to vector voxels of the matrix dimension.
Mat Column4To Vec MatColumn4ToVec   Extracts column 4 from the matrix voxels to vector voxels of the matrix dimension.
Mat Column5To Vec MatColumn5ToVec   Extracts column 5 from the matrix voxels to vector voxels of the matrix dimension.
Mat Row0To Vec MatRow0ToVec   Extracts row 0 from the matrix voxels to vector voxels of the matrix dimension.
Mat Row1To Vec MatRow1ToVec   Extracts row 1 from the matrix voxels to vector voxels of the matrix dimension.
Mat Row2To Vec MatRow2ToVec   Extracts row 2 from the matrix voxels to vector voxels of the matrix dimension.
Mat Row3To Vec MatRow3ToVec   Extracts row 3 from the matrix voxels to vector voxels of the matrix dimension.
Mat Row4To Vec MatRow4ToVec   Extracts row 4 from the matrix voxels to vector voxels of the matrix dimension.
Mat Row5To Vec MatRow5ToVec   Extracts row 5 from the matrix voxels to vector voxels of the matrix dimension.
Mat To Ordered Eigen Values MatToOrderedEigenValues   Ascending eigenvalues of matrix voxels to vector components.
Mat To Ordered Eigen Vectors MatToOrderedEigenVectors   Ascending eigenvectors of matrix voxels to matrix rows.
Mat To Ordered Scaled Eigen Vectors MatToOrderedScaledEigenVectors   Ascending eigenvectors of matrix voxels to matrix rows scaled with eigenvalues.
To Mat2Identity ToMat2Identity   Sets mat2 identity voxels.
To Mat3Identity ToMat3Identity   Sets mat3 identity voxels.
To Mat4Identity ToMat4Identity   Sets mat4 identity voxels.
To Mat5Identity ToMat5Identity   Sets mat5 identity voxels.
To Mat6Identity ToMat6Identity   Sets mat6 identity voxels.
Vec3To Vec4Point Vec3ToVec4Point   Converts vec3 to vec4 representing a homogeneous point by appending a 0.
Vec3To Vec4Vector Vec3ToVec4Vector   Converts vec3 to vec4 representing a homogeneous vector by appending a 0.
Vec4To Vec3Point Vec4ToVec3Point   Converts homogeneous vec4 vector to a vec3 representing a point. 0 scale components in last vector component are silently replaced by 1 to avoid division by zero.
Vec4To Vec3Vector Vec4ToVec3Vector   Converts homogeneous vec4 vector to a vec3 representing a vector by dropping the last vec4 component.
Vec3To Mat4 Vec3ToMat4   Builds a mat4 with first 3 diagonal elements given by vec3 components and a 1 in bottom right.
Mat3To Mat4 Mat3ToMat4   Builds a mat4 with upper left 3x3 elements from mat3 and a 1 in the bottom right element (and 0 else).
Mat4To Mat3 Mat4ToMat3   Builds a mat3 from upper left 3x3 elements of mat4.
Vec6Tensor To LLRows In Mat3 Vec6TensorToLLRowsInMat3  

Packed tensor in vec6 to lower left mat3 triangle where the matrix is filled row by row.

Assuming that the mat3 components are indexed row by row from m0-m8, and the vec6 from v0-v5 then the resulting mat3 is ((v0,0,0), (v1,v2,0), (v3,v4,v5)).

Vec6Tensor To LLCols In Mat3 Vec6TensorToLLColsInMat3  

Packed tensor in vec6 to lower left mat3 triangle where the matrix is filled column by column.

Assuming that the mat3 components are indexed row by row from m0-m8, and the vec6 from v0-v5 then the resulting mat3 is ((v0,0,0), (v1,v3,0), (v2,v4,v5)).

Vec6Tensor To Ordered Eigen Values Vec6TensorToOrderedEigenValues   Compute ascending eigenvalues from 3x3 tensor (vec6).
Vec6Tensor To Ordered Eigen Vectors Vec6TensorToOrderedEigenVectors   Compute ascending eigenvectors from 3x3 tensor (vec6). Result is stored in mat3 type.
Mat3LLRows To Vec6Tensor Mat3LLRowsToVec6Tensor  

Lower left mat3 triangle of matrix to packed tensor in vec6 where the mat3 is read row by row.

Assuming that the mat3 components are indexed row by row from m0-m8, and the vec6 from v0-v5 then the resulting vec6 is (m0,m3,m4,m6,m7,m8).

Mat3LLCols To Vec6Tensor Mat3LLColsToVec6Tensor  

Lower left mat3 triangle of matrix to packed tensor in vec6 where the mat3 is read column by column.

Assuming that the mat3 components are indexed row by row from m0-m8, and the vec6 from v0-v5 then the resulting vec6 is (m0,m3,m6,m4,m7,m8).

Vec3To Vec6Tensor Product Vec3ToVec6TensorProduct   Compute tensor product of input vector with itself (vx^2, vx*vy, vx*vz, vy^2, vy*vz, vz^2)
Project Vec To Dim ProjectVecToDim   Project a vector to dimension selected in IntParam1 which becomes visible when this mode is selected.
Comp Mul Const CompMulConst  

Multiplies the values given in Const Components to the corresponding components of the input voxel.

If not enough values are specified in Const Components, the list will automatically will be filled with zeros.

Comp Add Const CompAddConst  

Adds the values given in Const Components to the corresponding components of the input voxel.

If not enough values are specified in Const Components, the list will automatically will be filled with zeros.

Reorder Comps ReorderComps  

The components of the input voxels are stored in the order as described in Index List.

If Index List is too short, it automatically will be filled with zeros.

Indexes out of range will be clamped against the valid range of component indexes.

Mat Mult Const Mat MatMultConstMat  

Multiplies all matrix voxels of an input image with a given constant matrix of the same size whose values are given in Const Components.

Missing values in Const Components are automatically appended as zeros.

Mat Mult Const Vec MatMultConstVec  

Multiplies all matrix voxels of an input image with a given constant vector of the same size whose values are given in Const Components.

Missing values in Const Components are automatically appended as zeros.

Vec Mult Const Mat VecMultConstMat  

Multiplies all vector voxels of an input image with a given constant matrix of the same size whose values are given in Const Components.

Missing values in Const Components are automatically appended as zeros.

Vec Dot Const Vec VecDotConstVec  

Multiplies all vector voxels of dimension 2-6 of an input image with a given constant vector of the same dimension and whose values are given in Const Components.

Missing values in Const Components are automatically appended as zeros.

Vec To Phong Diffuse VecToPhongDiffuse  

Computes the normalized difference vector between the current voxel position and a given constant vector. The result voxel is the scalar product between the input vector voxel and the normalized difference vector. This mode operates only on input voxels of dimension 2-6.:

ResultPixel = ScalarProduct( InputVectorVoxel, Norm(ConstantVector - VoxelPosition))

This is comparable with the diffuse phong lighting calculation often used in computer graphics. The result values can be interpreted as a similarity measurement of the current input vector and a direction vector of the current voxel coordinate to a given point or light source.

Sort Ascending SortAscending   Sort all voxel components in ascending order.
Sort Descending SortDescending   Sort all voxel components in descending order.
Sort Ascending Abs SortAscendingAbs   Sort all absolute voxel components in ascending order.
Sort Descending Abs SortDescendingAbs   Sort all absolute voxel components in descending order.
Sort Ascending Idx SortAscendingIdx   Sort all voxel components in ascending order, results are the corresponding component indexes.
Sort Descending Idx SortDescendingIdx   Sort all voxel components in descending order, results are the corresponding component indexes.
Sort Ascending Abs Idx SortAscendingAbsIdx   Sort all absolute voxel components in ascending order, results are the corresponding component indexes.
Sort Descending Abs Idx SortDescendingAbsIdx   Sort all absolute voxel components in descending order, results are the corresponding component indexes.

IntParam1

name: parameterX, type: Integer, default: 0, deprecated name: dimension

Sets a value for row or dimension selection.

IntParam2

name: parameterY, type: Integer, default: 0

Sets a value for column or position selection.

DoubleParam1

name: value, type: Double, default: 0

Sets a scale factor or floating point value.

Index List

name: intList, type: String

Sets a list of source component indexes to be stored in target components.

Const Components

name: dblList, type: String

Sets a list of factors or summands to be multiplied or added with vector components.