opentps.core.processing.registration package

Submodules

opentps.core.processing.registration.midPosition module

compute(CT4D, refIndex=0, baseResolution=2.5, nbProcesses=-1, tryGPU=True)

Compute mid-position image and corresponding deformations from a 4D image.

Parameters:
  • CT4D (Dynamic3DSequence) – 4D image.

  • refIndex (int) – index of the reference phase in the 4D image.

  • baseResolution (double) – spacing of the highest registration resolution (i.e. spacing of the output deformation fields)

  • nbProcesses (int) – number of processes to be used in Morphons registration (-1 = maximum number of processes)

Returns:

  • numpy array – MidP image.

  • list – List of deformations between MidP image and each phase of the 4D image

opentps.core.processing.registration.registration module

class Registration(fixed, moving)

Bases: object

Base class for registration.

Variables:
  • fixed (image3D) – fixed image.

  • moving (image3D) – moving image.

  • deformed (image3D) – deformed moving image.

  • roiBox (list) – region of interest for registration.

computeImageDifference(keepFixedShape=True, tryGPU=True)

Compute the difference between the fixed and moving image.

Parameters:
  • keepFixedShape (bool) – If True, the moving image is resampled to the fixed image grid. If False, the fixed image is resampled to the moving image grid.

  • tryGPU (bool) – If True, try to use GPU.

Returns:

diff – Difference between the 2 images.

Return type:

3DImage

computeSSD(fixed, deformed)

Compute the SSD metric between two images.

Parameters:
  • fixed (numpy array) – Fixed image.

  • deformed (numpy array) – Deformed image.

Returns:

ssd – SSD metric value.

Return type:

double

regularizeField(field, filterType='Gaussian', sigma=1.0, cert=None, tryGPU=True)

Regularize vector field using Gaussian convolution or normalized convolution.

Parameters:
  • field (numpy array) – vector field to be regularized.

  • filterType (string) – type of filtering to be applied on the field.

  • sigma (double) – standard deviation of the Gaussian.

  • cert (numpy array) – certainty map associated to the data.

resampleFixedImage(tryGPU=True)

Resample the fixed image to the moving image grid.

Parameters:

tryGPU (bool) – If True, try to use GPU.

Returns:

resampled

Return type:

3DImage

resampleMovingImage(keepFixedShape=True, tryGPU=True)

Resample the moving image to the fixed image grid.

Parameters:
  • keepFixedShape (bool) – If True, the moving image is resampled to the fixed image grid. If False, the fixed image is resampled to the moving image grid.

  • tryGPU (bool) – If True, try to use GPU.

Returns:

resampled – Resampled image.

Return type:

3DImage

setROI(ROI)

Set the ROI to be used for registration.

Parameters:

ROI (roiMask) – ROI to be used for registration.

translateAndComputeSSD(translation=None, tryGPU=True)

Translate the moving image and compute the SSD metric. :Parameters: * translation (list) – Translation vector.

  • tryGPU (bool) – If True, try to use GPU.

Returns:

ssd – SSD metric value after translation.

Return type:

double

translateOrigin(Image, translation)

Translate the origin of an image.

Parameters:
  • Image (3DImage) – Image from which the origin is translated.

  • translation (list) – Translation vector.

opentps.core.processing.registration.registrationDemons module

class RegistrationDemons(fixed, moving, baseResolution=2.5, tryGPU=True)

Bases: Registration

Perform Demons registration between fixed and moving images. inherited from Registration class.

Variables:
  • fixed (Image3D) – Fixed image.

  • moving (Image3D) – Moving image.

  • baseResolution (float) – Base resolution for registration.

  • tryGPU (bool) – Try to use GPU for registration.

compute()

Perform Demon registration between fixed and moving images.

Returns:

Deformation from moving to fixed images.

Return type:

numpy array

opentps.core.processing.registration.registrationMorphons module

class RegistrationMorphons(fixed, moving, baseResolution=2.5, nbProcesses=-1, tryGPU=True)

Bases: Registration

Class for performing registration using morphons kernels. inherited from Registration class.

Variables:
  • fixed (Image3D) – Fixed image.

  • moving (Image3D) – Moving image.

  • baseResolution (float) – Base resolution for registration.

  • nbProcesses (int) – Number of processes to use for registration.

  • tryGPU (bool) – Try to use GPU for registration.

compute()

Perform registration between fixed and moving images.

Returns:

Deformation from moving to fixed images.

Return type:

numpy array

applyMorphonsKernels(image, k, is_fixed=1, tryGPU=True)
morphonsComplexConvD(im, k)
morphonsComplexConvS(im, k)
morphonsConv(im, k)

opentps.core.processing.registration.registrationQuick module

class RegistrationQuick(fixed, moving)

Bases: Registration

Perform quick translation search between fixed and moving images. inherited from Registration class.

Variables:
compute(tryGPU=True)

Perform registration between fixed and moving images.

Returns:

Translation from moving to fixed images.

Return type:

Transform3D

matchProfiles(fixed, moving)

Find shift between two profiles by minimizing the mean squared error (MSE).

Parameters:
  • fixed (array) – fixed profile.

  • moving (array) – moving profile.

Returns:

shift between profiles.

Return type:

int

opentps.core.processing.registration.registrationRigid module

class RegistrationRigid(fixed, moving, multimodal=False)

Bases: Registration

Perform rigid registration between fixed and moving images. inherited from Registration class.

Variables:
  • fixed (Image3D) – Fixed image.

  • moving (Image3D) – Moving image.

  • multimodal (bool) – If True, use multimodal registration.

compute()

Perform rigid registration between fixed and moving images.

Returns:

Transform from moving to fixed images.

Return type:

Transform3D

opentps.core.processing.registration.registrationTranslation module

class RegistrationTranslation(fixed, moving, initialTranslation=[0.0, 0.0, 0.0])

Bases: Registration

Perform translation registration between fixed and moving images. inherited from Registration class.

Variables:
  • fixed (Image3D) – Fixed image.

  • moving (Image3D) – Moving image.

  • initialTranslation (list) – Initial translation guess.

compute()

Perform registration between fixed and moving images.

Returns:

Translation from moving to fixed images.

Return type:

Transform3D

Module contents