OpenWalnut  1.5.0dev
Public Member Functions | Private Member Functions | Private Attributes | List of all members
WHierarchicalTreeVoxels Class Reference

Class implements a hierarchical tree and provides helper functions for selection and navigation. More...

#include <WHierarchicalTreeVoxels.h>

+ Inheritance diagram for WHierarchicalTreeVoxels:
+ Collaboration diagram for WHierarchicalTreeVoxels:

Public Member Functions

 WHierarchicalTreeVoxels ()
 standard constructor More...
 
 ~WHierarchicalTreeVoxels ()
 destructor More...
 
std::vector< size_t > getVoxelsForCluster (size_t cluster)
 getter More...
 
void addLeaf (size_t voxelnum)
 A leaf is at the very bottom of the tree, it represents a single fiber or voxel, for several purposes a leaf also counts as a cluster. More...
 
void addCluster (size_t cluster1, size_t cluster2, float customData)
 adds a cluster to the set, it combines 2 already existing clusters More...
 
size_t getVoxelNum (size_t leaf)
 getter More...
 
std::vector< size_t > findClustersForValue (float value)
 finds the clusters for a given similarity value More...
 
std::vector< size_t > findClustersForBranchLength (float value, size_t minSize=100)
 finds the clusters for a given similarity value More...
 
std::vector< size_t > findXClusters (size_t root, size_t number)
 finds a number of clusters, the algorithm travers down the tree and will always split the cluster with the highest energy level. More...
 
- Public Member Functions inherited from WHierarchicalTree
 WHierarchicalTree ()
 standard constructor More...
 
virtual ~WHierarchicalTree ()
 destructor More...
 
size_t getLeafCount () const
 getter More...
 
size_t getClusterCount () const
 getter More...
 
size_t getMaxLevel () const
 getter More...
 
size_t getLevel (size_t cluster) const
 getter More...
 
size_t getParent (size_t cluster) const
 getter More...
 
float getCustomData (size_t cluster) const
 getter More...
 
void setColor (WColor color, size_t cluster)
 setter sets the color for a single cluster More...
 
WColor getColor (size_t cluster) const
 getter More...
 
std::pair< size_t, size_t > getChildren (size_t cluster) const
 getter More...
 
std::vector< size_t > getLeafesForCluster (size_t cluster) const
 getter More...
 
size_t size (size_t cluster) const
 getter More...
 
bool isLeaf (size_t cluster) const
 checks if a cluster is a leaf or a cluster More...
 
std::vector< size_t > downXLevelsFromTop (size_t level, bool hideOutliers=false) const
 returns a number of clusters at a certain level down from top cluster More...
 
std::vector< size_t > findXBiggestClusters (size_t cluster, size_t number=10) const
 finds the X biggest clusters for a given cluster More...
 
void colorCluster (size_t cluster, WColor color)
 sets the color for a selected cluster and all sub clusters More...
 

Private Member Functions

void addLeaf ()
 A leaf is at the very bottom of the tree, it represents a single fiber or voxel, for several purposes a leaf also counts as a cluster. More...
 

Private Attributes

std::vector< size_t > m_voxelnums
 stores the voxel id of each leaf node More...
 

Additional Inherited Members

- Protected Attributes inherited from WHierarchicalTree
size_t m_clusterCount
 overall number of cluster, counts both leafes ( clusters of size one ) and real clusters More...
 
size_t m_leafCount
 number of leaf nodes More...
 
size_t m_maxLevel
 the maximum level, naturally the level of the root node More...
 
bool m_leafesLocked
 to enforce valid datastructures there will be no leaf with an id higher than a cluster, thus when the first cluster is inserted, no leafes may be added More...
 
std::vector< size_t > m_level
 vector that stores the level of each cluster, the level is the maximum of the levels of the child clusters +1 More...
 
std::vector< size_t > m_parents
 vector that stores the parent cluster for each cluster More...
 
std::vector< std::pair< size_t, size_t > > m_children
 vector that stores the 2 children of each cluster, contains an empty pair for leafes More...
 
std::vector< float > m_customData
 custom data for each cluster, this may some energy or similarity level generated by the clustering algorithm or something completely different More...
 
std::vector< WColor > m_colors
 a color value for each cluster More...
 
std::vector< std::vector< size_t > > m_containsLeafes
 vector that stores the leaf id's for each cluster, this is quite memory intensive but speeds up selection of leafes for nodes at higher levels More...
 

Detailed Description

Class implements a hierarchical tree and provides helper functions for selection and navigation.

Definition at line 42 of file WHierarchicalTreeVoxels.h.

Constructor & Destructor Documentation

◆ WHierarchicalTreeVoxels()

WHierarchicalTreeVoxels::WHierarchicalTreeVoxels ( )

standard constructor

Definition at line 34 of file WHierarchicalTreeVoxels.cpp.

◆ ~WHierarchicalTreeVoxels()

WHierarchicalTreeVoxels::~WHierarchicalTreeVoxels ( )

destructor

Definition at line 39 of file WHierarchicalTreeVoxels.cpp.

Member Function Documentation

