transformation

Pairwise Transformation

class airlab.transformation.pairwise.AffineTransformation(moving_image, opt_cm=False)[source]

Affine centred transformation for 2D and 3D.

Parameters:
  • moving_image (Image) – moving image for the registration
  • opt_cm (bool) – using center of as parameter for the optimisation
forward()[source]
set_parameters(t, phi, scale, shear, rotation_center=None)[source]

Set parameters manually

t (array): 2 or 3 dimensional array specifying the spatial translation phi (array): 1 or 3 dimensional array specifying the rotation angles scale (array): 2 or 3 dimensional array specifying the scale in each dimension shear (array): 2 or 6 dimensional array specifying the shear in each dimension: yx, xy, zx, zy, xz, yz rotation_center (array): 2 or 3 dimensional array specifying the rotation center (default is zeros)

class airlab.transformation.pairwise.BsplineTransformation(image_size, sigma, diffeomorphic=False, order=2, dtype=torch.float32, device='cpu')[source]
class airlab.transformation.pairwise.NonParametricTransformation(image_size, diffeomorphic=False, dtype=torch.float32, device='cpu')[source]

None parametric transformation

forward()[source]
set_start_parameter(parameters)[source]
class airlab.transformation.pairwise.RigidTransformation(moving_image, opt_cm=False)[source]

Rigid centred transformation for 2D and 3D.

Parameters:
  • moving_image (Image) – moving image for the registration
  • opt_cm (bool) – using center of as parameter for the optimisation
compute_displacement(transformation_matrix)[source]
forward()[source]
init_translation(fixed_image)[source]

Initialize the translation parameters with the difference between the center of mass of the fixed and the moving image

Parameters:fixed_image (Image) – Fixed image for the registration
print()[source]
set_parameters(t, phi, rotation_center=None)[source]

Set parameters manually

t (array): 2 or 3 dimensional array specifying the spatial translation phi (array): 1 or 3 dimensional array specifying the rotation angles rotation_center (array): 2 or 3 dimensional array specifying the rotation center (default is zeros)

transformation_matrix
class airlab.transformation.pairwise.SimilarityTransformation(moving_image, opt_cm=False)[source]

Similarity centred transformation for 2D and 3D. :param moving_image: moving image for the registration :type moving_image: Image :param opt_cm: using center of as parameter for the optimisation :type opt_cm: bool

forward()[source]
set_parameters(t, phi, scale, rotation_center=None)[source]

Set parameters manually

t (array): 2 or 3 dimensional array specifying the spatial translation phi (array): 1 or 3 dimensional array specifying the rotation angles scale (array): 2 or 3 dimensional array specifying the scale in each dimension rotation_center (array): 2 or 3 dimensional array specifying the rotation center (default is zeros)

class airlab.transformation.pairwise.WendlandKernelTransformation(image_size, sigma, cp_scale=2, diffeomorphic=False, ktype='C4', dtype=torch.float32, device='cpu')[source]

Wendland Kernel Transform:

Implements the kernel transform with the Wendland basis

Parameters:
  • sigma – specifies how many control points are used (each sigma pixels)
  • cp_scale – specifies the extent of the kernel. how many control points are in the support of the kernel

Transformation Utils

class airlab.transformation.utils.Diffeomorphic(image_size=None, scaling=10, dtype=torch.float32, device='cpu')[source]

Diffeomorphic transformation. This class computes the matrix exponential of a given flow field using the scaling and squaring algorithm according to:

Unsupervised Learning for Fast Probabilistic Diffeomorphic Registration Adrian V. Dalca, Guha Balakrishnan, John Guttag, Mert R. Sabuncu MICCAI 2018 and Diffeomorphic Demons: Efficient Non-parametric Image Registration Tom Vercauterena et al., 2008
calculate(displacement)[source]
static diffeomorphic_2D(displacement, grid, scaling=-1)[source]
static diffeomorphic_3D(displacement, grid, scaling=-1)[source]
set_image_size(image_szie)[source]
airlab.transformation.utils.compute_grid(image_size, dtype=torch.float32, device='cpu')[source]
airlab.transformation.utils.displacement_to_unit_displacement(displacement)[source]
airlab.transformation.utils.get_displacement_itk(displacement, refIm)[source]
airlab.transformation.utils.rotation_matrix(phi_x, phi_y, phi_z, dtype=torch.float32, device='cpu', homogene=False)[source]
airlab.transformation.utils.unit_displacement_to_displacement(displacement)[source]
airlab.transformation.utils.upsample_displacement(displacement, new_size, interpolation='linear')[source]

Upsample displacement field

airlab.transformation.utils.warp_image(image, displacement)[source]