ANTSREGISTRATION(1)
π ANTSREGISTRATION(1) π
Okay bestie, this is the manual page for antsRegistration, filed under User Commands in section 1 π¦ Let's get into it!
β¨ NAME β¨
antsRegistration, part of the ANTS registration suite π
π DESCRIPTION π
πΈ COMMAND:
antsRegistration
Okay so this is a user-level registration app, and it's built on the classes in ITK v4.0 and later π You can set up any number of "stages." Each stage is a transform, plus an image metric, plus iterations, shrink factors, and smoothing sigmas for every level. It's giving customization π
β οΈ Mandatory, no cap: you have to explicitly set the dimensionality, metric, transform, output, convergence, shrink-factors, and smoothing-sigmas parameters. No skipping these!
π OPTIONS:
--versionβ Gets your version info β¨-d,--dimensionality2/3/4β This forces the image to be treated as an image of the dimensionality you pick π¦ If you don't set it, we try to figure it out from the input image.-o,--outputoutputTransformPrefixβ Here's where you set the output transform prefix (the output format is.nii.gzπ). You can also warp the moving image into the fixed space, and if the inverse transform exists, you can output the warped fixed image too. Heads up: only the images from the first metric call get warped. For everything else, useantsApplyTransformswith the resulting transform(s) π«Ά Also, when you don't specify a composite transform, linear transforms get a.matsuffix and displacement fields get aWarp.nii.gzsuffix (plusInverseWarp.nii.gzwhen that applies). For velocity-based transforms, the full velocity field gets written toVelocityField.nii.gzas long as the collapse transforms flag is off (-z 0) π
[outputTransformPrefix,<outputWarpedImage>,<outputInverseWarpedImage>]
-j,--save-statesaveStateAsTransformβ This saves the current state of the registration to a file π It's especially useful when you want to save the state of a SyN registration to disk, so you can load and restore it later and keep going from where you left off. The file is written as an hdf5 composite file. It's the same as the write-composite-transform output, except when the last transform is a SyN transform. In that case, the inverse displacement field of the SyN transform gets added to the output composite transform too. Also, this file isn't a transform, so you have to load it back in with the restore-state option π-k,--restore-staterestoreStateAsATransformβ This sets the initial state of the registration, and it gets used right away to start the registration process π§ This flag can't be combined with other initialization flags. If you use it, you can't use the initial-moving-transform or the initial-fixed-transform either π-a,--write-composite-transform1/(0)β This is a yes-or-no flag for whether the composite transform (plus its inverse, if there is one) gets written to an hdf5 composite file. It's off by default, so only each stage's transform gets written to file π Values:0-p,--print-similarity-measure-interval<unsignedIntegerValue>β This prints the CC similarity metric between the full-size input fixed image and the transformed moving image at each iteration π A value of0(the default) means the full-scale computation doesn't happen. Any value above0sets the interval for full-scale metric computation πΈ Values:0--write-interval-volumes<unsignedIntegerValue>β This writes out the output volume at each iteration, so you can turn the whole registration into a short movie π¬ A value of0(the default) means this option doesn't do anything. Any value above0sets the interval between iterations whose outputs get written to disk π©· Values:0-z,--collapse-output-transforms(1)/0β This collapses output transforms, which means it combines all the adjacent transforms wherever it can π§ All adjacent linear transforms get written to disk as an ITK affine transform calledxxxGenericAffine.mat. Adjacent displacement field transforms get combined too when they're written, likexxxWarp.nii.gzandxxxInverseWarp.nii.gz(if that one exists). Plus, an output composite transform that includes the collapsed transforms gets written to disk, calledoutputCollapsed(Inverse)Compositeπ Values:1-i,--initialize-transforms-per-stage(1)/0β This initializes linear transforms from the previous stage π¦ When it's on, the current linear stage's transform is initialized straight from the previous stage's linear transform. That means you can run multiple linear stages, where each one keeps refining the estimated linear transform from the stage before it, likeTranslation -> Rigid -> Affineβ¨ Values:0-n,--interpolationLinearβ Here are the interpolation options. ITK offers a bunch of them and they've all been made available π Right now, the interpolator choice only gets used to warp (and possibly inverse warp) the final output image(s), so keep that in mind π«Ά
Linear
NearestNeighbor MultiLabel[<sigma=imageSpacing>,<alpha=4.0>]
Gaussian[<sigma=imageSpacing>,<alpha=1.0>] BSpline[<order=3>]
CosineWindowedSinc WelchWindowedSinc HammingWindowedSinc
LanczosWindowedSinc GenericLabel[<interpolator=Linear>]
-g,--restrict-deformationPxQxRβ This lets you restrict the optimization of the displacement field, translation, rigid, or affine transform on a per-component basis π For example, if you want to limit the deformation or rotation of a 3-D volume to its first two dimensions, you can give a weight vector of1x1x0for a deformation field, or1x1x0x1x1x0for a rigid transformation. Heads up: low-dimensional restriction only works when there are no preceding transformations. Also, every stage up to and including the one you want must have this option set, even the stages you don't want restricted (for those, specify1x1x1...) π-q,--initial-fixed-transforminitialTransformβ This sets the initial fixed transform(s), which get folded into the composite transform right away π The order is stack-esque, so the last transform you list on the command line is the first one applied π₯ Besides ITK transforms, you can also do an initial translation alignment by giving the fixed and moving images plus an initialization feature. The features are the geometric center of the images (=0), the image intensities (=1), or the origin of the images (=2) π§
initialTransform
[initialTransform,<useInverse>]
[fixedImage,movingImage,initializationFeature]
-r,--initial-moving-transforminitialTransformβ This sets the initial moving transform(s), which get folded into the composite transform right away πΈ Same deal as the fixed one: the order is stack-esque, so the last transform on the command line is applied first π₯ You can also do an initial translation alignment with fixed and moving images plus an initialization feature, using the geometric center (=0), the image intensities (=1), or the origin (=2) π¦
initialTransform
[initialTransform,<useInverse>]
[fixedImage,movingImage,initializationFeature]
-m,--metricβ These are the image metrics you can use, and the list is long, so take a deep breath π The image metrics are CC (ANTS neighborhood cross correlation), MI (mutual information), Demons (Thirion), MeanSquares, and GC (Global Correlation). ThemetricWeightvalue lets you tune how much each metric counts per stage βοΈ The metrics can also use a sampling strategy, defined by a sampling percentage. The sampling strategy defaults toNone, which is dense sampling of one sample per voxel. Otherwise, it defines a point set to optimize the metric over. That point set can sit on a regular lattice, or a random lattice of points that's slightly perturbed to cut down on aliasing artifacts πsamplingPercentageis the fraction of points to pick from the domain.useGradientFilterdecides whether a smoothing filter gets applied when the metric gradient is estimated π«§ There are also three point set metrics: Euclidean (ICP), Point-set expectation (PSE), and Jensen-Havrda-Charvet-Tsallis (JHCT) π
CC[fixedImage,movingImage,metricWeight,radius,<samplingStrategy={None,Regular,Random}>,<samplingPercentage=[0,1]>,<useGradientFilter=false>]
MI[fixedImage,movingImage,metricWeight,numberOfBins,<samplingStrategy={None,Regular,Random}>,<samplingPercentage=[0,1]>,<useGradientFilter=false>]
Mattes[fixedImage,movingImage,metricWeight,numberOfBins,<samplingStrategy={None,Regular,Random}>,<samplingPercentage=[0,1]>,<useGradientFilter=false>]
MeanSquares[fixedImage,movingImage,metricWeight,radius=NA,<samplingStrategy={None,Regular,Random}>,<samplingPercentage=[0,1]>,<useGradientFilter=false>]
Demons[fixedImage,movingImage,metricWeight,radius=NA,<samplingStrategy={None,Regular,Random}>,<samplingPercentage=[0,1]>,<useGradientFilter=false>]
GC[fixedImage,movingImage,metricWeight,radius=NA,<samplingStrategy={None,Regular,Random}>,<samplingPercentage=[0,1]>,<useGradientFilter=false>]
ICP[fixedPointSet,movingPointSet,metricWeight,<samplingPercentage=[0,1]>,<boundaryPointsOnly=0>]
PSE[fixedPointSet,movingPointSet,metricWeight,<samplingPercentage=[0,1]>,<boundaryPointsOnly=0>,<pointSetSigma=1>,<kNeighborhood=50>]
JHCT[fixedPointSet,movingPointSet,metricWeight,<samplingPercentage=[0,1]>,<boundaryPointsOnly=0>,<pointSetSigma=1>,<kNeighborhood=50>,<alpha=1.1>,<useAnisotropicCovariances=1>]
IGDM[fixedImage,movingImage,metricWeight,fixedMask,movingMask,<neighborhoodRadius=0x0>,<intensitySigma=0>,<distanceSigma=0>,<kNeighborhood=1>,<gradientSigma=1>]
-t,--transformβ pick your transform, the big boss of registration π¦ The list below is every option, exactly as they're spelled. Each one has its own arguments, and thegradientStep(orlearningRate) sets how the gradient descent optimization behaves. That value gets scaled properly for each transform by the shift scales estimator, so you don't have to babysit it. The stuff after that is transform-specific, and you can figure it out from the usage. For the B-spline transforms you can also set smoothing by spline distance (aka knot spacing) π§
Rigid[gradientStep]
Affine[gradientStep] CompositeAffine[gradientStep]
Similarity[gradientStep] Translation[gradientStep]
BSpline[gradientStep,meshSizeAtBaseLevel]
GaussianDisplacementField[gradientStep,updateFieldVarianceInVoxelSpace,totalFieldVarianceInVoxelSpace]
BSplineDisplacementField[gradientStep,updateFieldMeshSizeAtBaseLevel,<totalFieldMeshSizeAtBaseLevel=0>,<splineOrder=3>]
TimeVaryingVelocityField[gradientStep,numberOfTimeIndices,updateFieldVarianceInVoxelSpace,updateFieldTimeVariance,totalFieldVarianceInVoxelSpace,totalFieldTimeVariance]
TimeVaryingBSplineVelocityField[gradientStep,velocityFieldMeshSize,<numberOfTimePointSamples=4>,<splineOrder=3>]
SyN[gradientStep,<updateFieldVarianceInVoxelSpace=3>,<totalFieldVarianceInVoxelSpace=0>]
BSplineSyN[gradientStep,updateFieldMeshSizeAtBaseLevel,<totalFieldMeshSizeAtBaseLevel=0>,<splineOrder=3>]
Exponential[gradientStep,updateFieldVarianceInVoxelSpace,velocityFieldVarianceInVoxelSpace,<numberOfIntegrationSteps>]
BSplineExponential[gradientStep,updateFieldMeshSizeAtBaseLevel,<velocityFieldMeshSizeAtBaseLevel=0>,<numberOfIntegrationSteps>,<splineOrder=3>]
-c,--convergenceMxNxOβ convergence check time! π The value isMxNxO, which is[MxNxO,<convergenceThreshold=1e-6>,<convergenceWindowSize=10>]. Convergence is figured out from how many iterations happen per level. ANTs fits a line to the normalized energy profile of the last N iterations (N is your window size), takes the slope, and compares it to the convergence threshold π-s,--smoothing-sigmasMxNxO...β set the gaussian smoothing sigma for each level πΈ You can pick units: voxels ('vox') or physical spacing ('mm'). Examples are'4x2x1mm'and'4x2x1vox'. No unit at all means voxel spacing β¨-f,--shrink-factorsMxNxO...β set the shrink factor for the virtual domain (usually the fixed image) at each level π-u,--use-histogram-matchingβ histogram match the images before registration, so they match up nicely first π«Ά-w,--winsorize-image-intensities[lowerQuantile,upperQuantile]β winsorize the data using the quantiles you give it π-x,--masks[fixedImageMask,movingImageMask]β image masks that limit which voxels the metric looks at π You get two choices here. Either you give one mask and it's used for every stage, or you give a mask for each stage. With per-stage masks you pick which stages get masks by supplying valid file names. If a file doesn't exist, that stage just goes without a mask. Also, the fixed and moving masks get handled separately, and that's how this rule is enforced π₯--floatβ use'float'instead of'double'for computations. Lighter, but make sure that's what you want π--mincβ use MINC file formats for transformations π¦<VALUES>: 0--random-seedseedValueβ use a fixed seed for random number generation π By default the system clock sets up the seeding. Your fixed seed can be any nonzero int value β-v,--verbose(0)/1β verbose output, so you can see everything it's doing π-hβ print the help menu (short version) π--helpβ print the full help menu. It'll also print the values used on your current command line call, which is very helpful when you forget what you typed π<VALUES>: 1
Okay bestie that's the whole page π This one is from antsRegistration 2.6.4+dfsg, dated December 2025 πΈ Go register some images and slay β¨π«Ά
π¦ 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