◆ addCluster()

void WHierarchicalTreeVoxels::addCluster ( size_t  cluster1,
size_t  cluster2,
float  customData 
)

adds a cluster to the set, it combines 2 already existing clusters

Parameters
cluster1first cluster to add
cluster2second cluster to add
customDatasome arbitrary data stored with the cluster

Definition at line 68 of file WHierarchicalTreeVoxels.cpp.

References WHierarchicalTree::m_children, WHierarchicalTree::m_clusterCount, WHierarchicalTree::m_colors, WHierarchicalTree::m_containsLeafes, WHierarchicalTree::m_customData, WHierarchicalTree::m_leafesLocked, WHierarchicalTree::m_level, WHierarchicalTree::m_maxLevel, WHierarchicalTree::m_parents, and WHierarchicalTree::size().

Referenced by WMClusterDisplayVoxels::loadClustering().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addLeaf() [1/2]

void WHierarchicalTreeVoxels::addLeaf ( )
privatevirtual

A leaf is at the very bottom of the tree, it represents a single fiber or voxel, for several purposes a leaf also counts as a cluster.

Implements WHierarchicalTree.

Definition at line 43 of file WHierarchicalTreeVoxels.cpp.

◆ addLeaf() [2/2]

void WHierarchicalTreeVoxels::addLeaf ( size_t  voxelnum)

A leaf is at the very bottom of the tree, it represents a single fiber or voxel, for several purposes a leaf also counts as a cluster.

Parameters
voxelnumthe voxel id for this leaf

Definition at line 47 of file WHierarchicalTreeVoxels.cpp.

References WHierarchicalTree::m_children, WHierarchicalTree::m_clusterCount, WHierarchicalTree::m_colors, WHierarchicalTree::m_containsLeafes, WHierarchicalTree::m_customData, WHierarchicalTree::m_leafCount, WHierarchicalTree::m_leafesLocked, WHierarchicalTree::m_level, WHierarchicalTree::m_parents, and m_voxelnums.

Referenced by WMClusterDisplayVoxels::loadClustering().

+ Here is the caller graph for this function:

◆ findClustersForBranchLength()

std::vector< size_t > WHierarchicalTreeVoxels::findClustersForBranchLength ( float  value,
size_t  minSize = 100 
)

finds the clusters for a given similarity value

Parameters
valueonly return clusters where the distance in energy level to its parent is large than this value
minSizeonly return clusters with a number of voxels large than minSize
Returns
all clusters below that value

Definition at line 148 of file WHierarchicalTreeVoxels.cpp.

References WHierarchicalTree::m_children, WHierarchicalTree::m_clusterCount, WHierarchicalTree::m_containsLeafes, WHierarchicalTree::m_customData, WHierarchicalTree::m_leafCount, WHierarchicalTree::m_parents, and WHierarchicalTree::size().

Referenced by WMClusterDisplayVoxels::updateAll().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findClustersForValue()

std::vector< size_t > WHierarchicalTreeVoxels::findClustersForValue ( float  value)

finds the clusters for a given similarity value

Parameters
value
Returns
all clusters below that value

Definition at line 107 of file WHierarchicalTreeVoxels.cpp.

References WHierarchicalTree::getCustomData(), WHierarchicalTree::m_children, WHierarchicalTree::m_clusterCount, WHierarchicalTree::m_containsLeafes, and WHierarchicalTree::size().

Referenced by WMClusterDisplayVoxels::updateAll().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findXClusters()

std::vector< size_t > WHierarchicalTreeVoxels::findXClusters ( size_t  root,
size_t  number 
)

finds a number of clusters, the algorithm travers down the tree and will always split the cluster with the highest energy level.

Parameters
rootthe cluster to start traversing the tree from
numberthe number of cluster we want to find
Returns
the clusters

Definition at line 171 of file WHierarchicalTreeVoxels.cpp.

References WHierarchicalTree::m_children, and WHierarchicalTree::m_customData.

Referenced by WMClusterDisplayVoxels::updateAll().

+ Here is the caller graph for this function:

◆ getVoxelNum()

size_t WHierarchicalTreeVoxels::getVoxelNum ( size_t  leaf)
inline

getter

Parameters
leaf
Returns
the voxel num of a leaf node in the tree

Definition at line 120 of file WHierarchicalTreeVoxels.h.

References m_voxelnums.

◆ getVoxelsForCluster()

std::vector< size_t > WHierarchicalTreeVoxels::getVoxelsForCluster ( size_t  cluster)

getter

Parameters
clusterthe cluster to work on
Returns
vector of voxels contained by this cluster

Definition at line 96 of file WHierarchicalTreeVoxels.cpp.

References WHierarchicalTree::getLeafesForCluster(), and m_voxelnums.

Referenced by WMClusterDisplayVoxels::updateAll().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_voxelnums

std::vector<size_t> WHierarchicalTreeVoxels::m_voxelnums
private

stores the voxel id of each leaf node

Definition at line 117 of file WHierarchicalTreeVoxels.h.

Referenced by addLeaf(), getVoxelNum(), and getVoxelsForCluster().


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