![]() |
ImFusion C++ SDK 4.5.0
|
#include <ImFusion/US/SweepGlobalInitAlgorithm.h>
Algorithm for initializing the 3D pose of an ultrasound sweep relative to a reference volume. More...
Algorithm for initializing the 3D pose of an ultrasound sweep relative to a reference volume.
This algorithm estimates the initial rigid transformation between a freehand ultrasound sweep and a reference 3D volume. It is typically used as a global initialization step for subsequent fine registration.
Inputs:
Effects on input data:
Outputs:
This algorithm uses a combination of different penalties to guide the initialization:
The behavior is controlled by a set of parameters and penalty functions, which can be enabled or disabled as needed.
Parameters:
Public Types | |
| enum class | Penalty { Distance = 0 , BeamAngle = 1 , SkinDist = 2 , SkinAngle = 3 , PredMap = 4 } |
| Supported penalty functions, which can be combined to guide the initialization. More... | |
| Public Types inherited from ImFusion::Algorithm | |
| enum | Status { Unknown = -1 , Success = 0 , Error = 1 , InvalidInput , IncompleteInput , OutOfMemoryHost , OutOfMemoryGPU , UnsupportedGPU , UnknownAction , AbortedByUser , User = 1000 } |
| Status codes. More... | |
Public Member Functions | |
| SweepGlobalInitAlgorithm (UltrasoundSweep &sweep, SharedImageSet &volume, SharedImageSet *segVol=nullptr) | |
| void | setRegistrationAlgorithm (Algorithm *regAlg) |
| Set an image-based registration algorithm instance from outside, applying the error/penalty function from here. | |
| void | setPointCorrAlgorithm (SweepPointCorrAlgorithm *pca) |
| Set the point correspondences algorithm from outside if available, using its distance penalty. | |
| void | evaluateError (std::vector< double > &out) override |
| Implements the ErrorFunction interface. | |
| std::vector< double > | computeErrors () |
| Compute errors for all enabled penalties and return the results. | |
| std::vector< double > | lastErrors () const |
| Return the last computed penalty errors. | |
| double | penalize (double cost, const std::vector< double > &error) override |
| Compute the penalized cost based on the provided error vector and penalty configuration. | |
| void | compute () override |
| Execute the algorithm. | |
| OwningDataList | takeOutput () override |
| void | configure (const Properties *p) override |
| Configure this object instance by de-serializing the given Properties. | |
| void | configuration (Properties *p) const override |
| Serialize the current object configuration into the given Properties object. | |
| UltrasoundSweep & | sweep () |
| Access to the ultrasound sweep. | |
| SharedImageSet & | volume () |
| Access to the reference volume. | |
| PointsOnImage * | sweepPoints () |
| Access to the sweep points instance, which exists if a segmentation volume is used. | |
| SweepPointCorrAlgorithm * | pointCorrAlgorithm () |
| Access the point correspondences algorithm instance if available. | |
| bool | isAbdominalFusion () const |
| Return true if the data is presumably an abdominal ultrasound fusion with CT or MRI. | |
| void | setProbeDeformationAlgorithm (ProbeDeformationAlgorithm *alg) |
| Set the probe deformation algorithm instance from outside. No ownership is transferred. | |
| Algorithm * | transferProbeDeformationAlgorithm () |
| Transfer and release probe deformation algorithm if created internally. | |
| bool | computePredictionMapsAlgorithm (SharedImageSet *usVolume) |
| Initialize and compute registration from prediction maps with provided ultrasound volume. | |
| bool | hasSliceOrientationEstimation () const |
| Check if the SliceOrientationEstimation algorithm is available. | |
| bool | computeSliceOrientationEstimation () |
| Initialize and compute registration using slice orientation estimation with provided ultrasound sweep. | |
| bool | hasKeypointsRegistration () const |
| Check if the Keypoint algorithm is available. | |
| bool | computeKeypointsRegistration () |
| Initialize and compute registration using the keypoint networks. | |
| Public Member Functions inherited from ImFusion::Algorithm | |
| Algorithm () | |
| Default constructor will registers a single "compute" action that calls compute() and returns status(). | |
| virtual void | setProgress (Progress *progress) |
| Sets a Progress interface the algorithm can use to notify observers about its computing progress. | |
| Progress * | progress () const |
| Returns the progress interface if set. | |
| virtual int | status () const |
| Indicates the status of the last call to compute(). | |
| virtual bool | survivesDataDeletion (const Data *) const |
| Indicates whether the algorithm can handle (partial) deletion of the specified data, by default this checks whether the data is in the input list. | |
| const FactoryInfo & | factoryInfo () const |
| Returns the record describing how this Algorithm was instantiated by the AlgorithmFactory. | |
| void | setFactoryInfo (const FactoryInfo &value) |
| Sets the record describing how this Algorithm was instantiated by the AlgorithmFactory. | |
| Status | runAction (const std::string &id) |
| Run the action with name id if it exists. | |
| const std::vector< Action > & | actions () |
| Get a mapping from Action id to Action as registered in this algorithm. | |
| 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 |
| Public Member Functions inherited from ImFusion::SignalReceiver | |
| SignalReceiver ()=default | |
| Default constructor. | |
| SignalReceiver (const SignalReceiver &other) | |
| Copy constructor, does not copy any existing signal connections from other. | |
| SignalReceiver & | operator= (SignalReceiver rhs) |
| Assignment operator, disconnects all existing connections, does not copy any existing signal connections from rhs. | |
| virtual | ~SignalReceiver () |
| Virtual destructor disconnects from all connected signals. | |
Static Public Member Functions | |
| static bool | createCompatible (const DataList &data, Algorithm **a) |
| Static Public Member Functions inherited from ImFusion::Algorithm | |
| static bool | createCompatible (const DataList &data, Algorithm **a=nullptr) |
| Factory function to check algorithm compatibility with input data and optionally instantiate it. | |
| static double | errorToMultPenalty (double value, double range) |
| There is a margin of half the range within which the returned penalty value fades from 1 to 0 with a polynomial function, and extents below zero after 1.5x range, and is continuous in the derivative. | |
| static double | errorsToMultPenalty (const std::vector< double > &error, const std::vector< double > &range) |
| Return a number of error values to a combined penalty function, while properly housekeeping values < 0. | |
Protected Attributes | |
| UltrasoundSweep & | m_sweep |
| The ultrasound sweep to be modified. | |
| SharedImageSet & | m_volume |
| The CT or MRI volume to register against. | |
| SharedImageSet * | m_segVol = nullptr |
| Optional segmentation as label or distance volume. | |
| std::unique_ptr< SharedImageSet > | m_distVol |
| Distance volume if computed here. | |
| std::unique_ptr< PointDistanceReg > | m_pointReg |
| Point-surface registration instance. | |
| SharedImageSet * | m_usVolumeFromSweep = nullptr |
| Compounded ultrasound volume required for prediction map algorithm. | |
| std::unique_ptr< SharedImageSet > | m_ownUsVolume |
| Denotes whether the above has been computed internally. | |
| std::unique_ptr< LinkPose > | m_linkPoseUs |
| Links transformation of the sweep and compounded volume. | |
| std::unique_ptr< RegistrationFromPredictionMapAlgorithm > | m_predMapAlg |
| Prediction map algorithm instance. | |
| std::unique_ptr< Algorithm > | m_sliceOrientationAlg |
| Slice orientation algorithm instance. | |
| std::unique_ptr< Algorithm > | m_keypointAlg |
| Keypoint algorithm instance. | |
| std::shared_ptr< PointsOnImage > | m_sweepPoints |
| Sweep points for segmentation distance mode. | |
| std::unique_ptr< ProbeDeformationAlgorithm > | m_ownProbeDefAlg |
| Probe deformation algorithm instance created here. | |
| ProbeDeformationAlgorithm * | m_probeDefAlg = nullptr |
| Probe deformation algorithm for skin surface constraint. | |
| Algorithm * | m_regAlg = nullptr |
| Optional registration algorithm set from outside. | |
| SweepPointCorrAlgorithm * | m_pointCorrAlg = nullptr |
| Optional point correspondence alg. set from outside. | |
| bool | m_predMapAlgComputing = false |
| Preventing recursive penalty computation while prediction map algorithm is running. | |
| std::vector< double > | m_cachedError |
| Errors cached to avoid redundant computations. | |
| std::vector< double > | m_lastError |
| Last computed landmark, surface or angle errors. | |
| std::vector< double > | m_penaltyRange = {10.0, 45.0, 30.0, 50.0, 10.0} |
| Configured penalty range values. | |
| std::vector< bool > | m_penaltyEnabled |
| Enabled flag for all penalties. | |
| Protected Attributes inherited from ImFusion::Algorithm | |
| std::string | m_name |
| Algorithm name. | |
| Progress * | m_progress = nullptr |
| Non-owing pointer to a progress interface. May be a nullptr. | |
| FactoryInfo | m_factoryInfo = {} |
| Record describing how this algorithm was instantiated by the AlgorithmFactory. | |
| int | m_status = Status::Unknown |
| Algorithm status after last call to compute(). | |
| std::vector< Action > | m_actions |
| Map of key given by the id of the action, of the available actions of this algorithm. | |
| Protected Attributes inherited from ImFusion::Configurable | |
| std::vector< Param > | m_params |
| List of all registered Parameter and SubProperty instances. | |
Parameters of the algorithm | |
| Parameter< bool > | p_usIsMoving = {"usIsMoving", true, this} |
| Specifies if the ultrasound sweep shall be moved as opposed to the volume. | |
| Parameter< bool > | p_useSkinSurface = {"useSkinSurface", false, this} |
| If enabled, the skin surface is segmented from the volume and used as penalty function. | |
| Parameter< bool > | p_usePredMap = {"usePredMap", false, this} |
| Specify whether the registration from prediction maps algorithm shall be used for initialization. | |
| Parameter< bool > | p_useKeypoints = {"useKeypoints", false, this} |
| Specify whether the registration from keypoints algorithm shall be used. | |
| Parameter< bool > | p_usePredMapTranslationOnly = {"usePredMapTranslationOnly", false, this} |
| Specify whether the registration from prediction maps algorithm shall be used in translation only mode. | |
| Parameter< bool > | p_useSliceOrientation = {"useSliceOrientation", false, this} |
| Specify whether the slice orientation algorithm shall be used for initialization. | |
Dealing with the penalty functions | |
| void | setPenaltyRange (Penalty which, double range) |
| void | setPenaltyEnabled (Penalty which, bool flag) |
| Enable or disable a particular penalty function. | |
| double | penaltyRange (Penalty which) const |
| Return the current allowed range of a penalty function. | |
| bool | penaltyEnabled (Penalty which) const |
| Return whether the chosen penalty function is enabled. | |
| bool | penaltyAvailable (Penalty which) const |
| Return whether a penalty function is available in the current configuration. | |
Additional Inherited Members | |
| Public Attributes inherited from ImFusion::Algorithm | |
| Signal | signalOutputChanged |
| Signal should be emitted by Algorithms when their output/result has changed. | |
| Signal | signalParametersChanged |
| Signal should be emitted by Algorithms when their parameter configuration has changed. | |
| 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::Algorithm | |
| void | loadDefaults () |
| void | registerAction (const std::string &id, const std::string &guiName, const std::function< Algorithm::Status(void)> &action) |
| Register an action to be run via runAction. | |
| template<typename D> | |
| void | registerAction (const std::string &id, const std::string &guiName, Algorithm::Status(D::*action)(void)) |
| Template version of runAction that can be used with a pointer to a member function. | |
| void | registerAction (const Action &action) |
| Register an action. | |
| Protected Member Functions inherited from ImFusion::SignalReceiver | |
| void | disconnectAll () |
| Disconnects all existing connections. | |
|
strong |
Supported penalty functions, which can be combined to guide the initialization.
| void ImFusion::US::SweepGlobalInitAlgorithm::setRegistrationAlgorithm | ( | Algorithm * | regAlg | ) |
Set an image-based registration algorithm instance from outside, applying the error/penalty function from here.
| regAlg | Pointer to the registration algorithm to use for error evaluation. |
|
inline |
Set the point correspondences algorithm from outside if available, using its distance penalty.
| pca | Pointer to the SweepPointCorrAlgorithm instance. |
|
overridevirtual |
Implements the ErrorFunction interface.
Evaluates all enabled penalties and stores the results.
| out | Output vector, will have size equal to the number of enabled penalties and contain the computed penalties. |
Implements ImFusion::ErrorFunction.
| std::vector< double > ImFusion::US::SweepGlobalInitAlgorithm::computeErrors | ( | ) |
| std::vector< double > ImFusion::US::SweepGlobalInitAlgorithm::lastErrors | ( | ) | const |
Return the last computed penalty errors.
|
overridevirtual |
Compute the penalized cost based on the provided error vector and penalty configuration.
| cost | The original cost value. |
| error | The vector of penalty values, if empty it will be computed. |
Reimplemented from ImFusion::ErrorFunction.
| void ImFusion::US::SweepGlobalInitAlgorithm::setPenaltyRange | ( | Penalty | which, |
| double | range ) |
Set allowed range for a particular penalty function
| which | The penalty function to configure. |
| range | Acceptable range value, for the penalty function. Negative values are discarded and a warning message is emitted. |
| void ImFusion::US::SweepGlobalInitAlgorithm::setPenaltyEnabled | ( | Penalty | which, |
| bool | flag ) |
Enable or disable a particular penalty function.
| which | The penalty function to configure. |
| flag | True to enable, false to disable. |
| double ImFusion::US::SweepGlobalInitAlgorithm::penaltyRange | ( | Penalty | which | ) | const |
Return the current allowed range of a penalty function.
| which | The penalty function to query. |
| bool ImFusion::US::SweepGlobalInitAlgorithm::penaltyEnabled | ( | Penalty | which | ) | const |
Return whether the chosen penalty function is enabled.
| which | The penalty function to query. |
| bool ImFusion::US::SweepGlobalInitAlgorithm::penaltyAvailable | ( | Penalty | which | ) | const |
Return whether a penalty function is available in the current configuration.
| which | The penalty function to query. |
|
overridevirtual |
Execute the algorithm.
Implements ImFusion::Algorithm.
|
overridevirtual |
Reimplemented from ImFusion::Algorithm.
|
overridevirtual |
Configure this object instance by de-serializing the given Properties.
The default implementation will do so automatically for all registered Parameter and SubProperty instances.
Reimplemented from ImFusion::Configurable.
|
overridevirtual |
Serialize the current object configuration into the given Properties object.
The default implementation will do so automatically for all registered Parameter and SubProperty instances.
Reimplemented from ImFusion::Configurable.
| Algorithm * ImFusion::US::SweepGlobalInitAlgorithm::transferProbeDeformationAlgorithm | ( | ) |
Transfer and release probe deformation algorithm if created internally.
| bool ImFusion::US::SweepGlobalInitAlgorithm::computePredictionMapsAlgorithm | ( | SharedImageSet * | usVolume | ) |
Initialize and compute registration from prediction maps with provided ultrasound volume.
| usVolume | Pointer to the ultrasound volume. |
| bool ImFusion::US::SweepGlobalInitAlgorithm::computeSliceOrientationEstimation | ( | ) |
Initialize and compute registration using slice orientation estimation with provided ultrasound sweep.
| bool ImFusion::US::SweepGlobalInitAlgorithm::computeKeypointsRegistration | ( | ) |
Initialize and compute registration using the keypoint networks.