ImFusion SDK 4.3
UltrasoundRegistrationAlgorithm Class Reference

#include <ImFusion/US/UltrasoundRegistrationAlgorithm.h>

Registration of an ultrasound sweep or volume to a tomographic scan (CT or MRI). More...

+ Inheritance diagram for UltrasoundRegistrationAlgorithm:

Detailed Description

Registration of an ultrasound sweep or volume to a tomographic scan (CT or MRI).

This class registers an input tomographic CT or MRI volume to an ultrasound sweep (or already compounded volume), by acting as a high-level interface for a collection of underlying alternative registration methods. According to the input, it attempts to intelligently find smart presets that lead to a robust and reliable performance.

The high-level registration algorithm is based on the following steps:

  • Initialization: finds a good starting point for the registration.
  • Preprocessing of the ultrasound data and the tomographic data.
  • Registration: done in multiple passes, each considering a larger set of parameters.

Initialization of the registration:

Preprocessing steps performed on the ultrasound data:

  • If it is an UltrasoundSweep:
    • Cropping of the uppermost 2.5mm from each frame (if the input has Linear geometry and no mask).
    • Compounding of ultrasound sweeps into a 3D volume (if not using slice-based registration).
  • If it is a volume:
    • Resampling to p_targetVolumeSpacing * p_relativeSweepSpacingPercent / 100 spacing.

Preprocessing steps performed on the tomographic data:

  • Resampling so that the spacing in each dimension is at least p_targetVolumeSpacing.

Possible similarity measures:

  • 3D LC2 similarity between the compounded ultrasound volume and the tomographic volume (default mode).
  • 2D LC2 similarity using the ultrasound frames to reslice the tomographic volume (if sweep is provided and p_sliceBased is true).

The registration is done in multiple sequential passes (which can be set as Flags using setMode):

  • TranslationSearch: Global translation grid search for initialization.
  • LocalRigid: Local rigid (6-DoF) optimization
  • LocalAffine: Local affine transformation (includes scaling and shearing)

Classes

struct  AdvancedConfig
 
struct  LandmarkWeightingConfig
 
struct  SegmentationWeightingConfig
 

Public Types

enum  RegistrationMode { TranslationSearch = 1 << 0 , LocalRigid = 1 << 1 , LocalAffine = 1 << 2 }
 Registration modes that are used sequentially within the pipeline. More...
 
enum class  InitializationMode { None , PredictionMaps , DISAGlobal }
 Initialization modes that will be used to find the initial pose for the registration. More...
 
enum class  WeightingMode { Default , Segmentation , Landmarks , Custom }
 
using CustomWeightingFunction
 Function that computes a custom weighting volume.
 
- Public Types inherited from Algorithm
enum  Status {
  Unknown = -1 , Success = 0 , Error = 1 , InvalidInput ,
  IncompleteInput , OutOfMemoryHost , OutOfMemoryGPU , UnsupportedGPU ,
  UnknownAction , AbortedByUser , User = 1000
}
 Status codes. More...
 

Public Member Functions

 UltrasoundRegistrationAlgorithm (SharedImageSet &ultrasoundVolumeOrSweep, SharedImageSet &tomographicVolume, const SharedImageSet *distanceVolume=nullptr)
 Constructor with an ultrasound sweep or volume, and the tomographic volume (MRI or CT)
 
void setUseSegmentationWeighting (const std::string &modelPath, double maxDistance=20.0, double strength=1.0)
 Use a segmentation model to weight the ultrasound volume Sets p_weightingMode to Segmentation and the parameters in p_segmentationWeighting to the specified values.
 
void setUseLandmarkWeighting (double fwhm)
 Use a weight volume composed of Gaussians centered around each landmark.
 
void setLandmarkWeighting (double fwhm)
 
bool hasLandmarks () const
 Whether the algorithm has landmarks available for weighting.
 
void setCustomWeighting (CustomWeightingFunction func)
 Set a custom weighting function that will be used to compute the ultrasound weight volume.
 
std::unique_ptr< SharedImageSetcompoundSweep ()
 Compound a 3D volume from the ultrasound sweep.
 
bool prepareData ()
 Run compounding if applicable, downsampling of both volumes, and pose initialization.
 
