FastWarp#

FastWarp registers 3-D images on the GPU. It runs the rigid, affine and SyN registration of ANTs on a graphics card and writes the same transform files as ANTs, so the rest of an ANTs-based pipeline can stay as it is.

FastWarp is a Python package with a compiled Rust engine. It is meant for people who build or run neuroimaging pipelines, for example to normalize brain MRI onto a template, and who use ANTs for that today.

Three axial brain slices: the MNI template; a checkerboard of the template and a subject's scan before registration, with edges that do not line up; and the same checkerboard after registration, with continuous edges.
Template (fixed image)Before: template and subject in a checkerboardAfter FastWarp

A 7 T scan of one subject of the public SNSX dataset registered onto the MNI 2009c template with the default settings (how the figure is made).

What it does
  • A full normalization in one call: centre of mass, Rigid, Affine, then SyN.

  • Rigid or affine fits of one image pair, several in a row on images prepared once.

  • Resampling and field composition like ANTs’ antsApplyTransforms, on the CPU.

  • A command line, fastwarp, for the same steps on NIfTI files.

What it works with
  • GPUs through wgpu: Vulkan (Linux, Windows), Metal (macOS) and DirectX 12 (Windows).

  • Python 3.11 or later and NumPy 2.0 or later. ANTsPy is optional.

  • Transform files that ANTs and ANTsPy read, such as Composite.h5.

import ants
import fastwarp

fixed = ants.image_read(ants.get_ants_data("mni"))
moving = ants.image_read(ants.get_ants_data("ch2"))

info = fastwarp.register_syn(fixed, moving, "out/ch2_to_mni_")
warped = ants.apply_transforms(fixed, moving, ["out/ch2_to_mni_Composite.h5"])

Where to go next#

Installation

Install the wheel from PyPI, check that FastWarp finds your GPU, or build from source.

Installation
Quickstart

Register one brain image onto a template with public sample data.

Quickstart
User guide

How it works, images, output files, recipes, linear fits, resampling and GPU memory.

User guide
API reference

Every public function, class, constant and exception, with its parameters.

API reference
Performance and validation

How speed and accuracy are measured against ANTs, and what the tests check today.

Performance and validation
Troubleshooting

No GPU found, too little GPU memory, and why results differ slightly from ANTs.

Troubleshooting

FastWarp is research software, licensed under the Apache License 2.0 and maintained by Richard Köhler and Jan Philipp Payonk. If you use it in your work, please cite it.