OpenWalnut  1.5.0dev
Public Member Functions | Protected Attributes | List of all members
WHierarchicalTree Class Referenceabstract

base class for hierarchical tree implementations More...

#include <WHierarchicalTree.h>

+ Inheritance diagram for WHierarchicalTree:
+ Collaboration diagram for WHierarchicalTree:

Public Member Functions

 WHierarchicalTree ()
 standard constructor More...
 
virtual ~WHierarchicalTree ()
 destructor More...
 
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. 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...
 

Protected Attributes

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

base class for hierarchical tree implementations

Definition at line 41 of file WHierarchicalTree.h.

Constructor & Destructor Documentation

◆ WHierarchicalTree()

WHierarchicalTree::WHierarchicalTree ( )

standard constructor

Definition at line 30 of file WHierarchicalTree.cpp.

◆ ~WHierarchicalTree()

WHierarchicalTree::~WHierarchicalTree ( )
virtual

destructor

Definition at line 38 of file WHierarchicalTree.cpp.

Member Function Documentation

◆ addLeaf()

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.

◆ colorCluster()

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

Referenced by WMClusterDisplay::colorClusters(), WMClusterDisplay::handleBiggestClustersChanged(), WMClusterDisplay::handleRoiChanged(), WMClusterDisplayVoxels::updateAll(), and WMClusterDisplayVoxels::updateWidgets().

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

◆ downXLevelsFromTop()

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

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

Referenced by WMClusterDisplayVoxels::updateAll().

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

◆ findXBiggestClusters()

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

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

Referenced by WMClusterDisplay::handleBiggestClustersChanged(), and WMClusterDisplayVoxels::updateAll().

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

◆ getChildren()

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

◆ getClusterCount()

size_t WHierarchicalTree::getClusterCount ( ) const
inline

◆ getColor()

WColor WHierarchicalTree::getColor ( size_t  cluster) const
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().

+ Here is the caller graph for this function:

◆ getCustomData()

float WHierarchicalTree::getCustomData ( size_t  cluster) const
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 WMClusterDisplay::createLabel(), WHierarchicalTreeVoxels::findClustersForValue(), WDendrogramGeode::getClickClusterRecursive2(), WDendrogramGeode::layoutValue(), compValue::operator()(), and WMClusterDisplayVoxels::setButtonLabels().

+ Here is the caller graph for this function:

◆ getLeafCount()

size_t WHierarchicalTree::getLeafCount ( ) const
inline

getter

Returns
the number of leafes

Definition at line 223 of file WHierarchicalTree.h.

References m_leafCount.

Referenced by WMClusterDisplay::loadTreeAscii(), WMClusterDisplay::moduleMain(), and WMClusterDisplayVoxels::setPropertyBoundaries().

+ Here is the caller graph for this function:

◆ getLeafesForCluster()

std::vector< size_t > WHierarchicalTree::getLeafesForCluster ( size_t  cluster) const
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 WMClusterDisplay::colorClusters(), WHierarchicalTreeVoxels::getVoxelsForCluster(), WMClusterDisplay::handleBiggestClustersChanged(), WMClusterDisplay::handleRoiChanged(), and size().

+ Here is the caller graph for this function:

◆ getLevel()

size_t WHierarchicalTree::getLevel ( size_t  cluster) const
inline

◆ getMaxLevel()

size_t WHierarchicalTree::getMaxLevel ( ) const
inline

getter

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

Definition at line 233 of file WHierarchicalTree.h.

References m_maxLevel.

Referenced by WMClusterDisplay::handleSelectedClusterChanged(), WMClusterDisplay::moduleMain(), WMClusterDisplayVoxels::setPropertyBoundaries(), WMClusterDisplay::updateWidgets(), and WMClusterDisplay::widgetClicked().

+ Here is the caller graph for this function:

◆ getParent()

size_t WHierarchicalTree::getParent ( size_t  cluster) const
inline

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.

Referenced by WMClusterDisplay::handleOffsetChanged(), and WMClusterDisplay::updateWidgets().

+ Here is the caller graph for this function:

◆ isLeaf()

bool WHierarchicalTree::isLeaf ( size_t  cluster) const
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.

◆ setColor()

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

size_t WHierarchicalTree::size ( size_t  cluster) const
inline

Member Data Documentation

◆ m_children

std::vector< std::pair< size_t, size_t> > WHierarchicalTree::m_children
protected

◆ m_clusterCount

size_t WHierarchicalTree::m_clusterCount
protected

◆ m_colors

std::vector<WColor> WHierarchicalTree::m_colors
protected

◆ m_containsLeafes

std::vector< std::vector<size_t> > WHierarchicalTree::m_containsLeafes
protected

◆ m_customData

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 WHierarchicalTreeVoxels::addCluster(), WHierarchicalTreeFibers::addCluster(), WHierarchicalTreeFibers::addLeaf(), WHierarchicalTreeVoxels::addLeaf(), WHierarchicalTreeVoxels::findClustersForBranchLength(), WHierarchicalTreeVoxels::findXClusters(), and getCustomData().

◆ m_leafCount

size_t WHierarchicalTree::m_leafCount
protected

◆ m_leafesLocked

bool WHierarchicalTree::m_leafesLocked
protected

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 WHierarchicalTreeVoxels::addCluster(), WHierarchicalTreeFibers::addCluster(), WHierarchicalTreeFibers::addLeaf(), and WHierarchicalTreeVoxels::addLeaf().

◆ m_level

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 WHierarchicalTreeVoxels::addCluster(), WHierarchicalTreeFibers::addCluster(), WHierarchicalTreeFibers::addLeaf(), WHierarchicalTreeVoxels::addLeaf(), getChildren(), getLevel(), and getParent().

◆ m_maxLevel

size_t WHierarchicalTree::m_maxLevel
protected

the maximum level, naturally the level of the root node

Definition at line 180 of file WHierarchicalTree.h.

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

◆ m_parents

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

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