CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-itk

Insight Toolkit for N-dimensional image processing, segmentation, and registration in medical and scientific applications

Pending
Overview
Eval results
Files

deformable-registration.mddocs/reference/registration/

Deformable Registration

Non-rigid registration methods using Demons algorithms, B-splines, and displacement fields for deformable image alignment.

Capabilities

Demons Registration

class DemonsRegistrationFilter:
    """
    Classic Demons deformable registration algorithm.
    
    Template parameters:
    - fixed_image_type: Fixed image type
    - moving_image_type: Moving image type
    - displacement_field_type: Displacement field type
    """
    
    def SetFixedImage(self, image):
        """Set the fixed image."""
    
    def SetMovingImage(self, image):
        """Set the moving image."""
    
    def SetNumberOfIterations(self, iterations):
        """Set number of iterations."""
    
    def SetStandardDeviations(self, std):
        """Set standard deviations for Gaussian smoothing of displacement field."""
    
    def SetUseGradientType(self, use_gradient_type):
        """Set gradient type (0=symmetric, 1=fixed, 2=moving)."""
    
    def GetDisplacementField(self):
        """Get the computed displacement field."""

class DiffeomorphicDemonsRegistrationFilter:
    """
    Diffeomorphic Demons registration (ensures invertible transforms).
    
    Template parameters:
    - fixed_image_type: Fixed image type
    - moving_image_type: Moving image type
    - displacement_field_type: Displacement field type
    """
    
    def SetFixedImage(self, image):
        """Set the fixed image."""
    
    def SetMovingImage(self, image):
        """Set the moving image."""
    
    def SetNumberOfIterations(self, iterations):
        """Set number of iterations."""
    
    def SetStandardDeviations(self, std):
        """Set smoothing standard deviations."""
    
    def SetUseGradientType(self, use_gradient_type):
        """Set gradient computation type."""

class SymmetricForcesDemonsRegistrationFilter:
    """
    Symmetric forces Demons registration.
    
    Template parameters:
    - fixed_image_type: Fixed image type
    - moving_image_type: Moving image type
    - displacement_field_type: Displacement field type
    """

SyN Registration (Symmetric Normalization)

class SyNImageRegistrationMethod:
    """
    Symmetric normalization (SyN) diffeomorphic registration.
    
    Template parameters:
    - fixed_image_type: Fixed image type
    - moving_image_type: Moving image type
    """
    
    def SetFixedImage(self, image):
        """Set the fixed image."""
    
    def SetMovingImage(self, image):
        """Set the moving image."""
    
    def SetLearningRate(self, learning_rate):
        """Set the learning rate."""
    
    def SetNumberOfIterationsPerLevel(self, iterations):
        """Set iterations for each resolution level."""
    
    def SetConvergenceThreshold(self, threshold):
        """Set convergence threshold."""
    
    def SetGaussianSmoothingVarianceForTheUpdateField(self, variance):
        """Set smoothing variance for update field."""
    
    def SetGaussianSmoothingVarianceForTheTotalField(self, variance):
        """Set smoothing variance for total field."""

Usage Examples

Demons Registration

import itk

# Load images
fixed = itk.imread('fixed.nii.gz', itk.F)
moving = itk.imread('moving.nii.gz', itk.F)

# Set up Demons registration
ImageType = itk.Image[itk.F, 3]
VectorType = itk.Vector[itk.F, 3]
DisplacementFieldType = itk.Image[VectorType, 3]

demons = itk.DemonsRegistrationFilter[ImageType, ImageType, DisplacementFieldType].New()
demons.SetFixedImage(fixed)
demons.SetMovingImage(moving)
demons.SetNumberOfIterations(50)
demons.SetStandardDeviations(1.0)

demons.Update()
displacement_field = demons.GetDisplacementField()

# Warp moving image
warped = itk.warp_image_filter(moving, displacement_field)
itk.imwrite(warped, 'warped.nii.gz')

Diffeomorphic Demons

import itk

fixed = itk.imread('fixed.nii.gz', itk.F)
moving = itk.imread('moving.nii.gz', itk.F)

ImageType = itk.Image[itk.F, 3]
VectorType = itk.Vector[itk.F, 3]
DisplacementFieldType = itk.Image[VectorType, 3]

demons = itk.DiffeomorphicDemonsRegistrationFilter[ImageType, ImageType, DisplacementFieldType].New()
demons.SetFixedImage(fixed)
demons.SetMovingImage(moving)
demons.SetNumberOfIterations(100)
demons.SetStandardDeviations(1.5)

demons.Update()
displacement_field = demons.GetDisplacementField()

# Apply to moving image
warped = itk.warp_image_filter(moving, displacement_field)
itk.imwrite(warped, 'diffeomorphic_warped.nii.gz')

Install with Tessl CLI

npx tessl i tessl/pypi-itk

docs

index.md

tile.json