OpenWalnut
1.5.0dev
|
Class implements a hierarchical tree and provides helper functions for selection and navigation. More...
#include <WHierarchicalTreeVoxels.h>
Public Member Functions | |
WHierarchicalTreeVoxels () | |
standard constructor More... | |
~WHierarchicalTreeVoxels () | |
destructor More... | |
std::vector< size_t > | getVoxelsForCluster (size_t cluster) |
getter More... | |
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. More... | |
void | addCluster (size_t cluster1, size_t cluster2, float customData) |
adds a cluster to the set, it combines 2 already existing clusters More... | |
size_t | getVoxelNum (size_t leaf) |
getter More... | |
std::vector< size_t > | findClustersForValue (float value) |
finds the clusters for a given similarity value More... | |
std::vector< size_t > | findClustersForBranchLength (float value, size_t minSize=100) |
finds the clusters for a given similarity value More... | |
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. More... | |
Public Member Functions inherited from WHierarchicalTree | |
WHierarchicalTree () | |
standard constructor More... | |
virtual | ~WHierarchicalTree () |
destructor 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... | |
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. More... | |
Private Attributes | |
std::vector< size_t > | m_voxelnums |
stores the voxel id of each leaf node More... | |
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 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... | |
Class implements a hierarchical tree and provides helper functions for selection and navigation.
Definition at line 42 of file WHierarchicalTreeVoxels.h.
WHierarchicalTreeVoxels::WHierarchicalTreeVoxels | ( | ) |
standard constructor
Definition at line 34 of file WHierarchicalTreeVoxels.cpp.
WHierarchicalTreeVoxels::~WHierarchicalTreeVoxels | ( | ) |
destructor
Definition at line 39 of file WHierarchicalTreeVoxels.cpp.
void WHierarchicalTreeVoxels::addCluster | ( | size_t | cluster1, |
size_t | cluster2, | ||
float | customData | ||
) |
adds a cluster to the set, it combines 2 already existing clusters
cluster1 | first cluster to add |
cluster2 | second cluster to add |
customData | some 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().
Referenced by WMClusterDisplayVoxels::loadClustering().
|
privatevirtual |
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.
Implements WHierarchicalTree.
Definition at line 43 of file WHierarchicalTreeVoxels.cpp.
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.
voxelnum | the 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.
Referenced by WMClusterDisplayVoxels::loadClustering().
std::vector< size_t > WHierarchicalTreeVoxels::findClustersForBranchLength | ( | float | value, |
size_t | minSize = 100 |
||
) |
finds the clusters for a given similarity value
value | only return clusters where the distance in energy level to its parent is large than this value |
minSize | only return clusters with a number of voxels large than minSize |
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().
Referenced by WMClusterDisplayVoxels::updateAll().
std::vector< size_t > WHierarchicalTreeVoxels::findClustersForValue | ( | float | value | ) |
finds the clusters for a given similarity value
value |
Definition at line 107 of file WHierarchicalTreeVoxels.cpp.
References WHierarchicalTree::getCustomData(), WHierarchicalTree::m_children, WHierarchicalTree::m_clusterCount, WHierarchicalTree::m_containsLeafes, and WHierarchicalTree::size().
Referenced by WMClusterDisplayVoxels::updateAll().
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.
root | the cluster to start traversing the tree from |
number | the number of cluster we want to find |
Definition at line 171 of file WHierarchicalTreeVoxels.cpp.
References WHierarchicalTree::m_children, and WHierarchicalTree::m_customData.
Referenced by WMClusterDisplayVoxels::updateAll().
|
inline |
getter
leaf |
Definition at line 120 of file WHierarchicalTreeVoxels.h.
References m_voxelnums.
std::vector< size_t > WHierarchicalTreeVoxels::getVoxelsForCluster | ( | size_t | cluster | ) |
getter
cluster | the cluster to work on |
Definition at line 96 of file WHierarchicalTreeVoxels.cpp.
References WHierarchicalTree::getLeafesForCluster(), and m_voxelnums.
Referenced by WMClusterDisplayVoxels::updateAll().
|
private |
stores the voxel id of each leaf node
Definition at line 117 of file WHierarchicalTreeVoxels.h.
Referenced by addLeaf(), getVoxelNum(), and getVoxelsForCluster().