13#ifndef ML_CLUSTER_REF_COLLECTION_H
14#define ML_CLUSTER_REF_COLLECTION_H
147 while (root->
link !=
nullptr)
154 MLuint getTotalNumVoxelsInClusters(
const std::vector<ClusterRefType>& clusters)
const;
155 void countClustersAndCopyToSortVector();
156 void countVoxelsForClusters();
157 void setRankAndUserDataToClusters(
const ClusterUserDataParameters& userDataParameters);
158 void setRankAndUserDataToBackgroundCluster(
const ClusterUserDataParameters& userDataParameters);
166 ClusterRefType* _clusterRefs;
168 ClusterRefType _backgroundCluster;
183 std::vector<ClusterRefType> _clustersSortedBySize;
MLuint _indexId
Unique cluster id; default is 0.
MLuint _numVoxels
Cluster size in voxel; default is 0.
MLuint _rank
Rank of the cluster size compared to other cluster; default is 0.
ClusterInfo()
Default constructor.
MLuint getNumClusters() const
Returns the number of clusters.
ML_FORCE_INLINE const ClusterInfo & getBackground() const
Returns the background cluster info.
MLuint getNumVoxelsInCluster(MLuint rankId) const
Returns the number of voxels of the cluster with the given rank id.
void init(MLuint numVoxels)
Clear ClusterRefCollection and set it to an initialized state.
MLuint merge(MLuint ref1, MLuint ref2)
void addPositionToBackgroundBoundingBox(MLint x, MLint y, MLint z)
Adds the given positions to the bounding box of the background cluster.
const ClusterInfo & getClusterAt(MLuint rank) const
ClusterRefCollection(MLuint initialCapacity=10)
void calcClusterSizes(const ClusterUserDataParameters &userDataParameters)
Calculates the cluster sizes and sorts the found cluster by size.
const ClusterInfo & getClusterInfo(MLuint reference) const
Returns the cluster info for the given reference.
MLuint getNewReference(MLdouble imageValue)
void incrementClusterSize(MLuint reference)
Increments the size of cluster pointed to by reference.
void addPositionToClusterBoundingBox(MLuint rank, MLint x, MLint y, MLint z)
Adds the given positions to the bounding box of the cluster with the given rank.
void setUserDataAtRank(MLuint rank, MLdouble userData)
Sets the user data value for a cluster with the given rank.
std::vector< ClusterInfo > getClusterInfoList() const
ML_FORCE_INLINE void setNumVoxels(MLuint newNumVoxels)
Sets the cluster size in voxel.
ML_FORCE_INLINE void setIndexId(MLuint newIndex)
Sets a table index.
ML_FORCE_INLINE void setRank(MLuint newRank)
Sets the rank of the cluster.
Cluster user data parameters.