ImFusion SDK 4.3
KeypointExtractionAlgorithm Class Reference

#include <ImFusion/ML/KeypointExtractionAlgorithm.h>

Algorithm for extracting keypoints from blobs representing the probability distribution of the keypoint location. More...

+ Inheritance diagram for KeypointExtractionAlgorithm:

Detailed Description

Algorithm for extracting keypoints from blobs representing the probability distribution of the keypoint location.

Public Types

enum class  ExtractionMode { MAX = 0 , MEAN = 1 , LOCAL_MAX = 2 }
 specify how to aggregate blobs into keypoints Max: global max for each channel (1 point/channels) Mean: global mean for each channel (1 point/channels) Local Max: clustering of local blob maxima for each channel (multiple points/channels)
 
enum class  ClusterMergingMode { AVERAGE = 0 , MAX = 1 }
 In case the Local Max extraction mode is used, define how to merge clusters that are below the p_minClusterDist threshold. More...
 
- 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

 KeypointExtractionAlgorithm (const SharedImageSet *image=nullptr)
 Constructor.
 
 ~KeypointExtractionAlgorithm () override
 Destructor.
 
void setImage (const SharedImageSet *image)
 image setter
 
void compute () override
 Execute the algorithm.
 
void configuration (Properties *p) const override
 Retrieve the properties of this object.
 
OwningDataList takeOutput () override
 Generated output is added to the data list.
 
std::vector< std::vector< vec3 > > extractKeypoints (const SharedImage &blobs) const
 Given the predicted blobs, aggregates them into a collection of points.
 
- Public Member Functions inherited from 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().
 
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 configure (const Properties *p)
 Configure this object instance by de-serializing the given Properties.
 
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
 

Static Public Member Functions

static bool createCompatible (const DataList &data, Algorithm **a=nullptr)
 If data is compatible with algorithm return true. If a is not zero, create algorithm with input data.
 
static std::vector< std::tuple< vec3, double > > clusterSingleChannelBlob (const SharedImageSet *blob, double blobIntensityCutoff, double minClusterDistance, double minClusterWeight, size_t maxInternalClusters=1000, bool runSmoothing=false, int smoothingHalfKernel=2, bool intensityBasedRefinement=false, ClusterMergingMode mergineMode=ClusterMergingMode::AVERAGE)
 Aggregates the cluster found in single blob channel into different cluster centers representing different instances of the same landmark class.
 
static void runKMeans (std::vector< vec3 > &inOutCenters, std::vector< double > &outCenterWeights, const std::vector< vec3 > &voxels, const std::vector< double > &voxelWeights, std::vector< mat3 > &inOutCovs, std::vector< int > &outVoxelMembership)
 K-mean clustering.
 
static std::vector< vec3 > initKMeansPlusPlus (const std::vector< vec3 > &voxels, int numClusters, Random::Generator &generator=Random::globalGenerator())
 Compute cluster center initialization with K-means++.
 
- 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< ExtractionModep_extractionMode = {"keypointExtractionMode", ExtractionMode::MAX, this}
 How to aggregate the blobs into points See Documentation for ExtractionMode enum.
 
Parameter< double > p_blobIntensityCutoff = {"blobIntensityCutoff", 0.02, this}
 Minimum blob intensity to be considered in analysis.
 
Parameter< double > p_minClusterDist = {"minClusterDistance", 10., this}
 In case of local aggregation methods, minimum distance allowed among clusters.
 
Parameter< double > p_minClusterWeight = {"minClusterWeight", 0.1, this}
 In case of local aggregation methods, minimum intensity for cluster to be consider independent.
 
Parameter< ClusterMergingModep_clusterMergingMode = {"Cluster Merging Mode", ClusterMergingMode::AVERAGE, this}
 In case of local aggregation methods, minimum distance allowed among clusters.
 
Parameter< size_t > p_maxInternalClusters = {"maxInternalClusters", 1000, this}
 In case of local aggregation methods, maximum number of internal clusters to be considered; to avoid excessive numbers that stall the algorithm.
 
