OpenWalnut  1.4.0
Public Member Functions | Protected Attributes
WHierarchicalTree Class Reference

base class for hierarchical tree implementations More...

#include <WHierarchicalTree.h>

+ Inheritance diagram for WHierarchicalTree:

List of all members.

Public Member Functions

 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_tgetChildren (size_t cluster)
 getter
std::vector< size_tgetLeafesForCluster (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_tdownXLevelsFromTop (size_t level, bool hideOutliers=false)
 returns a number of clusters at a certain level down from top cluster
std::vector< size_tfindXBiggestClusters (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

Protected Attributes

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_tm_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_tm_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

base class for hierarchical tree implementations

Definition at line 41 of file WHierarchicalTree.h.


Constructor & Destructor Documentation

standard constructor

Definition at line 30 of file WHierarchicalTree.cpp.

destructor

Definition at line 38 of file WHierarchicalTree.cpp.


Member Function Documentation

virtual void WHierarchicalTree::addLeaf ( ) [pure virtual]

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.

Implemented in WHierarchicalTreeVoxels, and WHierarchicalTreeFibers.

void WHierarchicalTree::colorCluster ( size_t  cluster,
WColor  color 
)

sets the color for a selected cluster and all sub clusters

Parameters:
cluster
color

Definition at line 182 of file WHierarchicalTree.cpp.

References m_children, m_colors, m_containsLeafes, and size().

std::vector< size_t > WHierarchicalTree::downXLevelsFromTop ( size_t  level,
bool  hideOutliers = false 
)

returns a number of clusters at a certain level down from top cluster

Parameters:
levelhow many levels to go down
hideOutlierstrue if clusters of size 1 should be ignored
Returns:
vector containing the cluster id's

Definition at line 125 of file WHierarchicalTree.cpp.

References m_children, m_clusterCount, m_containsLeafes, m_maxLevel, and size().

std::vector< size_t > WHierarchicalTree::findXBiggestClusters ( size_t  cluster,
size_t  number = 10 
)

finds the X biggest clusters for a given cluster

Parameters:
cluster
numberof sub clusters
Returns:
the biggest clusters

Definition at line 42 of file WHierarchicalTree.cpp.

References m_children, m_containsLeafes, and size().

std::pair< size_t, size_t > WHierarchicalTree::getChildren ( size_t  cluster) [inline]

getter

Returns:
the number of clusters

Definition at line 228 of file WHierarchicalTree.h.

References m_clusterCount.

Referenced by WHierarchicalTreeFibers::getBestClustersFittingRoi().

WColor WHierarchicalTree::getColor ( size_t  cluster) [inline]

getter

Parameters:
cluster
Returns:
the color for the selected cluster

Definition at line 284 of file WHierarchicalTree.h.

References m_colors.

Referenced by WDendrogramGeode::layoutLevel(), and WDendrogramGeode::layoutValue().

float WHierarchicalTree::getCustomData ( size_t  cluster) [inline]

getter

Parameters:
cluster
Returns:
the custom data for the selected cluster

Definition at line 269 of file WHierarchicalTree.h.

References m_customData.

Referenced by WHierarchicalTreeVoxels::findClustersForValue(), WDendrogramGeode::getClickClusterRecursive2(), WDendrogramGeode::layoutValue(), and compValue::operator()().

getter

Returns:
the number of leafes

Definition at line 223 of file WHierarchicalTree.h.

References m_leafCount.

std::vector< size_t > WHierarchicalTree::getLeafesForCluster ( size_t  cluster) [inline]

getter

Parameters:
cluster
Returns:
the leafes contained in the selected cluster

Definition at line 294 of file WHierarchicalTree.h.

References m_containsLeafes.

Referenced by WHierarchicalTreeVoxels::getVoxelsForCluster(), and size().

size_t WHierarchicalTree::getLevel ( size_t  cluster) [inline]

getter

Returns:
maxlevel, i.e. the level of the root cluster

Definition at line 233 of file WHierarchicalTree.h.

References m_maxLevel.

getter

Parameters:
clusterthe cluster in question
Returns:
the parent for the selected cluster

Definition at line 243 of file WHierarchicalTree.h.

References m_level, m_maxLevel, and m_parents.

bool WHierarchicalTree::isLeaf ( size_t  cluster) [inline]

checks if a cluster is a leaf or a cluster

Parameters:
cluster
Returns:
true if it is a leaf

Definition at line 289 of file WHierarchicalTree.h.

References m_leafCount.

void WHierarchicalTree::setColor ( WColor  color,
size_t  cluster 
) [inline]

setter sets the color for a single cluster

Parameters:
color
cluster

Definition at line 279 of file WHierarchicalTree.h.

References m_colors.

size_t WHierarchicalTree::size ( size_t  cluster) [inline]

Member Data Documentation

std::vector< std::pair< size_t, size_t> > WHierarchicalTree::m_children [protected]
std::vector<WColor> WHierarchicalTree::m_colors [protected]
std::vector< std::vector<size_t> > WHierarchicalTree::m_containsLeafes [protected]
std::vector<float> WHierarchicalTree::m_customData [protected]

custom data for each cluster, this may some energy or similarity level generated by the clustering algorithm or something completely different

Definition at line 207 of file WHierarchicalTree.h.

Referenced by WHierarchicalTreeFibers::addCluster(), WHierarchicalTreeVoxels::addCluster(), WHierarchicalTreeFibers::addLeaf(), WHierarchicalTreeVoxels::addLeaf(), WHierarchicalTreeVoxels::findClustersForBranchLength(), WHierarchicalTreeVoxels::findXClusters(), and getCustomData().

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

Definition at line 186 of file WHierarchicalTree.h.

Referenced by WHierarchicalTreeFibers::addCluster(), WHierarchicalTreeVoxels::addCluster(), WHierarchicalTreeFibers::addLeaf(), and WHierarchicalTreeVoxels::addLeaf().

std::vector<size_t> WHierarchicalTree::m_level [protected]

vector that stores the level of each cluster, the level is the maximum of the levels of the child clusters +1

Definition at line 191 of file WHierarchicalTree.h.

Referenced by WHierarchicalTreeFibers::addCluster(), WHierarchicalTreeVoxels::addCluster(), WHierarchicalTreeFibers::addLeaf(), WHierarchicalTreeVoxels::addLeaf(), getChildren(), getLevel(), and getParent().

the maximum level, naturally the level of the root node

Definition at line 180 of file WHierarchicalTree.h.

Referenced by WHierarchicalTreeFibers::addCluster(), WHierarchicalTreeVoxels::addCluster(), downXLevelsFromTop(), getMaxLevel(), and getParent().

std::vector<size_t> WHierarchicalTree::m_parents [protected]

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