Applications¶
Commands¶
Command  Description 

aggregateimages  Aggregates multiple (coregistered) input images into a single output image or report statistics thereof within a specified region of interest. The input images have to be defined in the same discrete finite image space. 
averagedofs  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 spatiotemporal fetal/neonatal brain atlases available at http://braindevelopment.org/brainatlases/. 
averageimages  Computes voxelwise average image of the given (transformed) input images. 
averagemeasure  Average voxelwise measure within each region of interest (ROI). 
averageoverlap  No description available. 
bisectdof  This command bisects a rigid or affine transformation by calculating the matrix square root of the transformation matrix. 
blendsurface  Blends two surface meshes with index based onetoone point correspondences by taking the point coordinates for selected points from the first surface mesh and all others from the second surface mesh. Points at the boundary of the point selection mask are blended between the two mesh positions of the corresponding points. For other points, i.e., those further away from the boundary, the blending factor is either 0 or 1. 
calculateboundarymap  Compute a surface boundary map suitable for the computation of a surface map to a 2D primitive shape such as a disk, square, or polygon. 
calculatedistancemap  Computes distance transformation of binary object mask. 
calculateelementwise  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 calculateelementwise 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 commandline arguments. 
calculateexponentialmap  Reads a dense 3D (2D) stationary velocity field, computes the corresponding dense 3D (2D) displacement field, and writes the resulting vector field. 
calculatefiltering  Calculates statistics by filtering with a kernel. 
calculategradients  A blur with S.D. sigma is appled before the gradient is estimated 
calculateliebracket  Computes the Lie bracket of two vector fiels \(z = [x, y]\). 
calculatelogarithmicmap  Reads a dense 3D (2D) displacement field, computes the corresponding stationary 3D (2D) velocity field, and writes the resulting vector field. 
calculatesurfaceattributes  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 nontriangular faces. 
calculatesurfacemap  This tool computes a mapping for each point on the surface of a given input shape embedded in 3D space. The output is a (piecewise linear) function which assigns each point on the surface of the input shape one or more values. In case of nonclosed surfaces, the output map can interpolate any values given on the boundary of the surface at the interior points of the surface. More common use cases are to compute a bijective mapping from one geometric shape to another geometric shape with identical topology. The resulting map is a parameterization of the surface of the input shape. Such parameterization can be used for texturing, object morphing, and surface registration. 
calculatesurfacespectrum  Performs a spectral analysis of the general graph Laplacian matrix computed from the given input surface mesh(es). 
calculatevolumemap  This tool computes a mapping for each point of the volume of a given input point set. The input is either a piecewise linear complex (PLC), i.e., a tesselation of the surface, or a tesselation of the shape’s volume such as a tetrahedral mesh generated from a PLC. The output is a volumetric map which assigns points of the volume one or more values. The volumetric map can in general interpolate any values given on the surface of the map domain at the interior of the volume. More common use cases are to compute a bijective map from one volumetric shape to another with identical topology. The resulting map is a reparameterization of the volume of the input shape. Such parameterization can be used for texturing, object deformation (cf. “cage deformation”), object morphing, and surface constraint image registration. 
changelabel  Changes the labels of the <init_labels> image inside the <mask> image according to probability maps <probmap_1> .. <probmap_N> with labels <label_1> .. <label_N> respectively and saves the result in <output> 
closeimage  Closes holes by first dilating and then eroding an input image. 
closescalars  Closes scalar data of an input point set by perfoming a dilation followed by the same number of erosions. When the input data array has more than one component, each component is processed separately. 
combineimages  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. 
composedofs  Computes the composition T of the given input transformations such that 
composemaps  Computes the composition g of the given input maps such that 
constructatlas  Construct (spatiotemporal) atlas from images of the same anatomy of different subjects. To construct a spatiotemporal atlas, images of subjects at different ages spread over the atlas time range are required. Please cite the following preprint when you use this command in your research (or the respective peerreviewed article when accepted): Schuh et al., “Unbiased construction of a temporally consistent morphological atlas of neonatal brain development”, bioRxiv, 2018. doi:10.1101/251512 
convertdof  Converts between different transformation file formats: 
convertimage  Converts an image from one voxel type to another. 
convertpointset  Convert point set from one (file) format to another. 
copypointsetattributes  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. This command can also convert from point data to cell data and vice versa. 
cutbrain  Cut input brain volume/mask into left and/or right hemisphere(s). 
decimatesurface  Decimates a (triangular) mesh using VTK’s vtkQuadricDecimation filter.
In case of decimatesurface pro , the vtkDecimatePro filter is used instead. 
deformmesh  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. 
deletepointsetattributes  Delete point data and/or cell data from input point set. 
detectedges  Convolves the input image with an edge detection operator. 
dilateimage  Dilates an input image by replacing a voxel’s value by the maximum of the values of its neighboring voxels. 
dilatescalars  Dilates scalar data of an input point set by replacing a value by the maximum of the adjacent data values. When the input data array has more than one component, each component is processed separately. 
downsampleimage  Downsamples an image using an iterative Gaussian pyramid filter. 
drawem  Runs the DrawEM segmentation at the input image with the provided N probability maps of structures. The main algorithm is outlined in [1]. 
editdof  This tool provides a generic way of modifying the parameters of a transformation (linear as well as nonlinear). 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. 
editimage  Modifies the attributes of an image stored in the header. 
em  Runs EM segmentation at the input image with the provided N probability maps of structures. e.g. em input.nii.gz 5 bg.nii.gz csf.nii.gz gm.nii.gz wm.nii.gz dgm.nii.gz segmentation.nii.gz 
emhardsegmentation  Computes the hard segmentation of the N atlases. Optionally MRF smoothing can be additionally applied. 
erodeimage  Erodes an input image by replacing a voxel’s value by the minimum of the values of its neighboring voxels. 
erodescalars  Erodes scalar data of an input point set by replacing a value by the minimum of the adjacent data values. When the input data array has more than one component, each component is processed separately. 
evaluateatlas  Evaluate (spatiotemporal) atlas sharpness measures. 
evaluatecardiacmotion  Evaluate cardiac motion. This command computes the displacement or strain at each vertex on a myocardial surface mesh. 
evaluatedistance  Evaluate distance between two given point sets. With increased verbosity (see evaluatedistance 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). 
evaluatedistortion  Computes the distortion of a surface mesh under deformation, when mapped to the surface of another solid with equivalent topology, or flattened to the plane or sphere, respectively. 
evaluatedof  Calculates registration transformation quality measures such as the voxelwise cumulative or mean inverseconsistency error (CICE/MICE) for pairs of forward transformation from target to source and backward transformation from source to target image. Another voxelwise 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. 
evaluatejacobian  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. 
evaluateoverlap  Computes the overlap of either two intensity images (average SI)
or two segmentations (see evaluateoverlap label ). If more than one source image
is given, the overlap between each of these and the target is evaluated. 
evaluatesimilarity  Evaluates the (dis)similarity of two intensity images. 
evaluatesurfacemap  Evaluates quantitative quality measures of a surface map. 
evaluatesurfacemesh  Prints surface mesh quality measures and topology information. 
evaluatesurfaceoverlap  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. 
evaluatevolumemap  Evaluates quantitative measures of a surface map or volumetric map such as its harmonic energy. 
extractconnectedcomponents  Extracts connected components from input segmentation label image.
By default, the largest connected component is extracted.
In case of extractconnectedcomponents outputcomponentlabels , the labels
of the components are written instead. 
extractconnectedpoints  Extract (largest) connected components of the input point set. The connected components are sorted by size, where the largest connected component has index 0. 
extractimageregion  Crop/pad image by extracting a region of interest and optionally split the extracted region into separate image files, e.g., individual slices of a volume saved as individual image files. The output image region
is chosen such that it contains the union of all specified axisaligned
rectangular input image regions. In case of extractimageregion 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. 
extractimageslice  No description available. 
extractimagevolume  No description available. 
extractpointsetcells  Extract point set/surface elements which meet the specified criteria. 
extractpointsetsurface  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. 
extractsurface  Extract the isosurface from an intensity image or segmentation. 
fillholes  Fills holes in the input. Note: The code is adapted from fslmaths fillh 
fillholesnnbased  Fills holes in the input. The surrounding voxels of the suspectedholes are measured and if the majority belongs to the input they are filled. 
flipimage  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. To swap the image
axes instead of the origin, use the flipimage axes option before the
swap options. This option should be used to reorder the image dimensions
without changing the world coordinates of the voxels. When swapping of
the coordinate axes is enabled, the coordinates of the image origin are
kept the same, i.e., flipimage origin is ignored. The default behavior
is to swap the image data and the coordinates of the image origin. This
may in many cases not have the desired effect, but has been this way
already for some time. 
helprst  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). 
initdof  This tool either creates a new affine transformation with the given parameters
or approximates an affine transformation or nonrigid deformation given
a set of corresponding landmarks or point displacements (see initdof displacements ). 
invertdof  Inverts any transformation. In case of a nonrigid 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. 
kmeans  Runs kmeans clustering at the input image with the provided K number of classes. e.g. kmeans input.nii.gz 10 output.nii.gz 
matchhistogram  Matches the intensity distribution of the source image to match the distribution of the target image using a piecewise linear function [1]. 
matchpoints  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. 
measurevolume  Measures the volume of each label in the input image 
mergesurfaces  Merge surface meshes at segmentation label boundaries. The input surfaces must follow closely the boundary of a segment in the given image segmentation. Two surfaces are then merged at the longest common intersection boundary. When the two surfaces share no such segmentation boundary, the surfaces are not connected. 
normalize  Normalizes the intensity distribution of an image to be similar to the intensity distribution of a given reference image. Moreover, this tool can be used to equalize the histograms of either a single given image or two images using the same transfer function. 
offsetsurface  Displaces surface mesh points by a given amount along the surface normal to create an offset surface mesh. To prevent selfintersections, 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. 
openimage  Removes small connections between objects by first eroding and then dilating an input image. 
openscalars  Opens scalar data of an input point set by perfoming an erosion followed by the same number of dilations. When the input data array has more than one component, each component is processed separately. 
projectontosurface  Assign scalars or labels to either the vertices or the cells of a surface mesh.
When the input is a realvalued image, the values are linearly interpolated.
When the input is a segmentation 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/GM or GM/CSF boundary, use projectontosurface white or projectontosurface pial . 
reconneonatalcortex  Reconstruct neonatal cortex from MR brain scan and DrawEM segmentation 
reflectimage  Applies a one or more spatial reflections along an image axis. A more generic tool that can also be used to swap two axes is the flipimage command. 
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 MATLABstyle indexing for the individual input files, i.e., 
remeshsurface  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. 
resampleimage  Resamples an image on a lattice with specified voxel size. 
smoothimage  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. 
smoothsurface  Smooths the node positions and/or scalar data of a surface mesh. 
splitlabels  Measures the probability of the different labels in the N label maps <labelmap_1> .. <labelmap_N> according to the weights (maps) <weight_1> .. <weight_N> (based on occurence). It then outputs the probability of the specified R labels <label_1> .. <label_R> to <probmap_1> .. <probmap_R> 
subdividebrainimage  This program reads a structural brain segmentation and derives from it a segmentation of the brain volume into the following output labels. This output segmentation can then be used to reconstruct topologically correct (i.e., closed genus0) surfaces of the cGM/WM interface for the left and right hemisphere, where subcortical and deep brain structures are enclosed by these socalled white surfaces. Additionally, the brainstem+cerebellum segment can be respresented by another closed surface mesh. The union of these reconstructured surfaces encloses the entire brain volume, yet excluding cortical grey matter. By deforming the joint brain surface towards the cGM/CSF interface, the pial surface which encloses the entire brain volume including subcortical structures can be obtained. The right/left hemisphere assignment of cortical grey matter follows from the point correspondences between white and pial surfaces, respectively, the RH/LH label may be assigned to white surface mesh nodes upon merging the right/left white surface meshes. See mergesurfaces sourcearray option. 
transformimage  Applies one or more transformations to an input image. Each voxel center
of the target image is mapped by the composition of the transformations to
the space of the source image. The output intensity for the target voxel is
the source image intensity interpolated at the mapped point and cast to
the output data type. When the input transformation is the identity map,
this command effectively resamples the input image on the finite discrete
grid of the transformimage target image. 
transformpoints  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.