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;
Holds basic information about a cluster.
Class for handling cluster references.
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)
Merges cluster determined by ref1 and 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
Returns the cluster info for a given rank.
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)
Returns a new, unique cluster reference.
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
Returns a list of all clusters.
Container class derived from ClusterInfo.
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.
ClusterRefType * link
Holds pointer to another element in array stored in ClusterRefCollection.
#define ML_FORCE_INLINE
Forcing the use of 'inline' for methods.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
MLuint64 MLuint
An unsigned ML integer type with at least 64 bits used for index calculations on very large images ev...
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
Cluster user data parameters.