pyalfe.image_registration#

class pyalfe.image_registration.ImageRegistration[source]#

Bases: ABC

abstract register_rigid(fixed, moving, transform_output, init_transform=None)[source]#

Performs rigid registration (translation and rotation).

Parameters:
  • fixed (str or Path) – The path to the fixed image.

  • moving (str or Path) – The path to the moving image

  • transform_output (str to Path) – The path to the rigid transform output

  • init_transform (str or Path) – The path to the file storing the initial transform. The default is None.

abstract register_affine(fixed, moving, transform_output, init_transform, fast=False)[source]#

Performs affine registration (scaling, translation, and rotation)

Parameters:
  • fixed (str or Path) – The path to the fixed image.

  • moving (str or Path) – The path to the moving image

  • transform_output (str to Path) – The path to the rigid transform output

  • init_transform (str or Path) – The path to the file storing the initial transform. The default is None.

  • fast (bool) – If True a fast method of registration is used with possibly lower quality results. The default is False.

abstract register_deformable(fixed, moving, transform_output, affine_transform=None)[source]#

Performs deformable registration.

Parameters:
  • fixed (str or Path) – The path to the fixed image.

  • moving (str or Path) – The path to the moving image

  • transform_output (str to Path) – The path to the rigid transform output

  • affine_transform (str or Path) – The path to a file storing an affine transform that will be applied to the moving image before the deformable registration. Default is None.

abstract reslice(fixed, moving, registration_output, *transform)[source]#

Applies registration transforms to the moving image.

Parameters:
  • fixed (str or Path) – The path to the fixed image.

  • moving (str or Path) – The path to the moving image

  • registration_output (str or Path) – The path where output image will be written to.

  • transform (str or Path) – The path to one or more transformation files that should be applied sequentially.

class pyalfe.image_registration.GreedyRegistration(threads=16)[source]#

Bases: ImageRegistration

Implementation of ImageRegistration that uses the Greedy tool. https://greedy.readthedocs.io/en/latest/

Greedy needs to be installed on your machine to use this class.

greedy_path#

The path to the greedy binary. Default is greedy.

Type:

str or Path

threads#

Number of cpu threads to be passed to greedy. Default is 16.

Type:

int

logger = <Logger GreedyRegistration (DEBUG)>#
reslice(fixed, moving, registration_output, *transform)[source]#

Applies registration transforms to the moving image.

Parameters:
  • fixed (str or Path) – The path to the fixed image.

  • moving (str or Path) – The path to the moving image

  • registration_output (str or Path) – The path where output image will be written to.

  • transform (str or Path) – The path to one or more transformation files that should be applied sequentially.

register_rigid(fixed, moving, transform_output, init_transform=None)[source]#

Performs rigid registration (translation and rotation).

Parameters:
  • fixed (str or Path) – The path to the fixed image.

  • moving (str or Path) – The path to the moving image

  • transform_output (str to Path) – The path to the rigid transform output

  • init_transform (str or Path) – The path to the file storing the initial transform. The default is None.

register_affine(fixed, moving, transform_output, init_transform=None, fast=True)[source]#

Performs affine registration (scaling, translation, and rotation)

Parameters:
  • fixed (str or Path) – The path to the fixed image.

  • moving (str or Path) – The path to the moving image

  • transform_output (str to Path) – The path to the rigid transform output

  • init_transform (str or Path) – The path to the file storing the initial transform. The default is None.

  • fast (bool) – If True a fast method of registration is used with possibly lower quality results. The default is False.

register_deformable(fixed, moving, transform_output, affine_transform=None)[source]#

Performs deformable registration.

Parameters:
  • fixed (str or Path) – The path to the fixed image.

  • moving (str or Path) – The path to the moving image

  • transform_output (str to Path) – The path to the rigid transform output

  • affine_transform (str or Path) – The path to a file storing an affine transform that will be applied to the moving image before the deformable registration. Default is None.

class pyalfe.image_registration.AntsRegistration[source]#

Bases: ImageRegistration

Implementation of ImageRegistration that uses ANTsPy ANTsX/ANTsPy

reslice(fixed, moving, registration_output, *transform)[source]#

Applies registration transforms to the moving image.

Parameters:
  • fixed (str or Path) – The path to the fixed image.

  • moving (str or Path) – The path to the moving image

  • registration_output (str or Path) – The path where output image will be written to.

  • transform (str or Path) – The path to one or more transformation files that should be applied sequentially.

register_rigid(fixed, moving, transform_output=None, init_transform=None)[source]#

Performs rigid registration (translation and rotation).

Parameters:
  • fixed (str or Path) – The path to the fixed image.

  • moving (str or Path) – The path to the moving image

  • transform_output (str to Path) – The path to the rigid transform output

  • init_transform (str or Path) – The path to the file storing the initial transform. The default is None.

register_affine(fixed, moving, transform_output=None, init_transform=None, fast=False)[source]#

Performs affine registration (scaling, translation, and rotation)

Parameters:
  • fixed (str or Path) – The path to the fixed image.

  • moving (str or Path) – The path to the moving image

  • transform_output (str to Path) – The path to the rigid transform output

  • init_transform (str or Path) – The path to the file storing the initial transform. The default is None.

  • fast (bool) – If True a fast method of registration is used with possibly lower quality results. The default is False.

register_deformable(fixed, moving, transform_output=None, affine_transform=None)[source]#

Performs deformable registration.

Parameters:
  • fixed (str or Path) – The path to the fixed image.

  • moving (str or Path) – The path to the moving image

  • transform_output (str to Path) – The path to the rigid transform output

  • affine_transform (str or Path) – The path to a file storing an affine transform that will be applied to the moving image before the deformable registration. Default is None.