25 #ifndef WHIERARCHICALTREE_H
26 #define WHIERARCHICALTREE_H
33 #include <boost/shared_ptr.hpp>
104 void setColor( WColor color,
size_t cluster );
118 std::pair<size_t, size_t>
getChildren(
size_t cluster );
132 size_t size(
size_t cluster );
139 bool isLeaf(
size_t cluster );
265 return std::pair<size_t, size_t>( cluster, cluster );
322 return m_tree->
size( lhs ) > m_tree->
size( rhs );
352 #endif // WHIERARCHICALTREE_H
size_t m_maxLevel
the maximum level, naturally the level of the root node
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...
size_t m_leafCount
number of leaf nodes
compSize(WHierarchicalTree *tree)
constructor
implements a compare operator for clusters, depending on leaf count
WColor getColor(size_t cluster)
getter
size_t getParent(size_t cluster)
getter
implements a compare operator for clusters, depending on custom value of the cluster ...
compValue(WHierarchicalTree *tree)
constructor
std::pair< size_t, size_t > getChildren(size_t cluster)
getter
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 selec...
std::vector< float > m_customData
custom data for each cluster, this may some energy or similarity level generated by the clustering al...
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< size_t > findXBiggestClusters(size_t cluster, size_t number=10)
finds the X biggest clusters for a given cluster
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
bool operator()(const size_t lhs, const size_t rhs) const
compares two clusters
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 clu...
size_t getLeafCount()
getter
WHierarchicalTree * m_tree
stores pointer to tree we work on
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 > m_parents
vector that stores the parent cluster for each cluster
base class for hierarchical tree implementations
bool isLeaf(size_t cluster)
checks if a cluster is a leaf or a cluster
WHierarchicalTree * m_tree
stores pointer to tree we work on
float getCustomData(size_t cluster)
getter
std::vector< size_t > getLeafesForCluster(size_t cluster)
getter
size_t size(size_t cluster)
getter
size_t m_clusterCount
overall number of cluster, counts both leafes ( clusters of size one ) and real clusters ...
bool operator()(const size_t lhs, const size_t rhs) const
compares two clusters
WHierarchicalTree()
standard constructor
void setColor(WColor color, size_t cluster)
setter sets the color for a single cluster
size_t getClusterCount()
getter
void colorCluster(size_t cluster, WColor color)
sets the color for a selected cluster and all sub clusters
std::vector< WColor > m_colors
a color value for each cluster
size_t getMaxLevel()
getter
size_t getLevel(size_t cluster)
getter