{"id":759,"date":"2026-10-20T14:21:55","date_gmt":"2026-10-20T14:21:55","guid":{"rendered":"https:\/\/ni.cmu.edu\/computing\/?post_type=ht_kb&#038;p=759"},"modified":"2026-10-20T14:35:44","modified_gmt":"2026-10-20T14:35:44","slug":"ants-setup-usage-guide","status":"publish","type":"ht_kb","link":"https:\/\/ni.cmu.edu\/computing\/knowledge-base\/ants-setup-usage-guide\/","title":{"rendered":"ANTs (Advanced Normalization Tools) Setup &#038; Usage Guide"},"content":{"rendered":"<p data-path-to-node=\"7\">This guide details how to configure the cluster-installed version of <b data-path-to-node=\"7\" data-index-in-node=\"69\">ANTs<\/b> in your user environment and how to use <code data-path-to-node=\"7\" data-index-in-node=\"114\">antsApplyTransforms<\/code> to map images and atlases between spatial reference domains (e.g., native T1w space and MNI space).<\/p>\n<h2 data-path-to-node=\"9\">1. System Installation Details<\/h2>\n<p data-path-to-node=\"10\">An updated build of ANTs (v2.5 equivalent, compiled with ITK v6 support) is available centrally on the cluster.<\/p>\n<ul data-path-to-node=\"11\">\n<li>\n<p data-path-to-node=\"11,0,0\"><b data-path-to-node=\"11,0,0\" data-index-in-node=\"0\">Installation Directory:<\/b> <code data-path-to-node=\"11,0,0\" data-index-in-node=\"24\">\/lab_data\/hawk\/ANTs_v20261014\/install\/bin\/<\/code><\/p>\n<\/li>\n<li>\n<p data-path-to-node=\"11,1,0\"><b data-path-to-node=\"11,1,0\" data-index-in-node=\"0\">Version:<\/b> <code data-path-to-node=\"11,1,0\" data-index-in-node=\"9\">2.6.5<\/code> (Compiled with ITK v6)<\/p>\n<\/li>\n<\/ul>\n<h2 data-path-to-node=\"13\">2. Environment Setup<\/h2>\n<p data-path-to-node=\"14\">ANTs is compiled C++ software and runs directly without requiring a Python or Conda environment. Add the binary path directly to your environment variables.<\/p>\n<h3 data-path-to-node=\"15\">Add ANTs to your <code data-path-to-node=\"15\" data-index-in-node=\"17\">~\/.bashrc<\/code><\/h3>\n<p data-path-to-node=\"16\">Run the following commands in your cluster terminal:<\/p>\n<div class=\"code-block ng-tns-c2064491107-216 ng-animate-disabled ng-trigger ng-trigger-codeBlockRevealAnimation\">\n<div class=\"formatted-code-block-internal-container ng-tns-c2064491107-216\">\n<div class=\"animated-opacity ng-tns-c2064491107-216\">\n<div class=\"code-block-decoration header-formatted gds-emphasized-body-m ng-tns-c2064491107-216 ng-star-inserted\">\n<p><span class=\"ng-tns-c2064491107-216\">Bash<\/span><\/p>\n<div class=\"buttons ng-tns-c2064491107-216 ng-star-inserted\"><\/div>\n<\/div>\n<pre class=\"ng-tns-c2064491107-216\"><code class=\"code-container formatted ng-tns-c2064491107-216\" role=\"text\" data-test-id=\"code-content\"><span class=\"hljs-built_in\">echo<\/span> <span class=\"hljs-string\">'export ANTSPATH=\/lab_data\/hawk\/ANTs_v20261014\/install\/bin\/'<\/span> &gt;&gt; ~\/.bashrc\r\n<span class=\"hljs-built_in\">echo<\/span> <span class=\"hljs-string\">'export PATH=${ANTSPATH}:$PATH'<\/span> &gt;&gt; ~\/.bashrc\r\n<span class=\"hljs-built_in\">source<\/span> ~\/.bashrc\r\n<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<h3 data-path-to-node=\"18\">Verify the Installation<\/h3>\n<p data-path-to-node=\"19\">Confirm that the executable is correctly resolved in your <code data-path-to-node=\"19\" data-index-in-node=\"58\">PATH<\/code>:<\/p>\n<div class=\"code-block ng-tns-c2064491107-217 ng-animate-disabled ng-trigger ng-trigger-codeBlockRevealAnimation\">\n<div class=\"formatted-code-block-internal-container ng-tns-c2064491107-217\">\n<div class=\"animated-opacity ng-tns-c2064491107-217\">\n<div class=\"code-block-decoration header-formatted gds-emphasized-body-m ng-tns-c2064491107-217 ng-star-inserted\">\n<p><span class=\"ng-tns-c2064491107-217\">Bash<\/span><\/p>\n<div class=\"buttons ng-tns-c2064491107-217 ng-star-inserted\"><\/div>\n<\/div>\n<pre class=\"ng-tns-c2064491107-217\"><code class=\"code-container formatted ng-tns-c2064491107-217\" role=\"text\" data-test-id=\"code-content\"><span class=\"hljs-built_in\">which<\/span> antsRegistration\r\n<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<p data-path-to-node=\"21\"><b data-path-to-node=\"21\" data-index-in-node=\"0\">Expected Output:<\/b><\/p>\n<div class=\"code-block ng-tns-c2064491107-218 ng-animate-disabled ng-trigger ng-trigger-codeBlockRevealAnimation\">\n<div class=\"formatted-code-block-internal-container ng-tns-c2064491107-218\">\n<div class=\"animated-opacity ng-tns-c2064491107-218\">\n<div class=\"code-block-decoration header-formatted gds-emphasized-body-m ng-tns-c2064491107-218 ng-star-inserted\">\n<p><span class=\"ng-tns-c2064491107-218\">Plaintext<\/span><\/p>\n<div class=\"buttons ng-tns-c2064491107-218 ng-star-inserted\"><\/div>\n<\/div>\n<pre class=\"ng-tns-c2064491107-218\"><code class=\"code-container formatted ng-tns-c2064491107-218\" role=\"text\" data-test-id=\"code-content\">\/lab_data\/hawk\/ANTs_v20261014\/install\/bin\/antsRegistration\r\n<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<h2 data-path-to-node=\"24\">3. Applying Transforms with <code data-path-to-node=\"24\" data-index-in-node=\"28\">antsApplyTransforms<\/code><\/h2>\n<p data-path-to-node=\"25\">Pipelines such as <b data-path-to-node=\"25\" data-index-in-node=\"18\">fMRIPrep<\/b> generate spatial transformation files (<code data-path-to-node=\"25\" data-index-in-node=\"66\">.h5<\/code> or <code data-path-to-node=\"25\" data-index-in-node=\"73\">.txt<\/code>) during preprocessing. You can use <code data-path-to-node=\"25\" data-index-in-node=\"113\">antsApplyTransforms<\/code> to warp images or structural\/functional atlases between spaces.<\/p>\n<h3 data-path-to-node=\"26\">Basic Command Syntax<\/h3>\n<div class=\"code-block ng-tns-c2064491107-219 ng-animate-disabled ng-trigger ng-trigger-codeBlockRevealAnimation\">\n<div class=\"formatted-code-block-internal-container ng-tns-c2064491107-219\">\n<div class=\"animated-opacity ng-tns-c2064491107-219\">\n<div class=\"code-block-decoration header-formatted gds-emphasized-body-m ng-tns-c2064491107-219 ng-star-inserted\">\n<p><span class=\"ng-tns-c2064491107-219\">Bash<\/span><\/p>\n<div class=\"buttons ng-tns-c2064491107-219 ng-star-inserted\"><\/div>\n<\/div>\n<pre class=\"ng-tns-c2064491107-219\"><code class=\"code-container formatted ng-tns-c2064491107-219\" role=\"text\" data-test-id=\"code-content\">antsApplyTransforms \\\r\n  --dimensionality 3 \\\r\n  --input \/path\/to\/input_atlas.nii.gz \\\r\n  --reference-image \/path\/to\/MNI_reference.nii.gz \\\r\n  --output \/path\/to\/output_atlas_in_MNI.nii.gz \\\r\n  --transform \/path\/to\/transform.h5 \\\r\n  --interpolation GenericLabel\r\n<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<h3 data-path-to-node=\"28\">Key Parameter Definitions<\/h3>\n<ul data-path-to-node=\"29\">\n<li>\n<p data-path-to-node=\"29,0,0\"><b data-path-to-node=\"29,0,0\" data-index-in-node=\"0\"><code data-path-to-node=\"29,0,0\" data-index-in-node=\"0\">--dimensionality 3<\/code><\/b>: Specifies 3D image processing.<\/p>\n<\/li>\n<li>\n<p data-path-to-node=\"29,1,0\"><b data-path-to-node=\"29,1,0\" data-index-in-node=\"0\"><code data-path-to-node=\"29,1,0\" data-index-in-node=\"0\">--input<\/code><\/b>: The source image or atlas you wish to transform.<\/p>\n<\/li>\n<li>\n<p data-path-to-node=\"29,2,0\"><b data-path-to-node=\"29,2,0\" data-index-in-node=\"0\"><code data-path-to-node=\"29,2,0\" data-index-in-node=\"0\">--reference-image<\/code><\/b>: The target space image that defines the output grid, dimensions, and resolution (e.g., MNI template reference).<\/p>\n<\/li>\n<li>\n<p data-path-to-node=\"29,3,0\"><b data-path-to-node=\"29,3,0\" data-index-in-node=\"0\"><code data-path-to-node=\"29,3,0\" data-index-in-node=\"0\">--output<\/code><\/b>: The output path for the transformed NIfTI file.<\/p>\n<\/li>\n<li>\n<p data-path-to-node=\"29,4,0\"><b data-path-to-node=\"29,4,0\" data-index-in-node=\"0\"><code data-path-to-node=\"29,4,0\" data-index-in-node=\"0\">--transform<\/code><\/b>: The composite transformation matrix produced by registration pipelines (e.g., fMRIPrep <code data-path-to-node=\"29,4,0\" data-index-in-node=\"100\">from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5<\/code>).<\/p>\n<\/li>\n<\/ul>\n<h2 data-path-to-node=\"31\">4. Interpolation Guidelines<\/h2>\n<p data-path-to-node=\"32\">Choosing the correct interpolation mode is critical to prevent data distortion:<\/p>\n<table data-path-to-node=\"33\">\n<thead>\n<tr>\n<td><strong>Image Type<\/strong><\/td>\n<td><strong>Recommended Interpolation<\/strong><\/td>\n<td><strong>Reason<\/strong><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><span data-path-to-node=\"33,1,0,0\"><b data-path-to-node=\"33,1,0,0\" data-index-in-node=\"0\">Discrete Atlases &amp; Label Masks<\/b><\/span><\/td>\n<td><span data-path-to-node=\"33,1,1,0\"><code data-path-to-node=\"33,1,1,0\" data-index-in-node=\"0\">GenericLabel<\/code> or <code data-path-to-node=\"33,1,1,0\" data-index-in-node=\"16\">NearestNeighbor<\/code><\/span><\/td>\n<td><span data-path-to-node=\"33,1,2,0\">Prevents creation of non-existent label IDs (averaging) between integer region indices.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span data-path-to-node=\"33,2,0,0\"><b data-path-to-node=\"33,2,0,0\" data-index-in-node=\"0\">Continuous Structural \/ Functional Scans<\/b><\/span><\/td>\n<td><span data-path-to-node=\"33,2,1,0\"><code data-path-to-node=\"33,2,1,0\" data-index-in-node=\"0\">Linear<\/code> or <code data-path-to-node=\"33,2,1,0\" data-index-in-node=\"10\">BSpline<\/code><\/span><\/td>\n<td><span data-path-to-node=\"33,2,2,0\">Smoothly interpolates continuous voxel intensities (T1w, T2w, fMRI BOLD).<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 data-path-to-node=\"35\">5. Applying Inverse Transformations<\/h2>\n<p data-path-to-node=\"36\">To map an atlas or mask in reverse (e.g., transforming an atlas from MNI standard space <b data-path-to-node=\"36\" data-index-in-node=\"88\">back into native T1w space<\/b>), invoke the inverse transform syntax by appending <code data-path-to-node=\"36\" data-index-in-node=\"166\">,1<\/code> inside single quotes:<\/p>\n<div class=\"code-block ng-tns-c2064491107-220 ng-animate-disabled ng-trigger ng-trigger-codeBlockRevealAnimation\">\n<div class=\"formatted-code-block-internal-container ng-tns-c2064491107-220\">\n<div class=\"animated-opacity ng-tns-c2064491107-220\">\n<div class=\"code-block-decoration header-formatted gds-emphasized-body-m ng-tns-c2064491107-220 ng-star-inserted\">\n<p><span class=\"ng-tns-c2064491107-220\">Bash<\/span><\/p>\n<div class=\"buttons ng-tns-c2064491107-220 ng-star-inserted\"><\/div>\n<\/div>\n<pre class=\"ng-tns-c2064491107-220\"><code class=\"code-container formatted ng-tns-c2064491107-220\" role=\"text\" data-test-id=\"code-content\">antsApplyTransforms \\\r\n  --dimensionality 3 \\\r\n  --input \/lab_data\/hawk\/resources\/neuroimaging\/atlases\/glasser\/HCP-MMP1_on_MNI152NLin2009cAsym.nii.gz \\\r\n  --reference-image \/path\/to\/sub-01_T1w.nii.gz \\\r\n  --output \/path\/to\/sub-01_glasser_in_native.nii.gz \\\r\n  --transform <span class=\"hljs-string\">'[\/path\/to\/from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5,1]'<\/span> \\\r\n  --interpolation GenericLabel\r\n<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<blockquote data-path-to-node=\"38\">\n<p data-path-to-node=\"38,0\"><b data-path-to-node=\"38,0\" data-index-in-node=\"0\">Note:<\/b> Inverse transformations require a composite transform file that supports inversion. Ensure the transform direction matches your source and target spaces.<\/p>\n<\/blockquote>\n<h2 data-path-to-node=\"40\">Related Knowledge Base Articles<\/h2>\n<ul data-path-to-node=\"41\">\n<li>\n<p data-path-to-node=\"41,0,0\"><a class=\"ng-star-inserted\" href=\"https:\/\/ni.cmu.edu\/computing\/knowledge-base\/shared-neuroimaging-resources-guide-templates-atlases\/\" target=\"_blank\" rel=\"noopener\">Shared Neuroimaging Resources: Templates &amp; Atlases<\/a><\/p>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>This guide details how to configure the cluster-installed version of ANTs in your user environment and how to use antsApplyTransforms to map images and atlases between spatial reference domains (e.g., native T1w space and MNI space). 1. System Installation Details An updated build of ANTs (v2.5 equivalent, compiled with ITK&#8230;<\/p>\n","protected":false},"author":1,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[11],"ht-kb-tag":[],"class_list":["post-759","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-software"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/ht-kb\/759","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/comments?post=759"}],"version-history":[{"count":5,"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/ht-kb\/759\/revisions"}],"predecessor-version":[{"id":767,"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/ht-kb\/759\/revisions\/767"}],"wp:attachment":[{"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/media?parent=759"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/ht-kb-category?post=759"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/ht-kb-tag?post=759"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}