cyto_dl.utils.rotation module#

class cyto_dl.utils.rotation.RotationModule(group, spatial_dims, pad_value=0.0, eps=1e-06)[source]#

Bases: object

compute_rotation_matrix(pose)[source]#
cyto_dl.utils.rotation.get_rotation_matrix_so2(pose, spatial_dims)[source]#

Computes a (batch of) rotation matrix of the SO(2) group, in either 2d or 3d. In 3d, rotation is assumed to be about the Z axis (first axis).

Parameters:
  • pose (torch.Tensor) – A (batch of) equivariant 2d vector(s), of the form (cos(theta), sin(theta))

  • spatial_dims (int) – Indicates whether it’s 2d or 3d

Return type:

The (batch of) rotation matrix

cyto_dl.utils.rotation.get_rotation_matrix_so3(z, eps=1e-06)[source]#

Computes a (batch of) rotation matrix of the SO(3) group.

Parameters:
  • z (torch.Tensor) – A batch of pairs of equivariant vectors, from which a rotation matrix is inferred

  • eps (float) – Precision

Return type:

The (batch of) rotation matrix