rigid_motion#

mrtwin.rigid_motion(ndim, nframes, degree='moderate', seed=42)[source]#

Generate rigid motion pattern as a Markov Chain process.

Parameters:
  • ndim (int) – Generate 2D (in-plane only) or 3D motion pattern.

  • nframes (int) – Number of motion frames.

  • degree (str | Sequence[float], optional) – Severity of motion. The default is "moderate".

  • seed (int, optional) – Random number generator seed. The default is 42.

Notes

Severity of motion can be specified via the degree argument. This can be a string - accepted values are "subtle", "moderate" and "severe". These corresponds to the following motion ranges:

  • "subtle": maximum rotation 5.0 [deg]; maximum translation 2.0 [mm]

  • "moderate": maximum rotation 10.0 [deg]; maximum translation 8.0 [mm]

  • "severe": maximum rotation 16.0 [deg]; maximum translation 16.0 [mm]

As an alternative, user can specify a tuple of floats, where degree[0] is the maximum rotation in [deg] and degree[1] is the maximum translation in [mm].

Returns:

Motion parameters. The number of outputs depend on the value of ndims.

For ndim == 2:

  • angleZtnp.ndarray

    Rotation about z axis in [deg] of shape (nframes,).

  • dynp.ndarray

    Translation towards y axis in [mm] of shape (nframes,).

  • dxnp.ndarray

    Translation towards x axis in [mm] of shape (nframes,).

For ndim == 3:

  • angleXnp.ndarray

    Rotation about x axis in [deg] of shape (nframes,).

  • angleYtorch.Tensor

    Rotation about y axis in [deg] of shape (nframes,).

  • angleZtnp.ndarray

    Rotation about z axis in [deg] of shape (nframes,).

  • dznp.ndarray

    Translation towards z axis in [mm] of shape (nframes,).

  • dynp.ndarray

    Translation towards y axis in [mm] of shape (nframes,).

  • dxnp.ndarray

    Translation towards x axis in [mm] of shape (nframes,).

Return type:

tuple[np.ndarray]

Parameters:

Example

>>> from mrtwin import rigid_motion

We can generate a 6-degree rigid motion pattern for 1000 motion states as:

>>> roll, pitch, yaw, dz, dy, dx = rigid_motion(ndim=3, nframes=1000)

Examples using mrtwin.rigid_motion#

Rigid Motion Pattern Generation

Rigid Motion Pattern Generation