pytomography.transforms.shared.motion#

Module Contents#

Classes#

DVFMotionTransform

The parent class for all transforms used in reconstruction (obj2obj, im2im, obj2im). Subclasses must implement the __call__ method.

class pytomography.transforms.shared.motion.DVFMotionTransform(dvf_forward=None, dvf_backward=None)[source]#

Bases: pytomography.transforms.Transform

The parent class for all transforms used in reconstruction (obj2obj, im2im, obj2im). Subclasses must implement the __call__ method.

Parameters:
  • device (str) – Pytorch device used for computation

  • dvf_forward (torch.Tensor | None) –

  • dvf_backward (torch.Tensor | None) –

_get_vol_ratio(DVF)[source]#
_get_old_coordinates()[source]#

Obtain meshgrid of coordinates corresponding to the object

Returns:

Tensor of coordinates corresponding to input object

Return type:

torch.Tensor

_get_new_coordinates(old_coordinates, DVF)[source]#

Obtain the new coordinates of each voxel based on the DVF.

Parameters:
  • old_coordinates (torch.Tensor) – Old coordinates of each voxel

  • DVF (torch.Tensor) – Deformation vector field.

Returns:

_description_

Return type:

_type_

_apply_dvf(DVF, vol_ratio, object_i)[source]#

Applies the deformation vector field to the object

Parameters:
  • DVF (torch.Tensor) – Deformation vector field

  • object_i (torch.Tensor) – Old object.

Returns:

Deformed object.

Return type:

torch.Tensor

forward(object_i)[source]#

Forward transform of deformation vector field

Parameters:

object_i (torch.Tensor) – Original object.

Returns:

Deformed object corresponding to forward transform.

Return type:

torch.Tensor

backward(object_i)[source]#

Backward transform of deformation vector field

Parameters:

object_i (torch.Tensor) – Original object.

Returns:

Deformed object corresponding to backward transform.

Return type:

torch.Tensor