# Applications¶

## Commands¶

Command Description
average-dofs This command averages a number of input transformations. It can be used to construct a brain image atlas and has been utilized for the construction of the spatio-temporal fetal/neonatal brain atlases available at http://brain-development.org/brain-atlases/.
average-images Computes voxelwise average image of the given (transformed) input images.
bisect-dof This command bisects a rigid or affine transformation by calculating the matrix square root of the transformation matrix.
calculate This tool can be used for basic calculations from a sequence of data values read either from an image or a VTK pointset. It can be used, for example, to add two data sequences and to divide the result by a constant. The current sequence can be written to an output file again using calculate -out. Additionally, statistics of the current data sequence can be computed such as the mean or variance. The order of the data transformations and calculation of statistics is determined by the order of the command-line arguments.
calculate-distance-map Computes distance transformation of binary object mask.
calculate-exponential-map Reads a dense 3D (2D) stationary velocity field, computes the corresponding dense 3D (2D) displacement field, and writes the resulting vector field.
calculate-lie-bracket Computes the Lie bracket of two vector fiels $$z = [x, y]$$.
calculate-logarithmic-map Reads a dense 3D (2D) displacement field, computes the corresponding stationary 3D (2D) velocity field, and writes the resulting vector field.
calculate-surface-attributes Calculate attributes of input surface such as normals and curvature. If required, as in case of the curvature calculations, the input mesh is triangulated beforehand if it contains non-triangular faces.
calculate-surface-spectrum Performs a spectral analysis of the general graph Laplacian matrix computed from the given input surface mesh(es).
close-image Closes holes by first dilating and then eroding an input image.
concatenate-dofs Computes the composition T of the given input transformations such that
concatenate-images Concatenate two or more either 2D images to form a 3D volume, or 3D volumes to form a 3D+t temporal sequence. All input images must have the same image attributes, except in either the third (2D) or the third and fourth (3D) image dimension.
convert-dof Converts between different transformation file formats:
convert-image Converts an image from one voxel type to another.
convert-pointset Convert point set from one (file) format to another.
convert-pointset-to-mat Saves the points and faces of a vtkPolyData to a MAT file.
copy-pointset-attributes Copies point and/or cell data from a source point set to a target point set and writes the resulting amended point set to the specified output file. When no separate output file is specified, the target point set is overwritten.
copy-pointset-attributes-from-mat Sets/Adds variables stored in a MAT file as point data of a VTK dataset.
cut-brain Cut input brain volume/mask into left and/or right hemisphere(s).
decimate-surface Decimates a (triangular) mesh using VTK’s vtkQuadricDecimation filter. In case of decimate-surface -pro, the vtkDecimatePro filter is used instead.
deform-mesh Iteratively minimizes a deformable surface model energy functional. The gradient of the energy terms are the internal and external forces of the deformable surface model.
delete-pointset-attributes Delete point data and/or cell data from input point set.
detect-edges Convolves the input image with an edge detection operator.
dilate-image Dilates an input image by replacing a voxel’s value by the maximum of the values of its neighboring voxels.
downsample-image Downsamples an image using an iterative Gaussian pyramid filter.
edit-dof This tool provides a generic way of modifying the parameters of a transformation (linear as well as non-linear). It uses the generic interface member function Transformation::Set whose arguments are the name of the parameter and the value to be set as string.
edit-image Modifies the attributes of an image stored in the header.
erode-image Erodes an input image by replacing a voxel’s value by the minimum of the values of its neighboring voxels.
evaluate-distance Evaluate distance between two given point sets. With increased verbosity (see evaluate-distance -v), the mean and standard deviation of the measured distances (verbosity level >=1) and the individual distance for each target point is reported (verbosity level >=2).
evaluate-distortion Computes the distortion of a surface mesh under deformation and stores the results in the output dataset. If no output dataset is given, the mean and standard deviation are reported only.
evaluate-dof Calculates registration transformation quality measures such as the voxel-wise cumulative or mean inverse-consistency error (CICE/MICE) for pairs of forward transformation from target to source and backward transformation from source to target image. Another voxel-wise measure that can be computed using this program are the cumulative or mean transitivity error (CTE/MTE) given three transformations, from target (A) to B, from B to C, and from C to A again.
evaluate-jacobian Computes the Jacobian determinant of the given transformation at each target image voxel. If no <output> image name is given, the statistics of the Jacobian determinant distribution are printed to STDOUT instead, such as min, max, and mean.
evaluate-overlap Computes the overlap of either two intensity images (average SI) or two segmentations (see evaluate-overlap -label). If more than one source image is given, the overlap between each of these and the target is evaluated.
evaluate-similarity Evaluates the (dis-)similarity of two intensity images.
evaluate-surface-overlap Reports label statistics given two surface meshes and a text file listing the indices of corresponding points. The labels have to be stored as named point data array in both datasets.
extract-connected-components Extracts connected components from input segmentation label image. By default, the largest connected component is extracted. In case of extract-connected-components -output-component-labels, the labels of the components are written instead.
extract-connected-points Extract (largest) connected components of the input point set. The connected components are sorted by size, where the largest connected component has index 0.
extract-image-region Crop/pad image by extracting a region of interest. The output image region is chosen such that it contains the union of all specified axis-aligned rectangular input image regions. In case of extract-image-region -pad, the output region does not have to be fully contained within the input image. Values outside are then set to the specified padding value.
extract-pointset-surface Extract surface of point set. If more than one input point set is given, it computes the boundary of the union, intersection, or difference volume computed from the volumes defined by the individual input surfaces.
extract-surface Extract the isosurface from an intensity image or segmentation.
flip-image Swaps the two image dimensions at a time, in the order of the input options. Both, the image data and the coordinates of the image origin are swapped each time an input option is processed.
help-rst No description available.
info Prints some useful information about the given input file, which can be an image, transformation (requires MIRTK Transformation module), or point set (requires MIRTK Point Set module).
init-dof This tool either creates a new affine transformation with the given parameters or approximates an affine transformation or non-rigid deformation given a set of corresponding landmarks or point displacements (see init-dof -displacements).
invert-dof Inverts any transformation. In case of a non-rigid transformation the output transformation only approximates the true inverse. When the inverse mapping is not defined at a given point, the output transformation at this point depends on the interpolation numerical approximate solution found.
map This tool parameterizes a shape embedded in 3D space. The generated output map assigns each point in the input domain a point in the output domain.
match-points Writes for each point in a target point set its corresponding point in the source point set. The found correspondences can be either written to an output point set with indices and difference vectors stored as point data, or a text file listing for each target point index the index of the corresponding source point.
offset-surface Displaces surface mesh points by a given amount along the surface normal to create an offset surface mesh. To prevent self-intersections, a dense offset surface can optionally first be sampled from an implicit offset surface model onto which each point of the input surface is projected.
open-image Removes small connections between objects by first eroding and then dilating an input image.
project-onto-surface Assign scalars or labels to either the vertices or the cells of a surface mesh. When the input as a real-valued image, the values are linearly interpolated. When the input is a segmentation labels image, the value assigned to a vertex/cell is the label of the nearest voxel in the given segmentation image. For the projection of cortical labels onto the WM/cGM or cGM/CSF boundary, use project-onto-surface -white or project-onto-surface -pial.
reflect-image Applies a sequence of one or more spatial reflections to an image. The reflection options are processed in the order given and changing the order can change the result.
register Registers a set of images, polygonal surface meshes, and/or point clouds (e.g. fiducial markers). The set of input images can be comprised of multiple channels (e.g., acquired with different imaging modalities) at different time points. For longitudinal data, the temporal origin in the NIfTI header identifies the time point that each input image belongs to. How all input images and polydata sets are registered with one another is determined by an energy function. This energy function is formulated in a simplified math expression using MATLAB-style indexing for the individual input files, i.e.,
remesh Remeshes a surface mesh such that the resulting mesh has an average edge length within the specified limits. The input surface mesh is triangulated when necessary before the local remeshing passes.
resample-image Resamples an image on a lattice with specified voxel size.
smooth-image This program blurs an input image using a Gaussian filter with a standard deviation equal to the specified sigma value. The dimensions in which the filter recursively applied can be specified by the respective options below. Note that more than one of these options can be specified and that each can also be given more than once. The blurring of the respective dimensions is then performed in the order of the given blurring options.
smooth-surface Smooths the node positions and/or scalar data of a surface mesh.
transform-image Applies a transformation to an input image. Each voxel center of the target image is mapped by the given transformation to the space of the source image. The output intensity for the target voxel is the source image intensity interpolated at the mapped point.
transform-points Applies one or more transformations to a set of points. Input point x, y, and z coordinates are either read from STDIN (space separated) or from a point set file. The corresponding transformed coordinates are then written either to STDOUT or an output point set file, respectively. If multiple transformations are specified, these are applied in the order as they appear on the command line.

## Options¶

The following options are common to all mirtk commands. For a complete list of options for each command, see the help page of the respective command linked above or the command help (mirtk help <command>).

### Standard options¶

-v, -verbose [n]

Increase/Set verbosity of output messages. (default: 0)

-debug [level]

Increase/Set debug level for output of intermediate results. (default: 0)

-version [major.minor]

Print version and exit or set version to emulate.

-revision

Print revision (or version) number only and exit.

-h, -help

Print help and exit.

### Terminal options¶

-color, -nocolor

Enable/disable colored output. (default: off)