OpenWalnut  1.3.1
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:

Public Member Functions

 WHierarchicalTreeVoxels ()
 standard constructor
 ~WHierarchicalTreeVoxels ()
 destructor
std::vector< size_t > getVoxelsForCluster (size_t cluster)
 getter
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.
void addCluster (size_t cluster1, size_t cluster2, float customData)
 adds a cluster to the set, it combines 2 already existing clusters
size_t getVoxelNum (size_t leaf)
 getter
std::vector< size_t > findClustersForValue (float value)
 finds the clusters for a given similarity value
std::vector< size_t > findClustersForBranchLength (float value, size_t minSize=100)
 finds the clusters for a given similarity value
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.
- Public Member Functions inherited from WHierarchicalTree
 WHierarchicalTree ()
 standard constructor
virtual ~WHierarchicalTree ()
 destructor
virtual void addLeaf ()=0
 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.
size_t getLeafCount ()
 getter
size_t getClusterCount ()
 getter
size_t getMaxLevel ()
 getter
size_t getLevel (size_t cluster)
 getter
size_t getParent (size_t cluster)
 getter
float getCustomData (size_t cluster)
 getter
void setColor (WColor color, size_t cluster)
 setter sets the color for a single cluster
WColor getColor (size_t cluster)
 getter
std::pair< size_t, size_t > getChildren (size_t cluster)
 getter
std::vector< size_t > getLeafesForCluster (size_t cluster)
 getter
size_t size (size_t cluster)
 getter
bool isLeaf (size_t cluster)
 checks if a cluster is a leaf or a cluster
std::vector< size_t > downXLevelsFromTop (size_t level, bool hideOutliers=false)
 returns a number of clusters at a certain level down from top cluster
std::vector< size_t > findXBiggestClusters (size_t cluster, size_t number=10)
 finds the X biggest clusters for a given cluster
void colorCluster (size_t cluster, WColor color)
 sets the color for a selected cluster and all sub clusters

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.

Private Attributes

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

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
size_t m_leafCount
 number of leaf nodes
size_t m_maxLevel
 the maximum level, naturally the level of the root node
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
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
std::vector< size_t > m_parents
 vector that stores the parent cluster for each cluster
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
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
std::vector< WColor > m_colors
 a color value for each cluster
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

Detailed Description

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

Definition at line 43 of file WHierarchicalTreeVoxels.h.

Constructor & Destructor Documentation

WHierarchicalTreeVoxels::WHierarchicalTreeVoxels ( )

standard constructor

Definition at line 34 of file WHierarchicalTreeVoxels.cpp.

WHierarchicalTreeVoxels::~WHierarchicalTreeVoxels ( )

destructor

Definition at line 39 of file WHierarchicalTreeVoxels.cpp.

Member Function Documentation

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().

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.

void WHierarchicalTreeVoxels::addLeaf ( )
private

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.

Definition at line 43 of file WHierarchicalTreeVoxels.cpp.

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().

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().

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.

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 121 of file WHierarchicalTreeVoxels.h.

References m_voxelnums.

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.

Member Data Documentation

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

stores the voxel id of each leaf node

Definition at line 118 of file WHierarchicalTreeVoxels.h.

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


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