ImFusion SDK 4.3
VolumeBasedMeshRegistrationAlgorithm Class Reference

#include <ImFusion/Reg/VolumeBasedMeshRegistration.h>

Calculates a deformable registration between two meshes by calculating a deformable registration between distance volumes. More...

+ Inheritance diagram for VolumeBasedMeshRegistrationAlgorithm:

Detailed Description

Calculates a deformable registration between two meshes by calculating a deformable registration between distance volumes.

Internally, an instance of the DemonsImageRegistration algorithm is used to register the "fixed" distance volume to the "moving" distance volume. As this registration computes the inverse of the mapping from the fixed to the moving volume, this directly yields a registration of the "moving" Mesh to the "fixed" Mesh.

Public Types

enum class  InitializationMode { ScaledRigid = 0 , Affine = 1 , FFD = 2 }
 
- 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

 VolumeBasedMeshRegistrationAlgorithm ()
 Constructor that initializes parameter attributes, algorithm actions. Use this together with setFixed/setMoving.
 
 VolumeBasedMeshRegistrationAlgorithm (Mesh &meshFixed, Mesh &meshMoving, PointCloud *movingPoints=nullptr)
 Constructor with two Mesh arguments.
 
void compute () override
 Computes the deformable registration from meshMoving to meshFixed.
 
void setMoving (Mesh &movingMesh)
 Set moving mesh. Algorithm expects this object to remain valid during its lifetime.
 
void setFixed (const Mesh &fixedMesh)
 Set fixed mesh. Algorithm expects this object to remain valid during its lifetime.
 
MeshmovingMesh ()
 Getter for the reference (template) mesh if it exists.
 
const MeshfixedMesh ()
 Getter for the fixed mesh if it exitss.
 
const PointCloudpointCloud ()
 Point-cloud on the reference mesh.
 
void setMovingLandmarks (PointCloud *p)
 Setter for point-cloud.
 
Status initialize ()
 Initializes the registration by rescaling and preforming a linear registration.
 
Status runImageBasedDeformableRegistration ()
 Performs a image based deformable registration (without initialization)
 
