ImFusion C++ SDK 4.5.0
ImFusion::Cranial::MultiVolumeRegistrationAlgorithm Class Reference

#include <CranialPlugin/include/ImFusion/Cranial/MultiVolumeRegistrationAlgorithm.h>

Rigidly or affinely co-registers a set of 3D volumes to a common reference by updating image poses in-place. More...

Inheritance diagram for ImFusion::Cranial::MultiVolumeRegistrationAlgorithm:

Detailed Description

Rigidly or affinely co-registers a set of 3D volumes to a common reference by updating image poses in-place.

No resampling is performed; original voxel data is unchanged.

Registration history is stored in results(). Call results().apply(n) to restore all image poses to a given step; compute() appends a new step on each successful run.

When p_consensus is enabled, each moving image is registered via multiple paths and the most geometrically consistent result is selected, improving robustness to outlier registrations.

Masking:

  • ASC-mask mode (p_computeBrainMasks = false, default): the reference image receives a mask built by OR-combining the ASC structures selected by p_maskSelector. Moving images are registered without a mask. Dilation (p_maskDilationRadius) is applied to the reference mask only.
  • Brain-mask mode (p_computeBrainMasks = true): every image (reference and moving) is skull-stripped independently. The reference mask is additionally dilated and stored in the ASC. Moving-image masks are attached undilated. p_maskSelector has no effect in this mode.

Public Types

enum class  ImageRole { Fixed , Moving , Ignored }
 Per-image role controlling which images participate in the next compute() call. More...
enum class  Transformation { Rigid , Affine }
enum class  Metric { MutualInformation , NormalizedCrossCorrelation , LC2 }
enum class  Initialization { None , BoundingBox , CenterOfMass }
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

 MultiVolumeRegistrationAlgorithm (std::vector< SharedImageSet * > images, int referenceIndex=0, AnatomicalStructureCollection *asc=nullptr)
 All images must be supplied upfront; the image at referenceIndex is fixed.
void compute () override
 Execute the algorithm.
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.
OwningDataList takeOutput () override
 Return any new Data that was created by the Algorithm during the last call to compute().
bool survivesDataDeletion (const Data *data) const override
 Indicates whether the algorithm can handle (partial) deletion of the specified data, by default this checks whether the data is in the input list.
RegistrationResultsresults ()
 Pose-history snapshots appended by each successful compute().
const RegistrationResultsresults () const
bool hasReferenceCoupledState () const
 Returns true when the current ASC / mask / result state is coupled to the active reference image and changing the reference may leave state stale or misaligned until rebuilt.
const std::vector< SharedImageSet * > & images () const
 All input images in the order they were supplied (reference included).
AnatomicalStructureCollectionasc () const
 Non-owning pointer to the ASC. Always valid after construction.
std::unique_ptr< GenericASCtakeOwnedAsc ()
 Transfers ownership of the internally created ASC to the caller.
bool setRole (int imageIndex, ImageRole role)
 Sets the role of the image at imageIndex.
ImageRole role (int imageIndex) const
void previewReferenceMask ()
 Rebuilds and applies the reference-image mask immediately, without running a full compute().
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.
Progressprogress () const
 Returns the progress interface if set.
virtual int status () const
 Indicates the status of the last call to compute().
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 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

Static Public Member Functions

static bool createCompatible (const DataList &data, Algorithm **a=nullptr)
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.

Public Attributes

Parameter< int > p_referenceIndex = {"referenceIndex", 0, this}
 Which image in images() is treated as the fixed reference.
Parameter< Transformation > p_transformation = {"transformation", Transformation::Rigid, this}
Parameter< Metric > p_metric = {"metric", Metric::MutualInformation, this}
Parameter< Initialization > p_initialization = {"initialization", Initialization::None, this}
Parameter< bool > p_consensus = {"consensus", false, this}
 When enabled, registers each moving image via multiple paths and selects the most consistent result.
Parameter< bool > p_computeBrainMasks = {"computeBrainMasks", false, this}
 When enabled, every input image is skull-stripped independently and the resulting brain mask is used to focus registration on brain tissue (CT inputs are not supported).
Parameter< int > p_maskDilationRadius = {"maskDilationRadius", 2, this}
 Dilation radius (in voxels) applied to the reference image mask before registration.
Parameter< AnatomyPlugin::Selectorp_maskSelector {"maskSelector", AnatomyPlugin::Selector{}, this}
 Selects which ASC entries (meshes and/or label map images) are OR-combined into a registration mask attached to the reference image only.
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.

Additional Inherited Members

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 Attributes inherited from ImFusion::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 ImFusion::Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.

Member Enumeration Documentation

◆ ImageRole

Per-image role controlling which images participate in the next compute() call.

Enumerator
Fixed 

Fixed registration reference. Exactly one image has this role at any time.

Moving 

Participates as a moving image; its pose will be updated by compute().

Ignored 

