Repository navigation
0.2.0 (2026-11-15)
-
ANTs compatibility mode:
fastwarp ants-registration ARGS...and
fastwarp ants-apply-transforms ARGS...take the arguments ofantsRegistrationand
antsApplyTransforms(ANTs 2.6.5), run the subset FastWarp supports and write the files ANTs
writes under ANTs' names:0GenericAffine.mat,1Warp.nii.gz,1InverseWarp.nii.gz(or
0Warp.nii.gzfor SyN without-r),Composite.h5/InverseComposite.h5alone with-a 1,
and the warped and inverse-warped images of-o [prefix,warped,inverseWarped]on the native
grids. Supported: any Rigid / Affine stages with Mattes MI (regular sampling, 32 bins), then
at most one SyN stage with one or two CC metrics;-r [f,m,1],Identityor an affine file;
fixed masks on linear stages;-w;--random-seedandANTS_RANDOM_SEED; both stage-option
orders and brackets split over shell words. Warped images and fields arefloat64, or
float32with--float 1, as in ANTs. Everything that would change the result and is not
supported (MI in SyN, dense or random MI sampling,-z 0, histogram matching, SyN masks,
moving masks, other transforms, metrics and interpolators, ...) is refused with exit status 2
and the reason, before the GPU is opened;ants-apply-transformsaccepts-z,--time-index
and-uwith a transform output, which change nothing, with a warning.
The compatibility mode is reached only through these subcommands, never by the program's name.
The registration grid is the fixed image's smallest spacing; with an anisotropic fixed image the
warp fields are resampled onto the fixed image's grid, where ANTs writes them, so the result
differs a little more from ANTs' there (about 1 mm at the corners of the field of view in the
tests, against 0.06 to 0.5 mm for an isotropic one). Stage options are assigned to stages as
ANTs assigns them. Integer-uoutputs ofants-apply-transformswrap as in ANTs. The parsers
are pure functions (fastwarp_cli::ants::parse_registration/parse_apply, and
resolve_seedfor--random-seed/ANTS_RANDOM_SEED) that return the plan, its recipe and
its output files; the Python layerfastwarp.antsruns them through the same code. See
docs/cli.md. -
Linear stages skip a level whose sample points leave Mattes mutual information undefined
(no point on the fixed image, or one fixed value only; typical for a coarse level of a small
image or a small mask) and continue with the finer levels, with a warning: on standard error
in the command line (register,linear,ants-registration), and as aUserWarningin
Python, also listed under"warnings"in the results ofregister_synand
LinearSession.register(the result offastwarp.ants.registrationkeeps ANTsPy's keys).
ANTs 2.6.5 drops the whole stage in that case without an error.
When every level of a stage is skipped, the run fails and the message names the levels, their
shrink factors, the candidate counts and the remedies. -
fastwarp.ants: ANTsPy'sants.registrationandants.apply_transforms(ANTsPy 0.6.3) with
their arguments and results, for the part FastWarp supports. Each call builds the argument list
ANTsPy builds (compared token for token in the tests) and runs it with the ANTs compatibility
mode, the same code asfastwarp ants-registration/ants-apply-transforms, with the
ANTsImages handed over in memory. RunsRigid,Affine,AffineFast,BOLDAffine,
QuickRigid,DenseRigid,BOLDRigid,SyNCC,SyNabp,antsRegistrationSyN[r|a|s|sr|so],
antsRegistrationSyNQuick[r|a], andSyN,SyNRA,SyNOnly,SyNAggro,SyNLessAggro,
ElasticSyN,SyNBold,SyNBoldAffwithsyn_metric="CC". ANTsPy's default"SyN"(Mattes
mutual information in SyN), Translation, Similarity, BSplineSyN, GC, time-varying and other
unsupported arguments (SyN masks, moving masks, histogram matching, other interpolators, ...)
raisefastwarp.ants.UnsupportedArgument(aValueError) before any work; arguments ANTsPy
ignores for a type are ignored with aUserWarning; unknown keyword arguments raise
TypeError. The result dict has ANTsPy's keys, warped images on the native grids with the
fixed image's pixel type, and the transform lists in ANTsPy's order. Keyword-only additions:
iso_mm(default: the fixed image's smallest spacing),adapter,canceland
fallback="ants", which runs ANTsPy instead after a refusal, without a GPU or when the
registration does not fit, with a warning and an"engine"key in the result. A raw argument
list,registration([...], None), runs as the subcommand does.outprefix=""makes a private
temporary folder instead of ANTsPy'stempfile.mktempname. ANTsPy is needed at call time
only. Seedocs/guide/ants.md. -
Stage lists:
register_syn(recipe={"initial": ..., "stages": [...]})runs any number of
Rigid / Affine stages followed by at most one SyN stage (SyN alone is allowed), from the centres
of mass ("com", the default), the identity ("identity"), one affine from a.mat/.txt
file (optionally inverted) or given parameters. Without a SyN stage the composites hold only the
affine, as ANTs writes them. The capacity check (inregister_syn,fits_gpu(recipe=...)and
fastwarp fits --recipe) covers every stage: a linear-only chain is checked against the memory
its sample buffers need, not the SyN stage's, and a chain with both is refused when the larger
of the two phases does not fit. A relative path of the start file is read from the current
folder in Python and from the recipe file's folder infastwarp register --recipe.Nonefor
initialorstagesmeans the default. The existing recipe form keeps working and gives
bit-identical outputs. The result dict addsinitial_parameters,initial_center,
linear_stages,deformableandfiles. -
The recipe key
"winsorize":[lower, upper]quantiles (default[0.005, 0.995], as before) or
Nonefor ANTs' plain rescale to [0, 1], whatantsRegistration(and every ANTsPy call) does
without--winsorize-image-intensities.LinearSession(winsorize=None)is unchanged: it uses
the intensities without any rescale;winsorize=(0.0, 1.0)is ANTs' default preprocessing. -
register_syn(outputs="split" | "both")(fastwarp register --outputs) writes ANTs'
non-composite files0GenericAffine.mat,1Warp.nii.gz,1InverseWarp.nii.gz; the fields are
float32(ANTs writesfloat64). -
apply_transforms(..., invert=[...])andcompose_field(..., invert=[...]), ANTsPy's
whichtoinvert(one flag per transform), andfastwarp apply/compose -t [file,1], as
antsApplyTransforms -t [file,1]: a linear transform is replaced by its inverse in place.
Inverting a displacement field raisesValueError(exit status 2) instead of ANTs' silent exit 1.
fastwarp apply/composeandcompose_fieldread and check the transforms before they load
an image or create the output folder. -
A command line,
fastwarp(alsopython -m fastwarp), for NIfTI files:register
(register_syn),linear(one rigid or affine fit),apply(apply_transforms),compose
(compose_field),recipe(the default recipe as JSON),gpu-info,fitsandbench(timings
on built-in synthetic volumes or on your images, with a description of the machine). Images are
read as ITK and ANTsPy read them. Distinct exit status for invalid arguments (2), file errors (3),
no usable GPU (4) and a grid too large for the GPU (5);--jsonfor machine-readable output.
An internal error prints one line and exits with status 1; Rust's panic message is shown only
whenRUST_BACKTRACEis set to a value other than 0.registerandlinearread their input images before they create
the output folder. Seedocs/cli.md. The Python extension and the standalone program built from the new crate
fastwarp-clirun the same code. -
Each GitHub release carries the standalone
fastwarpprogram, which needs no Python, for Linux
x86_64 and aarch64 (glibc 2.28 or later), macOS arm64 and x86_64 (macOS 11 or later) and Windows
x86_64 (static C runtime), asfastwarp-<target>.tar.gz/.zipwith a.sha256file each,
and the installer scriptsfastwarp-installer.sh(Linux, macOS) andfastwarp-installer.ps1
(Windows). The installer of a release installs that release and holds the SHA-256 of its
archives, so it refuses a download that does not match. It installs without administrator
rights into~/.local/bin(Windows:%LOCALAPPDATA%\Programs\fastwarp\bin), adds that folder
to PATH unless told not to (--no-modify-path,-NoModifyPath), and records what it did in a
receipt next to the program;--uninstall(-Uninstall) undoes exactly that and leaves alone a
fastwarpit did not install. Every release file has a GitHub build provenance attestation
(gh attestation verify). Seedocs/cli.md. -
fits_gputakes the moving image(s) as an optional second argument and checks the moving grid
asregister_syndoes; without it a moving image larger than the fixed one could pass
fits_gpuand still raiseGpuCapacityError.channelsdefaults to the number of fixed
images, and invalid arguments (image counts,channelsother than 1 or 2,iso_mm) raise
ValueErroras inregister_syninstead of returning a result. -
The benchmark (
benchmarks/accuracy) now also measures speed in the same run, on the same
public data: every registration records its Linear, SyN and total time for FastWarp and for
ANTs (read fromantsRegistration --verbose 1);lineartimeslinear_sessionfits
(rigid, affine, a rigid multi-start) againstantsRegistrationwith the same stages, with
their landmark errors;posttimescompose_fieldandapply_transformsagainst
antsApplyTransformson uncompressed outputs (--gzipadds.nii.gz).reporttabulates
the median and quartiles of each, per dataset and registration grid, with the machine and
software they ran on (CPU, GPU and its driver name, OS, fastwarp and ANTs versions, the thread
setting and core counts of each command). Both engines use all cores unless--threads
caps both alike, and the benchmark no longer leavesITK_GLOBAL_DEFAULT_NUMBER_OF_THREADSset
in the calling process. -
docs/performance.mdexplains how the speed is measured and how to reproduce it; the
earlier figures, measured on non-public data, are labelled as such with what is known about
them. -
An accuracy benchmark that reviewers can run (
benchmarks/accuracy,docs/benchmarks.md):
FastWarp and ANTs register the same pairs with the same recipe on public data with manual
cortical, subcortical and deep-nuclei labels and anatomical fiducials; every download is checked
against a pinned SHA-256. Abenchmarkdependency group adds SciPy and Matplotlib (already
locked as ANTsPy dependencies). No results yet. -
README badges: CI, PyPI version, Python versions, licence, documentation.
-
The documentation is reworked: the PyData Sphinx theme with light and dark modes, a user guide
in short pages (how it works, images, normalization, output files and the direction each one
maps, recipes with the type, unit and limits of every field, linear fits, resampling, GPU
memory, limitations), troubleshooting, a glossary, reference pages for the API, the
environment variables and the errors, and project pages for citing, security, the code of
conduct and related projects. The README is shorter and links into it. The API reference moved
fromapi/index.htmltoapi.html. -
The docstrings of the public API are rewritten in NumPy style, with parameters, defaults,
units, return values and the exceptions each function raises. -
dir(fastwarp)lists only the public API (__all__); the implementation moved to the private
modulefastwarp._api, and the public Python functions reportfastwarpas their module. -
LinearSession.registercreates the folder ofout_prefix, asregister_synand
register_rigiddo. -
An
out_prefixthat ends in a path separator (/, and on Windows also\) names a folder, as
in ANTs:register_syn(..., out_prefix="out/sub/")writesout/sub/Composite.h5(was
out/subComposite.h5), and the folderout/subis created. The same holds for
LinearSession.registerand the deprecatedregister_rigid(#28). A prefix of.or..is
text too, as in ANTs (.gives.Composite.h5): use./for the current folder. Breaking for
Rust callers of the engine cratefastwarp-reg:transform::ants_io::with_suffix(and so
write_outputs,write_linear_outputandwrite_composite_pair/read_composite_pair)
appends the suffix to the prefix as text instead of to its file name, andfastwarp_reg_syn --outfollows the same rule. -
GpuCapacityError,GpuUnavailableError,RegistrationCancelledandRegistrationError
reportfastwarpas their module (was_core, which cannot be imported), so they pickle and
cross process boundaries, for example from aconcurrent.futures.ProcessPoolExecutorworker.
gpu_inforeportsfastwarpas well (#26). -
The GPU capacity check (
fits_gpu,fastwarp fitsand the check beforeregister_syn) no
longer underestimates small grids: it now counts the buffers the coarser SyN levels and the
device self-test leave allocated, which the finest level's bytes per voxel missed (on a
48 x 48 x 48 grid the check planned 18.6 MB for a run that peaked at 20.9 MB). Small grids near
the budget can now be refused where they passed before; on a 1 mm head the figure grows by
under 2%. Its error now reads "the SyN stage on the registration grid ... needs ... bytes".
Deprecated
register_rigid,rigid_sessionandRigidSessionstill work but emit aDeprecationWarning
and will be removed in fastwarp 0.3.0; uselinear_session(...).register(),
linear_sessionandLinearSession. They are no longer infastwarp.__all__ordir(fastwarp).
Install the standalone fastwarp program, check a download and verify its provenance: https://github.com/WyssCenter/fastwarp/blob/v0.2.0/docs/cli.md#install