Registry / ai-ml / itk-registration

itk-registration

JSON →
library5.4.6pypypi✓ verified 84d ago

The ITK Registration module provides algorithms for image registration, including rigid, affine, deformable (BSpline, Demons), and groupwise methods. This Python package wraps the ITK C++ registration framework. Current version 5.4.6, with a stable release cadence.

pip install itk-registration
INSTALL
IMPORT
SIG · ITK-REGISTRATION
I
itk-registration
ai-mlpythonv5.4.6
Install
16.9s avg
Import
546ms
Disk
1434MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v5.4.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 16.9s · import 0.546s · 1433.6MB
1434MB installed
● package 1434MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

itk
import itk
import itkRegistration
All modules are accessed via the 'itk' package.

Basic affine registration of 2D images using MeanSquares metric.

import itk # Define image types PixelType = itk.ctype('float') FixedDimension = 2 MovingDimension = 2 FixedImageType = itk.Image[PixelType, FixedDimension] MovingImageType = itk.Image[PixelType, MovingDimension] # Read images fixed_image = itk.imread('fixed_image.nii', PixelType) moving_image = itk.imread('moving_image.nii', PixelType) # Set up registration RegistrationType = itk.ImageRegistrationMethod[FixedImageType, MovingImageType] registration = RegistrationType.New() registration.SetFixedImage(fixed_image) registration.SetMovingImage(moving_image) # Set metric (e.g., MeanSquares) metric = itk.MeanSquaresImageToImageMetric[FixedImageType, MovingImageType].New() registration.SetMetric(metric) # Set transform (e.g., Affine) transform = itk.AffineTransform[itk.D, 2].New() registration.SetInitialTransform(transform) # Set optimizer optimizer = itk.RegularStepGradientDescentOptimizerv4.New() registration.SetOptimizer(optimizer) # Set interpolator interpolator = itk.LinearInterpolateImageFunction[MovingImageType, itk.D].New() registration.SetInterpolator(interpolator) # Run registration registration.Update() # Get result result = registration.GetOutput() itk.imwrite(result, 'registered_image.nii')
Debug
Known issues
gotchaWhen using itk.imread, specify the pixel type explicitly with a numeric value or itk.ctype('float'). Default is itk.ctype('float') but be consistent with template types.
fix
Use PixelType = itk.ctype('float') and itk.imread('image.nii', PixelType).
affects: >=5.0.0
gotchaImageRegistrationMethod templates require both FixedImageType and MovingImageType. The types must match the actual image dimensions and pixel type.
fix
Define FixedImageType and MovingImageType with correct dimensions (e.g., itk.Image[itk.F, 3] for 3D float).
affects: >=5.0.0
deprecatedThe 'itk.ImageRegistrationMethod' (v4 style) is still available but ITK v6 introduces a new registration framework. Users should migrate to the new API once stable.
fix
Monitor https://discourse.itk.org for migration guides to ITK 6 registration.
affects: 5.x
Errors
Common errors & fixes
NameError: name 'FixedImageType' is not defined
Forgot to define the image type before using it in registration templates.
fix
Define FixedImageType = itk.Image[itk.F, 2] (or itk.D) before creating the registration object.
RuntimeError: Exception thrown in SimpleITK ImageRegistrationMethod_New
Mismatch between template types and actual image dimensions or pixel type.
fix
Ensure FixedImageType and MovingImageType dimensions and pixel types match your images.
TypeError: in method 'New', argument 1 of type 'itkImageToImageMetricv4...'
Incorrect metric type template parameters.
fix
Use metric = itk.MeanSquaresImageToImageMetric[FixedImageType, MovingImageType].New() with matching types.
Upgrade
Version history
5.4.6latest on PyPI · released Apr 23, 2026
Audit
Dependencies
itkrequiredCore ITK package is required.
Agent activity
8 hits · last 30 days
node
8
Resources
itk-registration — pip install itk-registration · libregistry