transformation

Pairwise Transformation

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

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()

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

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

None parametric transformation

forward()

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

set_start_parameter(parameters)
class airlab.transformation.pairwise.RigidTransformation(moving_image, opt_cm=False)

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
forward()

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

init_translation(fixed_image)

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()
class airlab.transformation.pairwise.SimilarityTransformation(moving_image, opt_cm=False)

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()

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

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

Transformation Utils

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

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)
static diffeomorphic_2D(displacement, grid, scaling=-1)
static diffeomorphic_3D(displacement, grid, scaling=-1)
set_image_size(image_szie)
airlab.transformation.utils.compute_grid(image_size, dtype=torch.float32, device='cpu')
airlab.transformation.utils.displacement_to_unit_displacement(displacement)
airlab.transformation.utils.rotation_matrix(phi_x, phi_y, phi_z, dtype=torch.float32, device='cpu', homogene=False)
airlab.transformation.utils.unit_displacement_to_dispalcement(displacement)
airlab.transformation.utils.upsample_displacement(displacement, new_size, interpolation='linear')

Upsample displacement field

airlab.transformation.utils.warp_image(image, displacement)