AlgorithmprepareRegAlgorithm (int pass)
 Create and return the internal registration algorithm instance.
 
SweepGlobalInitAlgorithmglobalInitAlgorithm ()
 Return the internal global/initialization registration algorithm (creating it if required)
 
void outputPreProcessed (DataList &dataOut)
 Output internal pre-processed volumes created here.
 
OwningDataList outputPreProcessed ()
 Outputs internal pre-processed volumes created by this algorithm.
 
SharedImageSetvolume ()
 Access to the tomographic (not ultrasound) volume.
 
UltrasoundSweepsweep ()
 Access the ultrasound sweep (may be null if only a volume was provided)
 
ParametricDeformationdeformation ()
 Return pointer to the currently active deformation if available.
 
const Optimizeroptimizer () const
 Access to the last used optimizer if available, in order to query statistics.
 
bool optimizeGatingOffset () const
 
void setOptimizeGatingOffset (bool b)
 
bool inputSupportsGatingOffsetOptimization () const
 Returns true if both inputs are suitable for updating the GatingMetadata's phase offset, i.e.
 
- Public Member Functions inherited from Algorithm
 Algorithm ()
 Default constructor will registers a single "compute" action that calls compute() and returns status().
 
virtual OwningDataList takeOutput ()
 Return any new Data that was created by the Algorithm during the last call to compute().
 
virtual void setProgress (Progress *progress)
 Sets a Progress interface the algorithm can use to notify observers about its computing progress.
 
Progressprogress () 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 FactoryInfofactoryInfo () 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 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
 
Configurableoperator= (const Configurable &)
 
Configurableoperator= (Configurable &&) noexcept
 
- Public Member Functions inherited from SignalReceiver
 SignalReceiver ()=default
 Default constructor.
 
 SignalReceiver (const SignalReceiver &other)
 Copy constructor, does not copy any existing signal connections from other.
 