Excluded from the next compute(); its pose is not changed.

Constructor & Destructor Documentation

◆ MultiVolumeRegistrationAlgorithm()

ImFusion::Cranial::MultiVolumeRegistrationAlgorithm::MultiVolumeRegistrationAlgorithm ( std::vector< SharedImageSet * > images,
int referenceIndex = 0,
AnatomicalStructureCollection * asc = nullptr )
explicit

All images must be supplied upfront; the image at referenceIndex is fixed.

If no asc is provided, an internal one is created and accessible via asc().

Member Function Documentation

◆ compute()

void ImFusion::Cranial::MultiVolumeRegistrationAlgorithm::compute ( )
overridevirtual

Execute the algorithm.

Implements ImFusion::Algorithm.

◆ configure()

void ImFusion::Cranial::MultiVolumeRegistrationAlgorithm::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 ImFusion::Configurable.

◆ configuration()

void ImFusion::Cranial::MultiVolumeRegistrationAlgorithm::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 ImFusion::Configurable.

◆ takeOutput()

OwningDataList ImFusion::Cranial::MultiVolumeRegistrationAlgorithm::takeOutput ( )
overridevirtual

Return any new Data that was created by the Algorithm during the last call to compute().

The default implementation will return an empty list.

Note
Since ownership of the data is transferred, you can call this method only once between calls to compute().

Reimplemented from ImFusion::Algorithm.

◆ survivesDataDeletion()

bool ImFusion::Cranial::MultiVolumeRegistrationAlgorithm::survivesDataDeletion ( const Data * ) const
overridevirtual

Indicates whether the algorithm can handle (partial) deletion of the specified data, by default this checks whether the data is in the input list.

Reimplemented from ImFusion::Algorithm.

◆ results()

RegistrationResults & ImFusion::Cranial::MultiVolumeRegistrationAlgorithm::results ( )
inline

Pose-history snapshots appended by each successful compute().

results().apply(n) restores all image poses to step n. ASC state and registration masks are not tracked and are not affected by apply().

◆ takeOwnedAsc()

std::unique_ptr< GenericASC > ImFusion::Cranial::MultiVolumeRegistrationAlgorithm::takeOwnedAsc ( )
inline

Transfers ownership of the internally created ASC to the caller.

Returns nullptr if an external ASC was provided at construction time.

◆ setRole()

bool ImFusion::Cranial::MultiVolumeRegistrationAlgorithm::setRole ( int imageIndex,
ImageRole role )

Sets the role of the image at imageIndex.

Returns false if the index is out of range.

Note
The ASC is assumed to belong to the current reference. Changing the reference after masks or registration results have been computed invalidates them; a warning is logged.

◆ previewReferenceMask()

void ImFusion::Cranial::MultiVolumeRegistrationAlgorithm::previewReferenceMask ( )

Rebuilds and applies the reference-image mask immediately, without running a full compute().

In ASC-mask mode the mask is built from the current ASC selector; in brain-mask mode it is rebuilt from the stored brain label map. Either way, p_maskDilationRadius is applied. Moving-image masks are never touched by this call.

Member Data Documentation

◆ p_consensus

Parameter<bool> ImFusion::Cranial::MultiVolumeRegistrationAlgorithm::p_consensus = {"consensus", false, this}

When enabled, registers each moving image via multiple paths and selects the most consistent result.

Requires at least two moving images to have any effect.

◆ p_computeBrainMasks

Parameter<bool> ImFusion::Cranial::MultiVolumeRegistrationAlgorithm::p_computeBrainMasks = {"computeBrainMasks", false, this}

When enabled, every input image is skull-stripped independently and the resulting brain mask is used to focus registration on brain tissue (CT inputs are not supported).

The reference brain mask is dilated and stored in the ASC under Keys::Brain::key; moving-image masks are attached undilated and are not stored in the ASC. In this mode p_maskSelector has no effect; see p_computeBrainMasks = false for the ASC-based alternative that masks only the reference.

◆ p_maskDilationRadius

Parameter<int> ImFusion::Cranial::MultiVolumeRegistrationAlgorithm::p_maskDilationRadius = {"maskDilationRadius", 2, this}

Dilation radius (in voxels) applied to the reference image mask before registration.

Has no effect on moving-image masks; they are always attached undilated regardless of mode.

◆ p_maskSelector

Parameter<AnatomyPlugin::Selector> ImFusion::Cranial::MultiVolumeRegistrationAlgorithm::p_maskSelector {"maskSelector", AnatomyPlugin::Selector{}, this}

Selects which ASC entries (meshes and/or label map images) are OR-combined into a registration mask attached to the reference image only.

For label-map image entries, matching selector elements may optionally narrow the included labels via the @labelValues(v1, v2, ...) annotation. Has no effect when p_computeBrainMasks is enabled; in that mode all images are skull-stripped independently and p_maskSelector is ignored.


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