MeVisLab Toolbox Reference
ml::ClusterAlgorithm< CLUSTERVOXELTYPE, DerivedAlgorithm > Class Template Reference

Type specific implementations of the interface class for clustering algorithms. More...

#include <mlClusterAlgorithm.h>

Inheritance diagram for ml::ClusterAlgorithm< CLUSTERVOXELTYPE, DerivedAlgorithm >:
ml::ClusterAlgorithmBase

Public Types

typedef CLUSTERVOXELTYPE ClusterVoxelType
 The used type of the voxels, needed by derived classes.
 

Public Member Functions

 ClusterAlgorithm (const ComputeClusterParameters &parameters, Clusters *clusters)
 Constructor to be used.
 
MLErrorCode runClustering ()
 
MLErrorCode processSlice (MLint zi, const ImageVector &inputImageExtent, TSubImage< MLint8 > &inMaskSlice)
 
- Public Member Functions inherited from ml::ClusterAlgorithmBase
 ClusterAlgorithmBase (const ComputeClusterParameters &parameters, Clusters *clusters)
 Constructor to be used.
 
virtual ~ClusterAlgorithmBase ()
 Default virtual destructor.
 
bool hasResults () const
 Returns whether getCluster() and getClusterOfVoxel() contains cluster data.
 

Protected Member Functions

MLuint updateClusterRefForNeighbor (void *neighborVoxelPtr, MLint x, MLint y, MLint z, CLUSTERVOXELTYPE currentValue, MLuint currentClusterRef)
 Checks if neighbor at position x,y,z belongs to the same cluster given by currentClusterRef.
 
MLErrorCode calcClustersForSlices ()
 Template applying cluster calculations for one slice.
 
- Protected Member Functions inherited from ml::ClusterAlgorithmBase
void setInSliceVoxelType (MLDataType dt)
 Sets voxel type of input slices.
 
void freeInSliceData ()
 Releases memory of input image slices.
 
void storeNextSlice (SubImage &slice)
 Sets next image data, expects the data to be managed by memory manager.
 
MLErrorCode loadNextSlice (MLint sliceNr, const ImageVector &inImgExt)
 Gets next image data.
 
MLErrorCode loadMaskSlice (TSubImage< MLint8 > &slice, MLint sliceNr, const ImageVector &inImgExt) const
 Gets current slice of the mask image.
 
MLuint mergeClusterReference (MLint x, MLint y, MLint z, MLuint currClusterRef)
 Merges a cluster reference currClusterRef for position (x,y,z).
 
void setResultFlag (bool result)
 Sets internal result flag to result.
 

Static Protected Member Functions

static CLUSTERVOXELTYPE convertBackgroundValue (MLdouble backgroundValue)
 

Additional Inherited Members

- Protected Types inherited from ml::ClusterAlgorithmBase
enum  { _NR_OF_SUBIMAGES = 2 }
 We do not load the whole image into memory, only keep two slices at once. More...
 
- Protected Attributes inherited from ml::ClusterAlgorithmBase
enum ml::ClusterAlgorithmBase:: { ... }  NumInImagesEnum
 We do not load the whole image into memory, only keep two slices at once.
 
Clusters_clusters
 Result clusters.
 
SubImage _currentSlices [_NR_OF_SUBIMAGES]
 do not load the whole image into memory, only keep two slices at once
 
ComputeClusterParameters _parameters
 

Detailed Description

template<typename CLUSTERVOXELTYPE, typename DerivedAlgorithm>
class ml::ClusterAlgorithm< CLUSTERVOXELTYPE, DerivedAlgorithm >

Type specific implementations of the interface class for clustering algorithms.

Derived classes should derive from this class.

The derived class needs to pass its class name as second template argument to ClusterAlgorithm, this allows static dispatch to overloaded members (Curiously recurring template pattern).

The derived class needs to implement getVoxel() and isInTolerance(), see IdenticalIntensitiesClusterAlgorithm for an example.

Definition at line 221 of file mlClusterAlgorithm.h.

Member Typedef Documentation

◆ ClusterVoxelType

The used type of the voxels, needed by derived classes.

Definition at line 226 of file mlClusterAlgorithm.h.

Constructor & Destructor Documentation

◆ ClusterAlgorithm()

Constructor to be used.

Definition at line 229 of file mlClusterAlgorithm.h.

Member Function Documentation

◆ calcClustersForSlices()

Template applying cluster calculations for one slice.

Returns
ML_RESULT_OK in case of successful processing, otherwise an error code describing the problem.

Definition at line 269 of file mlClusterAlgorithm.h.

References ml::ClusterHandler< CLUSTERVOXELTYPE, DerivedAlgorithm >::getErrorCode(), ML_RESULT_OK, mlrange_cast(), NBH_2D_4_XY, NBH_2D_8_XY, ml::ClusterHandler< CLUSTERVOXELTYPE, DerivedAlgorithm >::setParameters(), and ml::ClusterUserDataParameters::useImageValueAsUserData.

◆ convertBackgroundValue()

static CLUSTERVOXELTYPE ml::ClusterAlgorithm< CLUSTERVOXELTYPE, DerivedAlgorithm >::convertBackgroundValue ( MLdouble backgroundValue)
inlinestaticprotected

Definition at line 262 of file mlClusterAlgorithm.h.

References mlrange_cast().

◆ processSlice()

◆ runClustering()

◆ updateClusterRefForNeighbor()

MLuint ml::ClusterAlgorithm< CLUSTERVOXELTYPE, DerivedAlgorithm >::updateClusterRefForNeighbor ( void * neighborVoxelPtr,
MLint x,
MLint y,
MLint z,
CLUSTERVOXELTYPE currentValue,
MLuint currentClusterRef )
inlineprotected

Checks if neighbor at position x,y,z belongs to the same cluster given by currentClusterRef.

Parameters
neighborVoxelPtrPointer to the neighbor voxel
x,y,zPosition of neighbor in image coordinates.
currentValueCurrently examined voxel.
currentClusterRefCluster reference of currently examined voxel.
Returns
The cluster reference after checking the neighbor. Can differ from currentClusterRef due to cluster merging.

Definition at line 248 of file mlClusterAlgorithm.h.

References mlrange_cast().


The documentation for this class was generated from the following file: