WARPIMAGEMULTITRANSFORM(1)
β¨ NAME β¨
Okay bestie, meet WarpImageMultiTransform π¦, a user command (manual section 1) that's part of the ANTS registration suite. It's giving image-warping royalty π.
β¨ DESCRIPTION β¨
π Usage
Here's the basic vibe:
WarpImageMultiTransform ImageDimension moving_image output_image -R
reference_image --use-NN SeriesOfTransformations--(See Below)
π SeriesOfTransformations
This is where the magic happens β¨. WarpImageMultiTransform can chain together an unlimited number of transformations on your data (concatenation, bestie!). So you could do an affine transform, then a warp, then another affine, then another warp. Iconic, honestly π₯.
Inverse affine transforms get called with -i MyAffine.txt.
Inverse warps get called by passing the InverseWarp.nii.gz filename. Peep the important notes at the bottom about this π.
π§ Example 1: Warped into the reference_image domain
Mapping a warped image into the reference_image domain by applying abcdWarp.nii.gz and then abcdAffine.txt:
WarpImageMultiTransform 3 moving_image output_image -R reference_image
abcdWarp.nii.gz abcdAffine.txt
π Example 2: Back into the moving_image domain
To map the fixed/reference_image (warped) into the moving_image domain, you apply the inverse of abcdAffine.txt and then abcdInverseWarp.nii.gz:
WarpImageMultiTransform 3 reference_image output_image -R moving_image
-i abcdAffine.txt abcdInverseWarp.nii.gz
Heads up! The inverse maps from Example 2 get passed in the reverse order of the forward maps from Example 1. Geometrically that totally makes sense π€. Check out ANTS.pdf for a visual of this syntax.
π«Ά Compulsory arguments
ImageDimensionβ2or3, for 2D or 3D registration.moving_imageβ the image you want to apply the transformation to.output_imageβ the resulting image.
πΈ Optional arguments
-Rβ thereference_imagespace you want to warp INTO.--tightest-bounding-boxβ figures out the tightest bounding box using all the affine transforms. If you pass-R reference_image, that overrides it.--reslice-by-headerβ same as-i -mh, or-fh -i -mhif you pair it with-R. It uses the orientation matrix and origin stored in the image file header. It can be used together with-R, but it's typically not used with any other transforms.--use-NNβ nearest neighbor interpolation.--use-BSplineβ 3rd order B-Spline interpolation.--use-ML sigmaβ anti-aliasing interpolation for multi-label images, with Gaussian smoothing at standard deviationsigma. Sigma can be in physical or voxel units, just like Convert3D. It can be a scalar or a vector.- Examples:
--use-ML 0.4mm -use-ML 0.8x0.8x0.8vox
- Examples:
-iβ uses the inverse of the affine transform that follows it.
π Other example usages
Reslice the image:
WarpImageMultiTransform 3 Imov.nii.gz Iout.nii.gz --tightest-bounding-box --reslice-by-header
Reslice the image to a reference image:
WarpImageMultiTransform 3 Imov.nii.gz Iout.nii.gz -R Iref.nii.gz --tightest-bounding-box --reslice-by-header
π Important notes
- A prefix name like
abcdwith no extension will use.nii.gzby default. - The
abcdWarpandabcdInverseWarpfiles don't actually exist. They're formed fromabcd(Inverse)Warp.nii.gzwhen you callWarpImageMultiTransform, but you still have to use them as if they exist π.
That's a wrap, bestie! π Version 2.6.4... from December 2025, go slay those registrations ππ«Ά
π¦ where this page comes from
- ubuntu resolute: ants 2.6.4+dfsg-1 Β· BSD-3-Clause
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms