ImFusion C++ SDK 4.4.0
ImFusion::US::SimpleMotionModel Class Reference

#include <ImFusion/US/MotionTrajectoryModel.h>

Model representing simple motion defined either by a shift and rotation or a rigid pose between the first and last frames. More...

Inheritance diagram for ImFusion::US::SimpleMotionModel:

Detailed Description

Model representing simple motion defined either by a shift and rotation or a rigid pose between the first and last frames.

The model supports two modes (SimpleMotionModel::SimpleMotionType):

  • In ShiftAndRotation mode, the motion is described by a scalar translation along the Z axis and an in-plane rotation angle.
  • In RigidPose mode, the motion is described by a translation vector and Euler angles.

Public Types

enum class  SimpleMotionType { ShiftAndRotation , RigidPose }
 The modes of the SimpleMotionModel.
Public Types inherited from ImFusion::US::MotionTrajectoryModel
typedef std::function< MotionTrajectoryModel *(int)> createModelFunc
 Function signature for creating a motion model with a given size.

Public Member Functions

 SimpleMotionModel (int size)
std::string name () const override
 Returns the name of the current motion model.
void configure (const Properties *p) override
 Extends MotionTrajectoryModel::configure(const Properties *).
void configuration (Properties *p) const override
 Saves the current model settings into the provided Properties object, including the "distributeSymmetrically" property if set.
void setParameters (const std::vector< double > &pars) override
 Sets the motion parameters in Euler representation.
std::vector< mat4 > defineMotion () const override
 Computes a set of m_size matrices describing the intended motion trajectory.
mat4 fitMatrices (const std::vector< mat4 > &mat) override
 Sets the parameters based on the given motion sequence.
double shift () const
 Returns the translation along the Z-axis.
double rotation () const
 Returns the rotation around the Z-axis.
void setMotionType (SimpleMotionType t)
Public Member Functions inherited from ImFusion::US::MotionTrajectoryModel
 MotionTrajectoryModel (int size)
void setRelativeShiftMatrix (const mat4 &relShiftBefore)
 Sets the relative shift matrix applied before the motion.
virtual int numberOfParameters () const
virtual std::vector< double > parameters () const
Public Member Functions inherited from ImFusion::Configurable
virtual void configureDefaults ()
 Retrieve the properties of this object, replaces values with their defaults and sets it again.
void registerParameter (ParameterBase *param)
 Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration().
void unregisterParameter (const ParameterBase *param)
 Remove the given Parameter or SubProperty from the list of registered parameters.
 Configurable (const Configurable &rhs)
 Configurable (Configurable &&rhs) noexcept
Configurable & operator= (const Configurable &)
Configurable & operator= (Configurable &&) noexcept

Protected Attributes

SimpleMotionType m_type
bool m_distributeSymmetrically
 If true, will distribute symmetrically around the central frame.
Protected Attributes inherited from ImFusion::US::MotionTrajectoryModel
const int m_size
 Size of the model, regularly the number of frames.
std::vector< double > m_pars
 Full motion parameter vector - not necessarily the exposed ones.
mat4 m_relShift
 Generic helper matrix to incorporate optional shifts. Considered by rigidMotion().
Protected Attributes inherited from ImFusion::Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.

Simple getters and setters.

SimpleMotionType motionType () const
void setDistributeSymmetrically (bool b)
bool distributeSymmetrically () const

Additional Inherited Members

Static Public Member Functions inherited from ImFusion::US::MotionTrajectoryModel
static std::vector< std::pair< std::string, createModelFunc > > & supportedModels ()
 Returns a list of supported motion models.
Public Attributes inherited from ImFusion::Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.
Protected Member Functions inherited from ImFusion::US::MotionTrajectoryModel
std::vector< mat4 > rigidMotion (const mat4 &m0, const mat4 &m1, int startFrame=0, int endFrame=-1) const
 Helper method to interpolate a rigid motion between m0 and m1.

Constructor & Destructor Documentation

◆ SimpleMotionModel()

ImFusion::US::SimpleMotionModel::SimpleMotionModel ( int size)
explicit
Parameters
sizeThe number of frames in the motion sequence.

Member Function Documentation

◆ name()

std::string ImFusion::US::SimpleMotionModel::name ( ) const
inlineoverridevirtual

Returns the name of the current motion model.

Implements ImFusion::US::MotionTrajectoryModel.

◆ configure()

void ImFusion::US::SimpleMotionModel::configure ( const Properties * p)
overridevirtual

Extends MotionTrajectoryModel::configure(const Properties *).

Supports additional properties specific to this model:

  • "distributeSymmetrically": if true, the motion is distributed symmetrically around the central frame.
See also
MotionTrajectoryModel::configure(const Properties *)

Reimplemented from ImFusion::US::MotionTrajectoryModel.

◆ configuration()

void ImFusion::US::SimpleMotionModel::configuration ( Properties * p) const
overridevirtual

Saves the current model settings into the provided Properties object, including the "distributeSymmetrically" property if set.

Reimplemented from ImFusion::US::MotionTrajectoryModel.

◆ setParameters()

void ImFusion::US::SimpleMotionModel::setParameters ( const std::vector< double > & pars)
overridevirtual

Sets the motion parameters in Euler representation.

Implicitly changes the motion type.

  • If pars.size() == 2, the motion type is set to ShiftAndRotation.
  • If pars.size() >= 6, the motion type isset to RigidPose.

Any previously set parameters are discarded. Parameters are interpreted as:

  • ShiftAndRotation: [z-translation, in-plane rotation angle]
  • RigidPose: [tx, ty, tz, rx, ry, rz] in Euler angles
Warning
Logs a warning and ignores pars if the number of parameters is not 2 and less than 6.

Reimplemented from ImFusion::US::MotionTrajectoryModel.

◆ defineMotion()

std::vector< mat4 > ImFusion::US::SimpleMotionModel::defineMotion ( ) const
overridevirtual

Computes a set of m_size matrices describing the intended motion trajectory.

Implements ImFusion::US::MotionTrajectoryModel.

◆ fitMatrices()

mat4 ImFusion::US::SimpleMotionModel::fitMatrices ( const std::vector< mat4 > & mat)
overridevirtual

Sets the parameters based on the given motion sequence.

Defines the parameters as an Euler-angle representation of a rigid motion between first and the last frames of the input motion.

Parameters
matsequence of transformation matrices representing the motion.
Returns
a new registration matrix corresponding to the fitted motion.
Note
The mode will be set to RigidPose even if the motion only consists of a Z-axis translation and rotation around the Z-axis.

Implements ImFusion::US::MotionTrajectoryModel.

◆ setMotionType()

void ImFusion::US::SimpleMotionModel::setMotionType ( SimpleMotionType t)
Note
When switching from RigidPose to the ShiftAndRotation, the parameters will be truncated: the translation along the Z-axis becomes the shift, and the rotation along the Z-axis becomes the rotation.

The documentation for this class was generated from the following file:
  • ImFusion/US/MotionTrajectoryModel.h
Search Tab / S to search, Esc to close