snake.core.handlers.motion.image#

Motion in the image domain.

TODO: Add constraints on maximal displacements TODO: Use FOV displacements

Module Contents#

Classes#

RandomMotionImageHandler

Add Random Motion in Image.

Functions#

apply_motion_to_phantom

Apply motion to the phantom.

API#

class snake.core.handlers.motion.image.RandomMotionImageHandler[source]#

Bases: snake.core.handlers.base.AbstractHandler

Add Random Motion in Image.

Parameters:
  • ts_std_mm – Translation standard deviation, in mm/s.

  • rs_std_mm – Rotation standard deviation, in radians/s.

  • motion_file (str) – If provided, the motion file is loaded and resampled to match the number of frames in the simulation. The motion is then added to the data.

  • motion_file_tr (float) – Original TR of the motion file, in seconds.

Notes

The motion is generated by drawing from a normal distribution with standard deviation for the 6 motion parameters (3 translations and 3 rotations, in this order). Then the cumulative motion is computed by summing the motion at each frame.

The handlers is parametrized with speed in mm/s and rad/s, as these values provides an independent control of the motion amplitude regardless of the time resolution for the simulation.

__handler_name__ = 'motion-image'#
ts_std_mms: tuple[float, float, float] | None = None#
rs_std_degs: tuple[float, float, float] | None = None#
motion_file: str | None = None#
motion_file_tr_ms: float | None = None#
__post_init__()[source]#
get_dynamic(phantom: snake.core.phantom.Phantom, sim_conf: snake.core.simulation.SimConfig) snake.core.phantom.DynamicData[source]#

Get dynamic information.

snake.core.handlers.motion.image.apply_motion_to_phantom(phantom: snake.core.phantom.Phantom, motions: numpy.typing.NDArray, time_idx: int) snake.core.phantom.Phantom[source]#

Apply motion to the phantom.