Status resetDeformation ()
 Resets the internally stored deformable registration This also loads original (i.e.
 
OwningDataList takeDebugVolumes ()
 Gives up ownership of internally used distance/label volumes.
 
virtual double meshError ()
 Return an error measure between the segmentation mesh and the deformed reference mesh.
 
bool isStateValid ()
 Returns true if the algorithm is in a valid state, i.e. meshes exist and distance and label maps etc have been initialized correctly.
 
const DemonsImageRegistrationdemonsRegistration ()
 Getter for m_demonsRegistration.
 
- 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.
 

Static Public Member Functions

static bool createCompatible (const DataList &data, Algorithm **a)
 Used to create the algorithm from the ImFusionSuite.
 
- 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.
 

Public Attributes

Parameter< bool > p_debugMode = {"debugMode", false, this}
 Whether to export debug output, this is used only by the controller.
 
Parameter< double > p_distCutOff = {"distCutOff", 4.0, this}
 Signed distances are clamped to this value in initialize()
 
Parameter< bool > p_subVoxelPrecision = {"subVoxelPrecision", true, *this}
 Whether to use sub-voxel precision for distance-volumes.
 
Parameter< double > p_resolution = {"resolution", 1.0, *this}
 Resolution (i.e. spacing) of textures used internally. This does only affects textures obtained from Mesh objects.
 
Parameter< std::optional< size_t > > p_memoryLimitMB = {"memoryLimitMB", std::nullopt, this}
 Memory limit that aborts creation of internal helper objects (e.g.
 
Parameter< InitializationModep_initializationMode = {"initMode", InitializationMode::Affine, this}
 Which method to use to initialize the transformation.
 
Parameter< double > p_maximumStretching = {"maximumStretching", 5, this}
 If volume of fixed mesh relative to moving mesh (or vice versa) exceeds the cube of this value, abort.
 
- 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.
 

Protected Member Functions

bool initializeScaling ()
 Rescales the distance volume, label map, and (if applicable) mesh of the reference image so that the total volume of the volume defined by the label map matches that of the segmentation.
 
void saveWithoutDeformationIfEmpty ()
 If such a copy does not exist: save a copy of the meshes/pointclouds without displacement values in this class, cf.
 
void setupDemonsRegistration ()
 Setup the internal DemonsImageRegistration instance.
 
bool checkOutOfMemory (std::size_t increaseBytes)
 Increments the counter of memory used by the given amount, and check whether this goes beyond memory limit.
 
Status createEmptyDeformation ()
 
void applyDeformationToMeshAndLandmarks ()
 
- 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

const Meshm_fixedMesh = nullptr
 
Meshm_movingMesh = nullptr
 
PointCloudm_movingLandmarks = nullptr
 
SharedImageSetm_fixedLabelMap = nullptr
 
SharedImageSetm_movingLabelMap = nullptr
 
SharedImageSetm_fixedDist = nullptr
 
SharedImageSetm_movingDist = nullptr
 
std::unique_ptr< SharedImageSetm_fixedDistOwned
 
std::unique_ptr< SharedImageSetm_movingDistOwned
 
std::unique_ptr< SharedImageSetm_fixedLabelMapOwned
 
std::unique_ptr< SharedImageSetm_movingLabelMapOwned
 
std::unique_ptr< DemonsImageRegistrationm_demonsRegistration
 
std::optional< std::unique_ptr< Mesh > > m_movingMeshWithoutDeformation
 The algorithm uses the displacement values from an (inverse) deformation to update the moving mesh and landmarks.
 
std::optional< std::unique_ptr< PointCloud > > m_movingLandmarksWithoutDeformation
 
std::optional< size_t > m_totMemoryUsedMB = std::nullopt
 Counter for the amount of memory used.
 
- 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.
 
void configure (const Properties *p) override
 Configurable interface.
 
void configuration (Properties *p) const override
 Serialize the current object configuration into the given Properties object.
 

Member Enumeration Documentation

◆ InitializationMode

enum class InitializationMode
strong
Enumerator
ScaledRigid 

Initialization is performed by adjusting scaling and a rigid transformation.

Affine 

Initialization is performed by a full affine registration.

FFD 

Initialization is performed by first registering a 2x2x2 FFD deformation on a downsampled volume.

Constructor & Destructor Documentation

◆ VolumeBasedMeshRegistrationAlgorithm()

VolumeBasedMeshRegistrationAlgorithm ( Mesh & meshFixed,
Mesh & meshMoving,
PointCloud * movingPoints = nullptr )

Constructor with two Mesh arguments.

Parameters
meshFixedis the fixed Mesh to which the moving Mesh is registered.
meshMovingis a Mesh of the moving mesh. The vertices of this Mesh are modified by this algorithm.
movingPointsoptionally points to a PointCloud that is deformed in the same way as the moving mesh is. Algorithm expects both the fixed and moving meshes to remain valid during its lifetime.

Member Function Documentation

◆ compute()

void compute ( )
overridevirtual

Computes the deformable registration from meshMoving to meshFixed.

If a moving mesh has been provided, the result of this deformation is applied to the "moving" mesh in place. If a PointCloud on the "moving" mesh was provided, this is also deformed in-place. The registration comprises a scaling and rigid initialization, followed by an image-based deformable registration.

Implements Algorithm.

◆ resetDeformation()

Status resetDeformation ( )

Resets the internally stored deformable registration This also loads original (i.e.

after initialization, but before deformable registration) meshes/pointclouds if applicable

◆ configure()

void configure ( const Properties * p)
overridevirtual

Configurable interface.

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.

◆ meshError()

virtual double meshError ( )
virtual

Return an error measure between the segmentation mesh and the deformed reference mesh.

This measure is given (in mm) by the maximum displacement of the projections of the vertices of the moving mesh onto the fixed mesh This is only possible if two meshes were provided at construction, std::numeric_limits<double>::max() is returned otherwise.

◆ demonsRegistration()

const DemonsImageRegistration * demonsRegistration ( )
inline

Getter for m_demonsRegistration.

Warning
pointer may become invalidated e.g. when setFixed/setMoving is called, so do not store it.

◆ initializeScaling()

bool initializeScaling ( )
protected

Rescales the distance volume, label map, and (if applicable) mesh of the reference image so that the total volume of the volume defined by the label map matches that of the segmentation.

Also truncates the distance volume based on p_distCutOff

◆ saveWithoutDeformationIfEmpty()

void saveWithoutDeformationIfEmpty ( )
protected

If such a copy does not exist: save a copy of the meshes/pointclouds without displacement values in this class, cf.

m_movingMeshWithoutDeformation Only a single copy is stored by the algorithm.

Member Data Documentation

◆ p_subVoxelPrecision

Parameter<bool> p_subVoxelPrecision = {"subVoxelPrecision", true, *this}

Whether to use sub-voxel precision for distance-volumes.

This is slow on systems where the computation cannot be performed on the GPU (i.e. if OpenGl 4.3 is not available)

◆ p_memoryLimitMB

Parameter<std::optional<size_t> > p_memoryLimitMB = {"memoryLimitMB", std::nullopt, this}

Memory limit that aborts creation of internal helper objects (e.g.

distance volume, label map) if they cumulatively surpass this limit.

Warning
This algorithm keeps an internal counter of the amount of memory allocated during its lifetime that is only reset when the parameter is changed.
Only the GPU paths are reliably compatible with this, e.g. setting p_subVoxelPrecision=false may result in larger volumes being allocated..

◆ m_movingMeshWithoutDeformation

std::optional<std::unique_ptr<Mesh> > m_movingMeshWithoutDeformation
protected

The algorithm uses the displacement values from an (inverse) deformation to update the moving mesh and landmarks.

We store the meshes/landmarks without the added displacement values here in order to be able to update the moving mesh/landmarks appropriately.


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