25 #ifndef WHIERARCHICALTREE_H
26 #define WHIERARCHICALTREE_H
83 size_t getLevel(
size_t cluster )
const;
104 void setColor( WColor color,
size_t cluster );
111 WColor
getColor(
size_t cluster )
const;
118 std::pair<size_t, size_t>
getChildren(
size_t cluster )
const;
132 size_t size(
size_t cluster )
const;
139 bool isLeaf(
size_t cluster )
const;
147 std::vector< size_t >
downXLevelsFromTop(
size_t level,
bool hideOutliers =
false )
const;
265 return std::pair<size_t, size_t>( cluster, cluster );
base class for hierarchical tree implementations
std::vector< float > m_customData
custom data for each cluster, this may some energy or similarity level generated by the clustering al...
size_t size(size_t cluster) const
getter
std::vector< WColor > m_colors
a color value for each cluster
bool isLeaf(size_t cluster) const
checks if a cluster is a leaf or a cluster
size_t m_clusterCount
overall number of cluster, counts both leafes ( clusters of size one ) and real clusters
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::pair< size_t, size_t > getChildren(size_t cluster) const
getter
WColor getColor(size_t cluster) const
getter
size_t getParent(size_t cluster) const
getter
std::vector< size_t > m_parents
vector that stores the parent cluster for each cluster
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
void colorCluster(size_t cluster, WColor color)
sets the color for a selected cluster and all sub clusters
float getCustomData(size_t cluster) const
getter
size_t m_leafCount
number of leaf nodes
size_t m_maxLevel
the maximum level, naturally the level of the root node
size_t getLevel(size_t cluster) const
getter
std::vector< size_t > getLeafesForCluster(size_t cluster) const
getter
virtual void addLeaf()=0
A leaf is at the very bottom of the tree, it represents a single fiber or voxel, for several purposes...
std::vector< size_t > findXBiggestClusters(size_t cluster, size_t number=10) const
finds the X biggest clusters for a given cluster
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() const
getter
virtual ~WHierarchicalTree()
destructor
bool m_leafesLocked
to enforce valid datastructures there will be no leaf with an id higher than a 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 selec...
size_t getClusterCount() const
getter
void setColor(WColor color, size_t cluster)
setter sets the color for a single cluster
size_t getMaxLevel() const
getter
WHierarchicalTree()
standard constructor
implements a compare operator for clusters, depending on leaf count
bool operator()(const size_t lhs, const size_t rhs) const
compares two clusters
compSize(const WHierarchicalTree *tree)
constructor
const WHierarchicalTree * m_tree
stores pointer to tree we work on
implements a compare operator for clusters, depending on custom value of the cluster
compValue(WHierarchicalTree *tree)
constructor
bool operator()(const size_t lhs, const size_t rhs) const
compares two clusters
WHierarchicalTree * m_tree
stores pointer to tree we work on