Parameter< bool > p_runSmoothing = {"runSmoothing", false, this}
 Runs a Gaussian smoothing with 1 pixel standard deviation to improve stability of local maxima.
 
Parameter< int > p_smoothingHalfKernel = {"smoothingHalfKernel", 2, this}
 Runs a Gaussian smoothing with 1 pixel standard deviation to improve stability of local maxima.
 
Parameter< bool > p_intensityBasedRefinement = {"runIntensityRefinement", false, this}
 Runs blob intensity based refinement of clustered keypoints.
 
- 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.
 

Additional Inherited Members

- 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 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 Enumeration Documentation

◆ ClusterMergingMode

enum class ClusterMergingMode
strong

In case the Local Max extraction mode is used, define how to merge clusters that are below the p_minClusterDist threshold.

If AVERAGE, neighbouring clusters below the threshold are averaged. If MAX, the cluster with the highest intensity is kept and the other removed.

Member Function Documentation

◆ compute()

void compute ( )
overridevirtual

Execute the algorithm.

Implements Algorithm.

◆ configuration()

void configuration ( Properties * p) const
overridevirtual

Retrieve the properties of this object.

Reimplemented from Configurable.

◆ takeOutput()

OwningDataList takeOutput ( )
overridevirtual

Generated output is added to the data list.

Reimplemented from Algorithm.

◆ extractKeypoints()

std::vector< std::vector< vec3 > > extractKeypoints ( const SharedImage & blobs) const

Given the predicted blobs, aggregates them into a collection of points.

Specifically, the outer vector lists the different landmark classes (number of blob channels), while the inner vector lists the different instances of the same landmark class found in a single blob channel.

◆ clusterSingleChannelBlob()

static std::vector< std::tuple< vec3, double > > clusterSingleChannelBlob ( const SharedImageSet * blob,
double blobIntensityCutoff,
double minClusterDistance,
double minClusterWeight,
size_t maxInternalClusters = 1000,
bool runSmoothing = false,
int smoothingHalfKernel = 2,
bool intensityBasedRefinement = false,
ClusterMergingMode mergineMode = ClusterMergingMode::AVERAGE )
static

Aggregates the cluster found in single blob channel into different cluster centers representing different instances of the same landmark class.

Each cluster center is bundled with its own cluster weight (vec3, double). This function is used in cases where local filtering of the blob is required, i.e. for multi-instance landmark detection. Use this function if you need to further manipulate the aggregated clusters.

◆ runKMeans()

static void runKMeans ( std::vector< vec3 > & inOutCenters,
std::vector< double > & outCenterWeights,
const std::vector< vec3 > & voxels,
const std::vector< double > & voxelWeights,
std::vector< mat3 > & inOutCovs,
std::vector< int > & outVoxelMembership )
static

K-mean clustering.

Inputs are the centers, voxels, and weights for each voxel. Outputs are the new centers, center weights, covariances of each center, and new membership of each voxel.

◆ initKMeansPlusPlus()

static std::vector< vec3 > initKMeansPlusPlus ( const std::vector< vec3 > & voxels,
int numClusters,
Random::Generator & generator = Random::globalGenerator() )
static

Compute cluster center initialization with K-means++.

Non-deterministic algorithm, so the result may vary between runs.

Note
Uses the optional Random::Generator for random number generation, Random::globalGenerator by default. This means one can pass a specific generator to ensure reproducibility.
Parameters
voxelsThe voxels to cluster
numClustersThe number of clusters to initialize
Returns
The cluster centers

Member Data Documentation

◆ p_maxInternalClusters

Parameter<size_t> p_maxInternalClusters = {"maxInternalClusters", 1000, this}

In case of local aggregation methods, maximum number of internal clusters to be considered; to avoid excessive numbers that stall the algorithm.

If there are more, the lower weighted ones are removed first.


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