skshapes.morphing.rigid_motion.RigidMotion

class skshapes.morphing.rigid_motion.RigidMotion(n_steps=1)

Bases: BaseModel

Rigid motion morphing.

Parameters:

n_steps (int) – Number of steps.

__init__(n_steps=1)

Methods

__init__([n_steps])

copy()

Return a copy of the model.

create_path(*, shape, small_rotation_matrix, ...)

Create the path from the rotation matrix and the translation.

inital_parameter(shape)

Return the initial parameters of the model.

morph(shape, parameter[, return_path, ...])

Morph a shape using the rigid motion model.

parameter_shape(shape)

Return the shape of the parameter.

create_path(*, shape, small_rotation_matrix, small_translation)

Create the path from the rotation matrix and the translation.

Parameters:
  • shape (polydata_type) – The initial shape.

  • small_rotation_matrix (Float32[Tensor, '_ _']) – The rotation matrix that will be applied at each step.

  • translation – The translation vector that will be applied at each step.

Returns:

The path. Its length is n_steps + 1.

Return type:

list[polydata_type]

morph(shape, parameter, return_path=False, return_regularization=False)

Morph a shape using the rigid motion model.

If the data is 3D The parameter must be a (2, 3) tensor, where the first row is the axis-angle rotations and the second row is the translation vector.

If the data is 2D, the parameter must be a (3,) tensor, where the first element is the rotation angle and the two last elements are the translation vector.

Parameters:
  • shape (polydata_type) – The shape to morph.

  • parameter (Float32[Tensor, '_ _'] | Float32[Tensor, '_']) – The rigid motion parameter.

  • return_path (bool) – True if you want to have access to the sequence of polydatas.

  • return_regularization (bool) – True to have access to the regularization.

Returns:

A named tuple containing the morphed shape, the regularization and the path if needed.

Return type:

MorphingOutput

parameter_shape(shape)

Return the shape of the parameter.

Parameters:

shape (polydata_type | image_type) – The shape to morph.

Returns:

The shape of the parameter.

Return type:

Union[tuple[int, int]