![]() |
ImFusion SDK 4.3
|
#include <ImFusion/US/MotionTrajectoryModel.h>
Motion model enabling piecewise segment-based registration using frame selection. More...
Inheritance diagram for PiecewiseMotionModel:Motion model enabling piecewise segment-based registration using frame selection.
This motion model optimizes the input motion within user-defined frame selections. The output motion is interpolated across the selected segments (frame ranges). To initialize the model, call fitMatrices(const std::vector<mat4>&) to provide the original tracking matrices and define the initial control segments. The first and last selected frames will be automatically chosen as control points.
Additional motion segments can later be appended using addPiece(const Selection& totalSelection, int newPieceSize).
Example usage:
Public Member Functions | |
| PiecewiseMotionModel (int size) | |
| std::string | name () const override |
| Returns the name of the current motion model. | |
| int | numberOfParameters () const override |
| Returns the number of parameters currently active in the model. | |
| std::vector< double > | parameters () const override |
| Returns the current transformation parameters of the model. | |
| void | setParameters (const std::vector< double > &pars) override |
| Sets the transformation parameters for the currently optimized piece(s). | |
| bool | addPiece (const Selection &totalSelection, int newPieceSize) |
| Adds a new motion segment to the model based on updated frame selection. | |
| void | setExposeAllParameters (bool b) |
| Sets whether all transformation parameters should be exposed for optimization. | |
| bool | exposeAllParameters () const |
| Checks whether all transformation parameters are exposed. | |
| std::vector< mat4 > | defineMotion () const override |
| Generates the complete interpolated motion trajectory over the model's frame range. | |
| mat4 | fitMatrices (const std::vector< mat4 > &mat) override |
| Initializes the piecewise motion model from the input transformation matrices. | |
| void | setSelection (Selection s) |
| const Selection & | selection () |
Public Member Functions inherited from MotionTrajectoryModel | |
| MotionTrajectoryModel (int size) | |
| void | setRelativeShiftMatrix (const mat4 &relShiftBefore) |
| Sets the relative shift matrix applied before the motion. | |
| void | configure (const Properties *p) override |
| Sets one or multiple properties. | |
| void | configuration (Properties *p) const override |
| Retrieve the properties of this object. | |
Public Member Functions inherited from 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 | |
| Selection | m_selection |
| Current selection. | |
| bool | m_exposeAllParams |
| Flag if all parameters or just the ones of the current piece are exposed. | |
| std::vector< std::pair< int, mat4 > > | m_piecewiseFrameMat |
| Control points at frame indices for piecewise optimization. | |
| int | m_currentOptimPiece |
| Index of the piece between control points currently being optimized. | |
| std::vector< mat4 > | referenceMatrices |
| The motion initially provided in the fitMatrices(const std::vector<mat4>& mat) | |
Protected Attributes inherited from 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 Configurable | |
| std::vector< Param > | m_params |
| List of all registered Parameter and SubProperty instances. | |
Additional Inherited Members | |
Public Types inherited from MotionTrajectoryModel | |
| typedef std::function< MotionTrajectoryModel *(int)> | createModelFunc |
| Function signature for creating a motion model with a given size. | |
Static Public Member Functions inherited from MotionTrajectoryModel | |
| static std::vector< std::pair< std::string, createModelFunc > > & | supportedModels () |
| Returns a list of supported motion models. | |
Public Attributes inherited from Configurable | |
| Signal | signalParametersChanged |
Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted. | |
Protected Member Functions inherited from 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. | |
|
explicit |
| size | The number of frames in the motion sequence. |
|
inlineoverridevirtual |
Returns the name of the current motion model.
Implements MotionTrajectoryModel.
|
overridevirtual |
Returns the number of parameters currently active in the model.
Reimplemented from MotionTrajectoryModel.
|
overridevirtual |
Returns the current transformation parameters of the model.
The number and meaning of parameters depend on the model state and exposure mode:
Reimplemented from MotionTrajectoryModel.
|
overridevirtual |
Sets the transformation parameters for the currently optimized piece(s).
| pars | A vector of transformation parameters. Its length must match numberOfParameters(). |
Reimplemented from MotionTrajectoryModel.
| bool addPiece | ( | const Selection & | totalSelection, |
| int | newPieceSize ) |
Adds a new motion segment to the model based on updated frame selection.
| totalSelection | The full selection, including the newly selected control point. |
| newPieceSize | Number of frames to extend the piecewise model by:
|
This method allows incrementally building a piecewise model by appending new control points and segments.
| void setExposeAllParameters | ( | bool | b | ) |
Sets whether all transformation parameters should be exposed for optimization.
| b | If true, all parameters for all segments are exposed; if false, only those of the current segment are used. |
| bool exposeAllParameters | ( | ) | const |
Checks whether all transformation parameters are exposed.
|
overridevirtual |
Generates the complete interpolated motion trajectory over the model's frame range.
Returns a vector of transformation matrices, one per frame, with total size equal to the model's configured size.
The output motion is defined as follows:
This results in a piecewise-rigid motion profile with constant motion outside the selected regions.
Implements MotionTrajectoryModel.
|
overridevirtual |
Initializes the piecewise motion model from the input transformation matrices.
Uses the first and last selected frames (as defined via setSelection(Selection)) as initial control points, and computes the rigid motion between them. These control frames define the initial segment.
mat must contain at least as many entries as the index of the last selected frame. mat should ideally match the model size provided at construction. Implements MotionTrajectoryModel.