SignalReceiveroperator= (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.
 

Public Attributes

Parameter< double > p_targetVolumeSpacing = {"targetVolumeSpacing", 1.0, this}
 Target volume spacing of the non-ultrasound volume.
 
Parameter< int > p_relativeSweepSpacingPercent = {"relativeSweepSpacingPercent", 100, this}
 Relative spacing in percent of the ultrasound sweep wrt. the tomographic volume.
 
Parameter< bool > p_usIsMoving = {"usIsMoving", false, this}
 Specifies if the ultrasound data is moved.
 
Parameter< bool > p_sliceBased = {"sliceBased", false, this}
 Use slice-to-volume registration instead of 3D-3D. Only applicable if a sweep is provided.
 
Parameter< WeightingModep_weightingMode = {"weightingMode", WeightingMode::Default, this}
 
SubProperty< LandmarkWeightingConfigp_landmarkWeighting = {"landmarkWeighting", LandmarkWeightingConfig(), this}
 Configuration for landmark weighting, used only if p_weightingMode is set to Landmarks.
 
SubProperty< SegmentationWeightingConfigp_segmentationWeighting = {"segmentationWeighting", SegmentationWeightingConfig(), this}
 Configuration for segmentation weighting, used only if p_weightingMode is set to Segmentation.
 
Parameter< InitializationModep_initializationMode = {"initializationMode", InitializationMode::None, this}
 Initialization mode for the registration.
 
Parameter< bool > p_probeCompression = {"probeCompression", false, this}
 Use a probe compression deformation.
 
Parameter< bool > p_optimizeGatingOffset = {"optimizeGatingOffset", false, this}
 If true, the gating metadata phase offset will also be optimized.
 
SubProperty< AdvancedConfigp_advanced = {"advanced", AdvancedConfig(), this}
 
- Public Attributes inherited from 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 Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.
 

Set parameters of the registration algorithm

void setTargetVolumeSpacing (double val)
 
void setRelativeSweepSpacing (int percent)
 Set the desired relative spacing in percent of the ultrasound sweep wrt. the tomographic volume.
 
void setProbeCompression (bool flag)
 Set whether a probe compression model should be used.
 
void setUltrasoundIsMoving (bool flag)
 Set whether the ultrasound data shall be the moving one (default is false)
 
void setGlobalInit (bool flag)
 Set whether deep learning based global initialization shall be attempted.
 
void setSliceBased (bool flag)
 Set whether slice-based vs. volume-based registration should be used (only applicable if sweep is provided)
 
void setDotProductSimilarity (bool flag)
 Set whether the deep learning based feature vector dot product similarity shall be used.
 
void setSetMask (bool newValue)
 Set whether a mask should be set on the ultrasound volume to ignore zero-valued voxels during registration.
 
void setKeepZerosDuringDownsampling (bool newValue)
 Whether to preserve zero-valued pixels during downsampling of the volume.
 
void setMode (Flags< RegistrationMode > val)
 Set the registration mode as bit flags with 1=global translation, 2=rigid, 3=affine.
 
void setExtendedSearch (double range, int steps)
 Enable extended search via optimizer random search, for local optimization modes.
 
void setErrorFunction (ErrorFunction *ef)
 Set an optional error function that is also used to penalize the image similarity during registration.
 

Query parameters of the registration algorithm

double targetVolumeSpacing () const
 
int relativeSweepSpacing () const
 Return the relative spacing in percent of the ultrasound sweep wrt. the tomographic volume.
 
bool setMask ()
 Return whether a mask should be set on the ultrasound volume to ignore zero-valued voxels during registration.
 
bool keepZerosDuringDownsampling ()
 Whether to preserve zero-valued pixels during downsampling of the volume.
 
bool probeCompression () const
 Return whether a probe compression model is used.
 
bool ultrasoundIsMoving () const
 Return whether the ultrasound data is moving.
 
bool globalInit () const
 Return whether global initialization is used.
 
bool sliceBased () const
 Return whether slice-based registration is active.
 
bool dotProductSimilarity () const
 Return whether the deep learning dot product similarity is used.
 
bool hasDotProductSimilarity () const
 Return whether the deep learning dot product similarity is available.
 
Flags< RegistrationModemode () const
 Return the registration mode bit flags.
 
double landmarkWeighting () const
 Return the current landmark weighting parameter.
 

Methods implementing the Algorithm interface

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.
 
void compute () override
 Compute the entire registration pipeline.
 
static bool createCompatible (const DataList &data, Algorithm **a)
 

Additional Inherited Members

- Static Public Member Functions inherited from Algorithm
static bool createCompatible (const DataList &data, Algorithm **a=nullptr)
 Factory function to check algorithm compatibility with input data and optionally instantiate it.
 
- Protected Member Functions inherited from 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 SignalReceiver
void disconnectAll ()
 Disconnects all existing connections.
 
- Protected Attributes inherited from Algorithm
std::string m_name
 Algorithm name.
 
Progressm_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< Actionm_actions
 Map of key given by the id of the action, of the available actions of this algorithm.
 
- Protected Attributes inherited from Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
 

Member Typedef Documentation

◆ CustomWeightingFunction

Initial value:
Set of images independent of their storage location.
Definition SharedImageSet.h:42

Function that computes a custom weighting volume.

It takes as input the compounded ultrasound volume, which is guaranteed to be non-empty. The resulting weight must have the same size and spacing as the ultrasound volume. In case of failure, the function should return nullptr.

Member Enumeration Documentation

◆ RegistrationMode

Registration modes that are used sequentially within the pipeline.

Enumerator
TranslationSearch 

The moving volume is placed on a grid search for initialization.

LocalRigid 

The 6-DoF pose of the moving volume is optimized around the starting point.

LocalAffine 

An affine transformation is also applied to the volume.

◆ InitializationMode

enum class InitializationMode
strong

Initialization modes that will be used to find the initial pose for the registration.

Enumerator
PredictionMaps 

Use SweepGlobalInitAlgorithm for initialization.

DISAGlobal 

Use UltrasoundDISARegistrationAlgorithm in global search mode for initialization.

◆ WeightingMode

enum class WeightingMode
strong
Enumerator
Default 

Use the the variance of each ultrasound patch as weight.

Segmentation 

Use a segmentation model to weight the ultrasound volume. See setUseSegmentationWeighting.

Landmarks 

Use a weight volume composed of Gaussians centered around each landmark. See setUseLandmarkWeighting.

Custom 

Use a custom weighting function set with setCustomWeighting.

Constructor & Destructor Documentation

◆ UltrasoundRegistrationAlgorithm()

UltrasoundRegistrationAlgorithm ( SharedImageSet & ultrasoundVolumeOrSweep,
SharedImageSet & tomographicVolume,
const SharedImageSet * distanceVolume = nullptr )

Constructor with an ultrasound sweep or volume, and the tomographic volume (MRI or CT)

If a sweep is provided and it has typical video size, the removal of duplicate frames is attempted right here, to prepare the data such that it can interactively be used through the GUI controller afterwards.

Parameters
ultrasoundVolumeOrSweepinput ultrasound sweep or already compounded volume
tomographicVolumeinput tomographic volume to register against
distanceVolumeoptional distance volume for the probe compression model

Member Function Documentation

◆ setUseSegmentationWeighting()

void setUseSegmentationWeighting ( const std::string & modelPath,
double maxDistance = 20.0,
double strength = 1.0 )

Use a segmentation model to weight the ultrasound volume Sets p_weightingMode to Segmentation and the parameters in p_segmentationWeighting to the specified values.

The model will be executed on each frame of the ultrasound sweep, the resulting labelmaps will be compounded into a volume The weight at each voxel is computed as 1.0 - strength * min(distanceToSegmentation / maxDistance, 1.0)

Parameters
modelPathPath to the segmentation model
maxDistanceDistance in mm at which the segmentation weight fades away. Must be greater than zero.
strengthValue in [0, 1] indicating strength of the segmentation weighting

◆ setUseLandmarkWeighting()

void setUseLandmarkWeighting ( double fwhm)

Use a weight volume composed of Gaussians centered around each landmark.

Sets p_weightingMode to Landmarks and p_landmarkWeighting.landmarkFWHM to the specified fwhm value. Requires a sweep as input.

Parameters
fwhmthe full width at half maximum (FWHM) of the Gaussian (in mm), must be greater than zero

◆ setLandmarkWeighting()

void setLandmarkWeighting ( double fwhm)
Deprecated
"Use setUseLandmarkWeighting to enable landmark weighting, or set p_weightingMode to Default to disable it"

◆ setTargetVolumeSpacing()

void setTargetVolumeSpacing ( double val)
inline

Set the target volume spacing of the non-ultrasound volume

Deprecated
"Use p_targetVolumeSpacing instead"

◆ setRelativeSweepSpacing()

void setRelativeSweepSpacing ( int percent)
inline

Set the desired relative spacing in percent of the ultrasound sweep wrt. the tomographic volume.

Deprecated
"Use p_relativeSweepSpacingPercent instead"

◆ setProbeCompression()

void setProbeCompression ( bool flag)
inline

Set whether a probe compression model should be used.

Deprecated
"Use p_probeCompression instead"

◆ setUltrasoundIsMoving()

void setUltrasoundIsMoving ( bool flag)
inline

Set whether the ultrasound data shall be the moving one (default is false)

Deprecated
"Use p_usIsMoving instead"

◆ setGlobalInit()

void setGlobalInit ( bool flag)

Set whether deep learning based global initialization shall be attempted.

Deprecated
"Use p_initializationMode instead"

◆ setSliceBased()

void setSliceBased ( bool flag)
inline

Set whether slice-based vs. volume-based registration should be used (only applicable if sweep is provided)

Deprecated
"Use p_sliceBased instead"

◆ setDotProductSimilarity()

void setDotProductSimilarity ( bool flag)

Set whether the deep learning based feature vector dot product similarity shall be used.

Deprecated
"Dot product similarity has been deprecated and is no longer supported. Use 'UltrasoundDISARegistrationAlgorithm' or the DISA initialization mode instead"

◆ setSetMask()

void setSetMask ( bool newValue)
inline

Set whether a mask should be set on the ultrasound volume to ignore zero-valued voxels during registration.

Deprecated
"This is always false now"

◆ setKeepZerosDuringDownsampling()

void setKeepZerosDuringDownsampling ( bool newValue)

Whether to preserve zero-valued pixels during downsampling of the volume.

Deprecated
"This is always true now"

◆ targetVolumeSpacing()

double targetVolumeSpacing ( ) const
inline

Return the target volume spacing of the non-ultrasound volume

Deprecated
"Use p_targetVolumeSpacing instead"

◆ relativeSweepSpacing()

int relativeSweepSpacing ( ) const
inline

Return the relative spacing in percent of the ultrasound sweep wrt. the tomographic volume.

Deprecated
"Use p_relativeSweepSpacingPercent instead"

◆ setMask()

bool setMask ( )
inline

Return whether a mask should be set on the ultrasound volume to ignore zero-valued voxels during registration.

Deprecated
"This is always false now"

◆ keepZerosDuringDownsampling()

bool keepZerosDuringDownsampling ( )
inline

Whether to preserve zero-valued pixels during downsampling of the volume.

Deprecated
"This is always true now"

◆ probeCompression()

bool probeCompression ( ) const
inline

Return whether a probe compression model is used.

Deprecated
"Use p_probeCompression instead"

◆ ultrasoundIsMoving()

bool ultrasoundIsMoving ( ) const
inline

Return whether the ultrasound data is moving.

Deprecated
"Use p_usIsMoving instead"

◆ globalInit()

bool globalInit ( ) const

Return whether global initialization is used.

Deprecated
"Use p_initializationMode instead"

◆ sliceBased()

bool sliceBased ( ) const
inline

Return whether slice-based registration is active.

Deprecated
"Use p_sliceBased instead"

◆ dotProductSimilarity()

bool dotProductSimilarity ( ) const
inline

Return whether the deep learning dot product similarity is used.

Deprecated
"Dot product similarity has been deprecated and is no longer supported. Use 'UltrasoundDISARegistrationAlgorithm' or the DISA initialization mode instead"

◆ hasDotProductSimilarity()

bool hasDotProductSimilarity ( ) const
inline

Return whether the deep learning dot product similarity is available.

Deprecated
"Dot product similarity has been deprecated and is no longer supported. Use 'UltrasoundDISARegistrationAlgorithm' or the DISA initialization mode instead"

◆ landmarkWeighting()

double landmarkWeighting ( ) const
inline

Return the current landmark weighting parameter.

Deprecated
"Use p_landmarkWeighting->landmarkFWHM instead"

◆ configure()

void configure ( const Properties * p)
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.

See also
configuration() for the inverse functionality

Reimplemented from Configurable.

◆ configuration()

void configuration ( Properties * p) const
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.

See also
configure() for the inverse functionality

Reimplemented from Configurable.

◆ compute()

void compute ( )
overridevirtual

Compute the entire registration pipeline.

This method runs the entire multi-stage registration pipeline.

First, if the ultrasound input is an (image set) sweep and the registration is not slice-based, the sweep is compounded into a volume.

Then, if the registration is not slice-based, the ultrasound volume is downsampled to the specified target spacing.

As a last preparation step, if the volumes do not overlap, the registration is coarsely initialized.

Implements Algorithm.

◆ outputPreProcessed()

void outputPreProcessed ( DataList & dataOut)

Output internal pre-processed volumes created here.

Deprecated
"Use 'OwningDataList outputPreProcessed()' instead"

◆ optimizer()

const Optimizer * optimizer ( ) const

Access to the last used optimizer if available, in order to query statistics.

Return true if the gating metadata phase offset will also be optimized

◆ optimizeGatingOffset()

bool optimizeGatingOffset ( ) const
inline
Deprecated
"Use p_optimizeGatingOffset instead"

◆ setOptimizeGatingOffset()

void setOptimizeGatingOffset ( bool b)
inline
Deprecated
"Use p_optimizeGatingOffset instead"

◆ inputSupportsGatingOffsetOptimization()

bool inputSupportsGatingOffsetOptimization ( ) const

Returns true if both inputs are suitable for updating the GatingMetadata's phase offset, i.e.

one of them has such a data component, and both are clips over time.

Member Data Documentation

◆ p_sliceBased

Parameter<bool> p_sliceBased = {"sliceBased", false, this}

Use slice-to-volume registration instead of 3D-3D. Only applicable if a sweep is provided.

See also
SliceToVolumeRegistrationAlgorithm

The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close