OpenWalnut  1.5.0dev
Classes | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
WHtree Class Reference

this class implements a hierarchical tree and provides functions for creation, partitioning, selection and navigation More...

#include <WHtree.h>

+ Collaboration diagram for WHtree:

Classes

struct  compHLevel
 implements a compare operator for nodes, depending on the hierarchical level More...
 
struct  compSize
 implements a compare operator for nodes inside a tree structure, depending on the Size More...
 

Public Member Functions

 WHtree ()
 Constructor. More...
 
 WHtree (std::string filename)
 Constructor. More...
 
 WHtree (std::string treeName, HC_GRID datasetGridInit, WHcoord datasetSizeInit, size_t numStreamlinesInit, float logFactorInit, std::vector< WHnode > leavesInit, std::vector< WHnode > nodesInit, std::vector< size_t > trackidInit, std::vector< WHcoord > coordInit, std::list< WHcoord > discardInit, float cpccInit=0)
 Constructor. More...
 
 WHtree (const WHtree &object)
 Constructor. More...
 
 ~WHtree ()
 Destructor. More...
 
std::string getName () const
 Returns the tree name. More...
 
bool isLoaded () const
 Returns the loading status of the tree. More...
 
size_t getNumLeaves () const
 Returns the number of leaves of the tree. More...
 
size_t getNumNodes () const
 Returns the number of nodes of the tree. More...
 
std::vector< WHnodegetLeaves () const
 Returns the leaves of the tree. More...
 
std::vector< WHnodegetNodes () const
 Returns the nodes of the tree. More...
 
size_t getNumDiscarded () const
 Returns the number of leaves of the tree. More...
 
WHcoord getDataSize () const
 Returns the dataset size. More...
 
HC_GRID getDataGrid () const
 Returns the dataset grid type. More...
 
float getCpcc () const
 Returns the cpcc value of the tree. More...
 
std::vector< WHcoordgetRoi () const
 Returns the roi coordinate vector. More...
 
std::vector< size_t > getTrackids () const
 Returns the tractogram IDs vector. More...
 
std::list< WHcoordgetDiscarded () const
 Returns the discarded list. More...
 
std::vector< float > getSelectedValues () const
 Returns the cutting values for the selected partitions. More...
 
float getSelectedValues (size_t index) const
 Returns the cutting values for the selected partition. More...
 
std::vector< std::vector< size_t > > getSelectedPartitions () const
 Returns the set of the selected partitions. More...
 
std::vector< size_t > getSelectedPartitions (size_t index) const
 Returns the indicated selected partition from the saved set. More...
 
std::vector< std::vector< WHcoord > > getSelectedColors () const
 Returns the set of the selected partition colors. More...
 
std::vector< WHcoordgetSelectedColors (size_t index) const
 Returns the selected partition colors from the saved set. More...
 
std::string getReport (bool longMsg=true) const
 writes out a small report status of the tree More...
 
bool check () const
 checks tree integrity More...
 
const WHnodegetNode (const nodeID_t &thisNode) const
 returns a const pointer to the node indicated by the ID More...
 
const WHnodegetNode (const size_t thisNode) const
 returns a const pointer to the node indicated by the ID More...
 
const WHnodegetLeaf (const size_t thisLeaf) const
 returns a const pointer to the leaf indicated by the ID More...
 
const WHnodegetRoot () const
 returns a const reference to the root node More...
 
size_t getLeafID (const WHcoord &thisCoord) const
 returns the leaf ID of a coordinate in the tree More...
 
size_t getTrackID (const size_t &leafID) const
 returns the corresponding track ID to a leaf ID on the tree More...
 
std::vector< size_t > getLeaves4node (const size_t nodeID) const
 Returns a vector with all the leaf IDs contained in that cluster. More...
 
std::vector< size_t > getLeaves4node (const nodeID_t &nodeID) const
 Returns a vector with all the leaf IDs contained in that cluster. More...
 
std::vector< size_t > getBranchNodes (const size_t nodeID) const
 Returns a vector with all the node IDs contained in that branch. More...
 
WHcoord getCoordinate4leaf (const size_t leafID) const
 the coordinates of a particular leaf More...
 
std::vector< WHcoordgetCoordinates4node (const size_t nodeID) const
 Returns a vector with all the seed voxel coordinates contained in that cluster. More...
 
std::vector< WHcoordgetCoordinates4node (const nodeID_t &nodeID) const
 Returns a vector with all the seed voxel coordinates contained in that cluster. More...
 
WHcoord getMeanCoordinate4node (const size_t nodeID) const
 Returns the mean coordinate of all the seed voxel coordinates contained in that cluster. More...
 
WHcoord getMeanCoordinate4node (const nodeID_t &nodeID) const
 Returns the mean coordinate of all the seed voxel coordinates contained in that cluster. More...
 
size_t getCommonAncestor (const size_t nodeID1, const size_t nodeID2) const
 retrieves the the first common ancestor node of two given nodes More...
 
nodeID_t getCommonAncestor (const nodeID_t &nodeID1, const nodeID_t &nodeID2) const
 retrieves the the first common ancestor node of two given nodes More...
 
std::vector< nodeID_t > getRoute2Root (const nodeID_t &nodeID) const
 node route to root node More...
 
unsigned int getTripletOrder (const nodeID_t &nodeIDa, const nodeID_t &nodeIDb, const nodeID_t &nodeIDc) const
 checks the joining order of a given triplet More...
 
std::vector< size_t > getBaseNodes (const size_t root) const
 returns a vector with all the nodes that have direct link to leaves fro the indicated subtree More...
 
std::vector< nodeID_t > getBaseNodes (const nodeID_t &root) const
 returns a vector with all the nodes that have direct link to leaves from the indicated subtree More...
 
std::vector< size_t > getRootBaseNodes () const
 returns a vector with all the nodes that have direct link to leaves from the main root More...
 
bool testRootBaseNodes () const
 tests if all base nodes have only leaf children More...
 
dist_t getDistance (const size_t nodeID1, const size_t nodeID2) const
 computes the cophenetic distance between 2 nodes More...
 
dist_t getDistance (const nodeID_t &nodeID1, const nodeID_t &nodeID2) const
 computes the cophenetic distance between 2 leaf/nodes More...
 
dist_t getDistance (const WHcoord &coord1, const WHcoord &coord2) const
 computes the cophenetic distance between 2 leaves More...
 
dist_t getLeafDistance (const size_t leafID1, const size_t leafID2) const
 computes the cophenetic distance between 2 leaves More...
 
void sortBySize (std::vector< size_t > *const nodeVector) const
 Reorders the nodes in the vector according to their size. More...
 
void sortBySize (std::vector< nodeID_t > *const nodeVector) const
 Reorders the nodes in the vector according to their size. More...
 
void sortBySize (std::list< size_t > *const nodeList) const
 Reorders the nodes in the list according to their size. More...
 
void sortBySize (std::list< nodeID_t > *const nodeList) const
 Reorders the nodes in the list according to their size. More...
 
void sortByHLevel (std::vector< size_t > *const nodeVector) const
 Reorders the nodes in the vector according to their hierarchical level. More...
 
void sortByHLevel (std::list< size_t > *const nodeList) const
 Reorders the nodes in the list according to their hierarchical level. More...
 
void sortByHLevel (std::vector< nodeID_t > *const nodeVector) const
 Reorders the nodes in the vector according to their hierarchical level. More...
 
void sortByHLevel (std::list< nodeID_t > *const nodeList) const
 Reorders the nodes in the list according to their hierarchical level. More...
 
void loadContainedLeaves ()
 stores the contained leaves for each node More...
 
void clearContainedLeaves ()
 frees the memory of m_containedLeaves More...
 
bool convert2grid (const HC_GRID newGrid)
 converts all the coordinates to the grid format indicated More...
 
bool readTree (const std::string &filename)
 Reads the the tree data from a file and creates the structure, containing it in the leaves, nodes and coordinates vectors. More...
 
bool writeTree (const std::string &filename, const bool isNifti=true) const
 writes the current tree data More...
 
bool writeTreeDebug (const std::string &filename) const
 writes all redundant tree data for debugging purposes More...
 
bool writeTreeOldWalnut (const std::string &filename) const
 writes dta for working with the old walnut module More...
 
bool writeTreeSimple (const std::string &filename) const
 writes only join data without coordinates or reading labels More...
 
void insertPartitions (const std::vector< std::vector< size_t > > &selectedPartitions, const std::vector< float > &selectedValues, const std::vector< std::vector< WHcoord > > &selectedColors=std::vector< std::vector< WHcoord > >())
 insert a set of partitions into the tree data More...
 
void insertPartColors (const std::vector< std::vector< WHcoord > > &selectedColors)
 insert a set of partitions colors into the tree data in case a set of saved partitions is already present More...
 
void clearPartitions ()
 delete all data related to saved partitions More...
 
void clearPartColors ()
 delete only color data of the saved partitions More...
 
std::vector< std::vector< unsigned int > > getBranching (const std::vector< nodeID_t > &thisPartition, size_t depthLevel, std::vector< std::vector< nodeID_t > > *partitionSet, const bool excludeLeaves)
 gets all possble sets of sub-partitions in a tree given an initial partition and a depth level (where leaves/nodes are identified with boolean-integer pair) More...
 
std::vector< std::vector< unsigned int > > getBranching (const std::vector< size_t > &thisPartition, size_t depthLevel, std::vector< std::vector< size_t > > *partitionSet)
 gets all possble sets of sub-partitions in a tree given an initial partition and a depth level (where only non-leaf nodes are considered and are identified by a single integer) More...
 

Private Member Functions

WHnodefetchNode (const nodeID_t &thisNode)
 returns a pointer to the node indicated by the ID More...
 
WHnodefetchNode (const size_t thisNode)
 returns a pointer to the node indicated by the ID More...
 
WHnodefetchLeaf (const size_t thisLeaf)
 returns a pointer to the leaf indicated by the ID More...
 
WHnodefetchRoot ()
 returns a pointer to the root node More...
 
std::pair< size_t, size_t > cleanup (std::vector< size_t > *outLookup=0)
 cleans leaves/nodes set to be pruned More...
 
size_t debinarize (const bool keepBaseNodes=false)
 merges nodes joining binary at the same level into non-binary structures More...
 
void forceMonotonicity (double errorMult=1)
 eliminates non monotonic steps in the tree while keeping as much information as possible. More...
 
void forceMonotonicityUp ()
 eliminates non monotonic steps in the tree bottom-up, lowering the level of children involved in the non-monotonic steps to the parent level More...
 
void forceMonotonicityDown ()
 eliminates non monotonic steps in the tree top-down, raising the level of parents involved in the non-monotonic steps to the children level More...
 

Private Attributes

bool m_loadStatus
 Stores all the leaves of the tree (represents a single voxel, for several purposes a leaf also counts as a node. More...
 
WHcoord m_datasetSize
 Stores the size of the dataset this tree was built from. More...
 
HC_GRID m_datasetGrid
 Stores the the type of coordinate grid of the dataset. More...
 
size_t m_numStreamlines
 number of streamlines generated form each seed voxel in the tractograms used to build the tree More...
 
float m_logFactor
 logarithmic normalization factor used in the tractograms when building the tree More...
 
float m_cpcc
 Stores the cpcc value of the tree. More...
 
std::string m_treeName
 Stores the name of the tree file. More...
 
std::vector< WHnodem_leaves
 Stores all the leaves of the tree (represents a single voxel, for several purposes a leaf also counts as a node. More...
 
std::vector< WHnodem_nodes
 Stores all the nodes (non-leaves) of the tree. More...
 
std::vector< WHcoordm_coordinates
 Stores the coordinates of the leaf voxels. More...
 
std::vector< size_t > m_trackids
 Stores the ids of the seed tracts correesponding to each leaf. More...
 
std::list< WHcoordm_discarded
 Stores the coordinates of the voxels that were discarded during the process of building the tree. More...
 
std::vector< std::vector< size_t > > m_containedLeaves
 Stores the contained leafs of each node. More...
 
std::vector< std::vector< size_t > > m_selectedPartitions
 Stores a set of selected partitions. More...
 
std::vector< float > m_selectedValues
 Stores the quality values of the selected partitions. More...
 
std::vector< std::vector< WHcoord > > m_selectedColors
 Stores the colors of the selected partitions. More...
 

Friends

class treeManager
 friend class More...
 
class WHtreeProcesser
 friend class More...
 
class WHtreePartition
 friend class More...
 
class CnbTreeBuilder
 friend class More...
 
class graphTreeBuilder
 friend class More...
 
class randCnbTreeBuilder
 friend class More...
 
class treeComparer
 friend class More...
 
class pruneTree
 friend class More...
 
class image2treeBuilder
 friend class More...
 

Detailed Description

this class implements a hierarchical tree and provides functions for creation, partitioning, selection and navigation

Definition at line 80 of file WHtree.h.

Constructor & Destructor Documentation

◆ WHtree() [1/4]

WHtree::WHtree ( )
explicit

Constructor.

Definition at line 73 of file WHtree.cpp.

◆ WHtree() [2/4]

WHtree::WHtree ( std::string  filename)
explicit

Constructor.

Parameters
filenamestring containing the name of the file with the tree data

Definition at line 77 of file WHtree.cpp.

References readTree().

+ Here is the call graph for this function:

◆ WHtree() [3/4]

WHtree::WHtree ( std::string  treeName,
HC_GRID  datasetGridInit,
WHcoord  datasetSizeInit,
size_t  numStreamlinesInit,
float  logFactorInit,
std::vector< WHnode leavesInit,
std::vector< WHnode nodesInit,
std::vector< size_t >  trackidInit,
std::vector< WHcoord coordInit,
std::list< WHcoord discardInit,
float  cpccInit = 0 
)
explicit

Constructor.

Parameters
treeNamename of the tree
datasetGridInittype of grid coordinate space
datasetSizeInitsize of the brain dataset
numStreamlinesInitnumber of streamlines per voxel on the tractograms that were processed to build this tree
logFactorInitlogarithmic normalization factor that was applied on the tracts when building the tree
leavesInitvector of leaves
nodesInitvector of nodes
trackidInitvector of seed track ids
coordInitvector of seed voxel coordinates
discardInitvector of discarded seed voxel coordinates
cpccInitcpcc value of the tree

Definition at line 82 of file WHtree.cpp.

References check(), and m_loadStatus.

+ Here is the call graph for this function:

◆ WHtree() [4/4]

WHtree::WHtree ( const WHtree object)
explicit

Constructor.

Parameters
objecttree object

Definition at line 104 of file WHtree.cpp.

◆ ~WHtree()

WHtree::~WHtree ( )

Destructor.

Definition at line 121 of file WHtree.cpp.

Member Function Documentation

◆ check()

bool WHtree::check ( ) const

checks tree integrity

Returns
tree integrity indicator

Definition at line 152 of file WHtree.cpp.

References wlog::error(), WHnode::getChildren(), WHnode::getHLevel(), getNode(), WHnode::getParent(), WHnode::getSize(), m_coordinates, m_leaves, m_nodes, and m_trackids.

Referenced by cleanup(), debinarize(), readTree(), and WHtree().

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

◆ cleanup()

std::pair< size_t, size_t > WHtree::cleanup ( std::vector< size_t > *  outLookup = 0)
private

cleans leaves/nodes set to be pruned

Parameters
outLookuppointer to a vector where to store the lookup table of changes done to nodes
Returns
pair with the number of leaves and nodes pruned

Definition at line 1716 of file WHtree.cpp.

References check(), clearPartColors(), clearPartitions(), wlog::error(), fetchNode(), WHnode::getChildren(), WHnode::getHLevel(), WHnode::getID(), getNode(), getNumLeaves(), getNumNodes(), WHnode::getParent(), WHnode::getSize(), WHnode::isFlagged(), WHnode::isLeaf(), WHnode::isRoot(), m_coordinates, m_cpcc, m_discarded, m_leaves, m_nodes, m_trackids, WHnode::setChildren(), WHnode::setHLevel(), and WHnode::setSize().

Referenced by WHtreeProcesser::baseNodes2Leaves(), WHtreeProcesser::coarseTree(), WHtreeProcesser::flattenSelection(), WHtreeProcesser::pruneRandom(), WHtreeProcesser::pruneSelection(), and WHtreeProcesser::pruneTree().

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

◆ clearContainedLeaves()

void WHtree::clearContainedLeaves ( )

frees the memory of m_containedLeaves

Definition at line 860 of file WHtree.cpp.

References m_containedLeaves.

Referenced by debinarize().

+ Here is the caller graph for this function:

◆ clearPartColors()

void WHtree::clearPartColors ( )

delete only color data of the saved partitions

Definition at line 1545 of file WHtree.cpp.

References m_selectedColors.

Referenced by cleanup(), and insertPartColors().

+ Here is the caller graph for this function:

◆ clearPartitions()

void WHtree::clearPartitions ( )

delete all data related to saved partitions

Definition at line 1534 of file WHtree.cpp.

References m_selectedColors, m_selectedPartitions, and m_selectedValues.

Referenced by cleanup(), debinarize(), insertPartitions(), WMHierchClustDisplay::moduleMain(), and readTree().

+ Here is the caller graph for this function:

◆ convert2grid()

bool WHtree::convert2grid ( const HC_GRID  newGrid)

converts all the coordinates to the grid format indicated

Parameters
newGridcoordinate space in which to convert
Returns
flag indicating if the change was performed

Definition at line 867 of file WHtree.cpp.

References wlog::error(), m_coordinates, m_datasetGrid, m_datasetSize, m_discarded, WHcoord::nifti2vista(), and WHcoord::vista2nifti().

Referenced by WMHierchClustDisplay::initTreeData().

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

◆ debinarize()

size_t WHtree::debinarize ( const bool  keepBaseNodes = false)
private

merges nodes joining binary at the same level into non-binary structures

Parameters
keepBaseNodesif set basenodes will not be marged
Returns
number of nodes collapsed

Definition at line 1985 of file WHtree.cpp.

References check(), clearContainedLeaves(), clearPartitions(), wlog::error(), fetchLeaf(), fetchNode(), WHnode::getChildren(), WHnode::getDistLevel(), getNumLeaves(), getNumNodes(), WHnode::getParent(), m_cpcc, m_nodes, WHnode::setHLevel(), WHnode::setParent(), and testRootBaseNodes().

Referenced by WHtreeProcesser::coarseTree(), WHtreeProcesser::collapseBranch(), WHtreeProcesser::collapseTree(), WHtreeProcesser::collapseTreeLinear(), WHtreeProcesser::collapseTreeSquare(), WHtreeProcesser::debinarize(), WHtreeProcesser::flattenBranch(), WHtreeProcesser::pruneRandom(), and WHtreeProcesser::pruneTree().

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

◆ fetchLeaf()

WHnode * WHtree::fetchLeaf ( const size_t  thisLeaf)
private

returns a pointer to the leaf indicated by the ID

Parameters
thisLeafid of the required leaf
Returns
pointer to desired leaf object

Definition at line 1697 of file WHtree.cpp.

References m_leaves.

Referenced by WHtreeProcesser::baseNodes2Leaves(), WHtreeProcesser::coarseTree(), debinarize(), fetchNode(), WHtreeProcesser::flagLeaves(), and WHtreeProcesser::pruneRandom().

+ Here is the caller graph for this function:

◆ fetchNode() [1/2]

WHnode * WHtree::fetchNode ( const nodeID_t &  thisNode)
private

returns a pointer to the node indicated by the ID

Parameters
thisNodefull id of the required node
Returns
pointer to desired node/leaf object

Definition at line 1684 of file WHtree.cpp.

References fetchLeaf().

Referenced by cleanup(), WHtreeProcesser::collapseNode(), debinarize(), fetchRoot(), WHtreeProcesser::flattenSelection(), forceMonotonicity(), forceMonotonicityDown(), forceMonotonicityUp(), WHtreeProcesser::pruneTree(), and readTree().

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

◆ fetchNode() [2/2]

WHnode * WHtree::fetchNode ( const size_t  thisNode)
private

returns a pointer to the node indicated by the ID

Parameters
thisNodeid of the required node
Returns
pointer to desired node/leaf object

Definition at line 1673 of file WHtree.cpp.

References m_nodes.

◆ fetchRoot()

WHnode * WHtree::fetchRoot ( )
private

returns a pointer to the root node

Returns
a pointer to root node object

Definition at line 1710 of file WHtree.cpp.

References fetchNode(), and getNumNodes().

+ Here is the call graph for this function:

◆ forceMonotonicity()

void WHtree::forceMonotonicity ( double  errorMult = 1)
private

eliminates non monotonic steps in the tree while keeping as much information as possible.

it searches bottom-up for non-monotonic steps. When detected a corrected value for the parent node is computed this value consists of a average between the non-monotonic children levels weighted by their sizes in number of leaves and the parent level weighted by the sizes of the remaining monotonic children in orther to avoid infinite loops an error tolerance is included. default value is 1*E-5

Parameters
errorMultmultiplier to increase the base error tolerance (default value is 1 makign the tolerance 1*E-5, maximum value is 100 making the tolerance 1*E-3)

Definition at line 2247 of file WHtree.cpp.

References fetchNode(), forceMonotonicityDown(), WHnode::getChildren(), WHnode::getDistLevel(), WHnode::getID(), WHnode::getParent(), WHnode::getSize(), WHnode::isRoot(), m_nodes, and WHnode::setDistLevel().

Referenced by WHtreeProcesser::forceMonotonicity().

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

◆ forceMonotonicityDown()

void WHtree::forceMonotonicityDown ( )
private

eliminates non monotonic steps in the tree top-down, raising the level of parents involved in the non-monotonic steps to the children level

Definition at line 2226 of file WHtree.cpp.

References fetchNode(), WHnode::getChildren(), WHnode::getDistLevel(), m_nodes, and WHnode::setDistLevel().

Referenced by WHtreeProcesser::collapseTree(), forceMonotonicity(), and WHtreeProcesser::forceMonotonicityDown().

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

◆ forceMonotonicityUp()

void WHtree::forceMonotonicityUp ( )
private

eliminates non monotonic steps in the tree bottom-up, lowering the level of children involved in the non-monotonic steps to the parent level

Definition at line 2205 of file WHtree.cpp.

References fetchNode(), WHnode::getChildren(), WHnode::getDistLevel(), m_nodes, and WHnode::setDistLevel().

Referenced by WHtreeProcesser::forceMonotonicityUp().

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

◆ getBaseNodes() [1/2]

std::vector< nodeID_t > WHtree::getBaseNodes ( const nodeID_t &  root) const

returns a vector with all the nodes that have direct link to leaves from the indicated subtree

Parameters
rootfull id of the selected subtree root node
Returns
nodeId vector of base nodes

Definition at line 686 of file WHtree.cpp.

References getBaseNodes().

+ Here is the call graph for this function:

◆ getBaseNodes() [2/2]

std::vector< size_t > WHtree::getBaseNodes ( const size_t  root) const

returns a vector with all the nodes that have direct link to leaves fro the indicated subtree

Parameters
rootid of the selected subtree root node
Returns
nodeId vector of base nodes

Definition at line 642 of file WHtree.cpp.

References wlog::error(), WHnode::getID(), getNode(), getNumNodes(), WHnode::getParent(), getRoot(), WHnode::isRoot(), and m_leaves.

Referenced by getBaseNodes(), getRootBaseNodes(), and WHtreePartition::partitionSmooth().

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

◆ getBranching() [1/2]

std::vector< std::vector< unsigned int > > WHtree::getBranching ( const std::vector< nodeID_t > &  thisPartition,
size_t  depthLevel,
std::vector< std::vector< nodeID_t > > *  partitionSet,
const bool  excludeLeaves 
)

gets all possble sets of sub-partitions in a tree given an initial partition and a depth level (where leaves/nodes are identified with boolean-integer pair)

Parameters
thisPartitionthe starting partition
depthLevelthe number of levels down to look for sub-partitions
excludeLeavesif set (1 ), the the algorithm will not further subdivide a base-node (where all its children are single leaves)
partitionSet(is a return value) the vector of returned sub-partitions
Returns
a set of integers identifying each of the clusters from the resulting sub-partitions with its parent cluster from the starting partition

Definition at line 1552 of file WHtree.cpp.

References WHnode::getHLevel(), and getNode().

Referenced by getBranching(), WHtreePartition::partitionOptimized(), and WHtreePartition::scanOptimalPartitions().

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

◆ getBranching() [2/2]

std::vector< std::vector< unsigned int > > WHtree::getBranching ( const std::vector< size_t > &  thisPartition,
size_t  depthLevel,
std::vector< std::vector< size_t > > *  partitionSet 
)

gets all possble sets of sub-partitions in a tree given an initial partition and a depth level (where only non-leaf nodes are considered and are identified by a single integer)

Parameters
thisPartitionthe starting partition
depthLevelthe number of levels down to look for sub-partitions
partitionSet(is a return value) the vector of returned sub-partitions
Returns
a set of integers identifying each of the clusters from the resulting sub-partitions with its parent cluster from the starting partition

Definition at line 1627 of file WHtree.cpp.

References wlog::error(), and getBranching().

+ Here is the call graph for this function:

◆ getBranchNodes()

std::vector< size_t > WHtree::getBranchNodes ( const size_t  nodeID) const

Returns a vector with all the node IDs contained in that branch.

Parameters
nodeIDid of the selected node
Returns
vector with all the node IDs contained in that brnach

Definition at line 434 of file WHtree.cpp.

References wlog::error(), getNode(), and getNumNodes().

Referenced by WHtreeProcesser::collapseBranch().

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

◆ getCommonAncestor() [1/2]

nodeID_t WHtree::getCommonAncestor ( const nodeID_t &  nodeID1,
const nodeID_t &  nodeID2 
) const

retrieves the the first common ancestor node of two given nodes

Parameters
nodeID1first node/leaf full id
nodeID2second node/leaf full id
Returns
ID of ancestor

Definition at line 558 of file WHtree.cpp.

References getCommonAncestor(), getLeaf(), and WHnode::getParent().

+ Here is the call graph for this function:

◆ getCommonAncestor() [2/2]

size_t WHtree::getCommonAncestor ( const size_t  nodeID1,
const size_t  nodeID2 
) const

retrieves the the first common ancestor node of two given nodes

Parameters
nodeID1first node id
nodeID2second node id
Returns
ID of ancestor

Definition at line 535 of file WHtree.cpp.

References getNode(), and WHnode::getParent().

Referenced by getCommonAncestor(), getDistance(), WHtreePartition::getICDmatrix(), getLeafDistance(), and getTripletOrder().

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

◆ getCoordinate4leaf()

WHcoord WHtree::getCoordinate4leaf ( const size_t  leafID) const

the coordinates of a particular leaf

Parameters
leafIDid of the selected leaf
Returns
coordinate object with the coordinates of that leaf

Definition at line 466 of file WHtree.cpp.

References wlog::error(), and m_coordinates.

Referenced by getCoordinates4node(), getMeanCoordinate4node(), and writeTreeDebug().

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

◆ getCoordinates4node() [1/2]

std::vector< WHcoord > WHtree::getCoordinates4node ( const nodeID_t &  nodeID) const

Returns a vector with all the seed voxel coordinates contained in that cluster.

Parameters
nodeIDfull id of the selected node
Returns
vector with all the seed voxel coordinates contained in that cluster

Definition at line 491 of file WHtree.cpp.

References getCoordinate4leaf(), and getCoordinates4node().

+ Here is the call graph for this function:

◆ getCoordinates4node() [2/2]

std::vector< WHcoord > WHtree::getCoordinates4node ( const size_t  nodeID) const

Returns a vector with all the seed voxel coordinates contained in that cluster.

Parameters
nodeIDid of the selected node
Returns
vector with all the seed voxel coordinates contained in that cluster

Definition at line 480 of file WHtree.cpp.

References getCoordinate4leaf(), and getLeaves4node().

Referenced by getCoordinates4node(), getMeanCoordinate4node(), WMHierchClustDisplay::initTreeData(), and WMHierchClustDisplay::writePartition().

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

◆ getCpcc()

float WHtree::getCpcc ( ) const
inline

Returns the cpcc value of the tree.

Returns
value containing the cpcc

Definition at line 865 of file WHtree.h.

References m_cpcc.

Referenced by WMHierchClustDisplay::initProperties().

+ Here is the caller graph for this function:

◆ getDataGrid()

HC_GRID WHtree::getDataGrid ( ) const
inline

Returns the dataset grid type.

Returns
enum containing the grid type

Definition at line 860 of file WHtree.h.

References m_datasetGrid.

◆ getDataSize()

WHcoord WHtree::getDataSize ( ) const
inline

Returns the dataset size.

Returns
coordinate containing the dataset dimensions

Definition at line 855 of file WHtree.h.

References m_datasetSize.

◆ getDiscarded()

std::list< WHcoord > WHtree::getDiscarded ( ) const
inline

Returns the discarded list.

Returns
list containing the discarded coordinates

Definition at line 880 of file WHtree.h.

References m_discarded.

Referenced by WMHierchClustDisplay::initTreeData(), and WMHierchClustDisplay::updateOutput2().

+ Here is the caller graph for this function:

◆ getDistance() [1/3]

dist_t WHtree::getDistance ( const nodeID_t &  nodeID1,
const nodeID_t &  nodeID2 
) const

computes the cophenetic distance between 2 leaf/nodes

Parameters
nodeID1first node/leaf to compute distance from
nodeID2second node/leaf to compute distance from
Returns
cophenetic distance

Definition at line 735 of file WHtree.cpp.

References getCommonAncestor(), WHnode::getDistLevel(), and getNode().

+ Here is the call graph for this function:

◆ getDistance() [2/3]

dist_t WHtree::getDistance ( const size_t  nodeID1,
const size_t  nodeID2 
) const

computes the cophenetic distance between 2 nodes

Parameters
nodeID1first node to compute distance from
nodeID2second node to compute distance from
Returns
cophenetic distance

Definition at line 730 of file WHtree.cpp.

References getCommonAncestor(), WHnode::getDistLevel(), and getNode().

Referenced by getDistance().

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

◆ getDistance() [3/3]

dist_t WHtree::getDistance ( const WHcoord coord1,
const WHcoord coord2 
) const

computes the cophenetic distance between 2 leaves

Parameters
coord1first coordinate to compute distance from
coord2second ncoordinate to compute distance from
Returns
cophenetic distance

Definition at line 740 of file WHtree.cpp.

References getDistance(), and getLeafID().

+ Here is the call graph for this function:

◆ getLeaf()

const WHnode & WHtree::getLeaf ( const size_t  thisLeaf) const

returns a const pointer to the leaf indicated by the ID

Parameters
thisLeafid of the required leaf
Returns
const reference to desired leaf object

Definition at line 333 of file WHtree.cpp.

References wlog::error(), and m_leaves.

Referenced by getCommonAncestor(), getNode(), and WHtreePartition::partitionSmooth().

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

◆ getLeafDistance()

dist_t WHtree::getLeafDistance ( const size_t  leafID1,
const size_t  leafID2 
) const

computes the cophenetic distance between 2 leaves

Parameters
leafID1first leaf to compute distance from
leafID2second leaf to compute distance from
Returns
cophenetic distance

Definition at line 748 of file WHtree.cpp.

References getCommonAncestor(), WHnode::getDistLevel(), and getNode().

+ Here is the call graph for this function:

◆ getLeafID()

size_t WHtree::getLeafID ( const WHcoord thisCoord) const

returns the leaf ID of a coordinate in the tree

Parameters
thisCoordcoordinate of the required leaf
Returns
ID of the leaf

Definition at line 354 of file WHtree.cpp.

References m_coordinates.

Referenced by getDistance().

+ Here is the caller graph for this function:

◆ getLeaves()

std::vector< WHnode > WHtree::getLeaves ( ) const
inline

Returns the leaves of the tree.

Returns
leaves vector

Definition at line 841 of file WHtree.h.

References m_leaves.

◆ getLeaves4node() [1/2]

std::vector< size_t > WHtree::getLeaves4node ( const nodeID_t &  nodeID) const

Returns a vector with all the leaf IDs contained in that cluster.

Parameters
nodeIDfull id of the selected node
Returns
vector with all the leaf IDs contained in that cluster

Definition at line 421 of file WHtree.cpp.

References getLeaves4node().

+ Here is the call graph for this function:

◆ getLeaves4node() [2/2]

std::vector< size_t > WHtree::getLeaves4node ( const size_t  nodeID) const

Returns a vector with all the leaf IDs contained in that cluster.

Parameters
nodeIDid of the selected node
Returns
vector with all the leaf IDs contained in that cluster

Definition at line 380 of file WHtree.cpp.

References wlog::error(), getNode(), m_containedLeaves, and m_nodes.

Referenced by WHtreeProcesser::baseNodes2Leaves(), WHtreeProcesser::flagSelection(), getCoordinates4node(), and getLeaves4node().

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

◆ getMeanCoordinate4node() [1/2]

WHcoord WHtree::getMeanCoordinate4node ( const nodeID_t &  nodeID) const

Returns the mean coordinate of all the seed voxel coordinates contained in that cluster.

Parameters
nodeIDfull id of the selected node
Returns
coordinate object with the mean coordinates of that node

Definition at line 522 of file WHtree.cpp.

References getCoordinate4leaf(), and getMeanCoordinate4node().

+ Here is the call graph for this function:

◆ getMeanCoordinate4node() [2/2]

WHcoord WHtree::getMeanCoordinate4node ( const size_t  nodeID) const

Returns the mean coordinate of all the seed voxel coordinates contained in that cluster.

Parameters
nodeIDid of the selected node
Returns
coordinate object with the mean coordinates of that node

Definition at line 504 of file WHtree.cpp.

References getCoordinates4node(), WHcoord::m_x, WHcoord::m_y, and WHcoord::m_z.

Referenced by getMeanCoordinate4node().

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

◆ getName()

std::string WHtree::getName ( ) const
inline

Returns the tree name.

Returns
value containing the tree name

Definition at line 821 of file WHtree.h.

References m_treeName.

Referenced by WMHierchClustDisplay::initProperties(), and WMHierchClustDisplay::moduleMain().

+ Here is the caller graph for this function:

◆ getNode() [1/2]

const WHnode & WHtree::getNode ( const nodeID_t &  thisNode) const

returns a const pointer to the node indicated by the ID

Parameters
thisNodefull id of the required node
Returns
const reference to desired node/leaf object

Definition at line 307 of file WHtree.cpp.

References getLeaf().

Referenced by WMHierchClustDisplay::assignColorHierch(), check(), cleanup(), WMHierchClustDisplay::clusterSelection(), WHtreeProcesser::collapseBranch(), WHtreeProcesser::collapseNode(), WHtreeProcesser::collapseTree(), WMHierchClustDisplay::colorBranch(), WMHierchClustDisplay::colorBranchCustom(), WNonBinDendroGeode::create(), WHtreePartition::evalPartBranchDist(), WHtreePartition::evalPartBranchDistWeighted(), WHtreePartition::evalPartClustSizeDiff(), WHtreePartition::evalPartInterDistWeighted(), WHtreePartition::evalPartIntraDist(), WHtreePartition::evalPartIntraDistWeighted(), WHtreePartition::evalSSindex(), WNonBinDendroGeode::findClickedCluster(), WHtreeProcesser::flattenSelection(), getBaseNodes(), getBranching(), getBranchNodes(), WNonBinDendroGeode::getClickedCluster(), getCommonAncestor(), getDistance(), WHtreePartition::getICDmatrix(), getLeafDistance(), getLeaves4node(), getRoute2Root(), WMHierchClustDisplay::initializeColorsHdist(), WMHierchClustDisplay::initializeColorsSize(), WMHierchClustDisplay::initProperties(), WNonBinDendroGeode::layout(), WHtreePartition::level2granularity(), WMHierchClustDisplay::moduleMain(), WHtree::compSize::operator()(), WHtree::compHLevel::operator()(), WHtreePartition::partitionClassic(), WHtreePartition::partitionOptimized(), WHtreePartition::partitionSharp(), WHtreePartition::partitionSmooth(), WHtreeProcesser::pruneTree(), WHtreePartition::scanOptimalPartitions(), testRootBaseNodes(), WMHierchClustDisplay::updateWidgets(), and WMHierchClustDisplay::writePartition().

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

◆ getNode() [2/2]

const WHnode & WHtree::getNode ( const size_t  thisNode) const

returns a const pointer to the node indicated by the ID

Parameters
thisNodeid of the required node
Returns
const reference to desired node object

Definition at line 318 of file WHtree.cpp.

References wlog::error(), and m_nodes.

+ Here is the call graph for this function:

◆ getNodes()

std::vector< WHnode > WHtree::getNodes ( ) const
inline

Returns the nodes of the tree.

Returns
nodes vector

Definition at line 846 of file WHtree.h.

References m_nodes.

◆ getNumDiscarded()

size_t WHtree::getNumDiscarded ( ) const
inline

Returns the number of leaves of the tree.

Returns
number of leaves

Definition at line 850 of file WHtree.h.

References m_discarded.

Referenced by WMHierchClustDisplay::initProperties().

+ Here is the caller graph for this function:

◆ getNumLeaves()

size_t WHtree::getNumLeaves ( ) const
inline

Returns the number of leaves of the tree.

Returns
number of leaves

Definition at line 831 of file WHtree.h.

References m_leaves.

Referenced by WHtreeProcesser::baseNodes2Leaves(), cleanup(), debinarize(), WMHierchClustDisplay::initProperties(), WMHierchClustDisplay::moduleMain(), WHtreePartition::partitionSmooth(), WHtreeProcesser::pruneRandom(), WHtreeProcesser::pruneTree(), sortBySize(), writeTreeOldWalnut(), and writeTreeSimple().

+ Here is the caller graph for this function:

◆ getNumNodes()

size_t WHtree::getNumNodes ( ) const
inline

◆ getReport()

std::string WHtree::getReport ( bool  longMsg = true) const

writes out a small report status of the tree

Parameters
longMsgif set a longer two-line message will be output
Returns
string with the status message

Definition at line 132 of file WHtree.cpp.

References WHcoord::getNameString(), m_cpcc, m_datasetGrid, m_datasetSize, m_leaves, m_loadStatus, m_nodes, and string_utils::toString().

+ Here is the call graph for this function:

◆ getRoi()

std::vector< WHcoord > WHtree::getRoi ( ) const
inline

Returns the roi coordinate vector.

Returns
vector containing the roi coordinates

Definition at line 870 of file WHtree.h.

References m_coordinates.

Referenced by WMHierchClustDisplay::updateOutput2().

+ Here is the caller graph for this function:

◆ getRoot()

const WHnode & WHtree::getRoot ( ) const

◆ getRootBaseNodes()

std::vector< size_t > WHtree::getRootBaseNodes ( ) const

returns a vector with all the nodes that have direct link to leaves from the main root

Returns
nodeId vector of base nodes

Definition at line 706 of file WHtree.cpp.

References getBaseNodes(), and getRoot().

Referenced by WHtreeProcesser::baseNodes2Leaves(), WMHierchClustDisplay::initProperties(), WHtreePartition::level2granularity(), and testRootBaseNodes().

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

◆ getRoute2Root()

std::vector< nodeID_t > WHtree::getRoute2Root ( const nodeID_t &  nodeID) const

node route to root node

Parameters
nodeIDfull id of the selected node
Returns
nodeId vector of nodes in the route

Definition at line 589 of file WHtree.cpp.

References wlog::error(), WHnode::getFullID(), WHnode::getHLevel(), getNode(), WHnode::getParent(), getRoot(), WHnode::isRoot(), and m_nodes.

+ Here is the call graph for this function:

◆ getSelectedColors() [1/2]

std::vector< std::vector< WHcoord > > WHtree::getSelectedColors ( ) const
inline

Returns the set of the selected partition colors.

Returns
vector containing the selected partitions colors

Definition at line 919 of file WHtree.h.

References m_selectedColors.

Referenced by WMHierchClustDisplay::addPartitions(), WMHierchClustDisplay::clusterSelection(), and WMHierchClustDisplay::recolorPartitions().

+ Here is the caller graph for this function:

◆ getSelectedColors() [2/2]

std::vector< WHcoord > WHtree::getSelectedColors ( size_t  index) const
inline

Returns the selected partition colors from the saved set.

Parameters
indexindex of the desired partition
Returns
vector containing the selected partition colors

Definition at line 924 of file WHtree.h.

References m_selectedColors.

◆ getSelectedPartitions() [1/2]

std::vector< std::vector< size_t > > WHtree::getSelectedPartitions ( ) const
inline

Returns the set of the selected partitions.

Returns
vector containing the selected partitions

Definition at line 902 of file WHtree.h.

References m_selectedPartitions.

Referenced by WMHierchClustDisplay::addPartitions(), WMHierchClustDisplay::clusterSelection(), and WMHierchClustDisplay::recolorPartitions().

+ Here is the caller graph for this function:

◆ getSelectedPartitions() [2/2]

std::vector< size_t > WHtree::getSelectedPartitions ( size_t  index) const
inline

Returns the indicated selected partition from the saved set.

Parameters
indexindex of the desired partition
Returns
vector containing the selected partition

Definition at line 907 of file WHtree.h.

References m_selectedPartitions.

◆ getSelectedValues() [1/2]

std::vector< float > WHtree::getSelectedValues ( ) const
inline

Returns the cutting values for the selected partitions.

Returns
vector containing the values for the selected partitions

Definition at line 885 of file WHtree.h.

References m_selectedValues.

Referenced by WMHierchClustDisplay::addPartitions(), WMHierchClustDisplay::clusterSelection(), WMHierchClustDisplay::initProperties(), and WMHierchClustDisplay::recolorPartitions().

+ Here is the caller graph for this function:

◆ getSelectedValues() [2/2]

float WHtree::getSelectedValues ( size_t  index) const
inline

Returns the cutting values for the selected partition.

Parameters
indexindex of the desired partition
Returns
cutting values for the selected partition

Definition at line 890 of file WHtree.h.

References m_selectedValues.

◆ getTrackID()

size_t WHtree::getTrackID ( const size_t &  leafID) const

returns the corresponding track ID to a leaf ID on the tree

Parameters
leafIDinput leaf ID
Returns
ID of seed tractogram corresponding to that leaf

Definition at line 367 of file WHtree.cpp.

References m_trackids.

Referenced by writeTreeDebug().

+ Here is the caller graph for this function:

◆ getTrackids()

std::vector< size_t > WHtree::getTrackids ( ) const
inline

Returns the tractogram IDs vector.

Returns
vector containing the tractogram ids per leaf

Definition at line 875 of file WHtree.h.

References m_trackids.

◆ getTripletOrder()

unsigned int WHtree::getTripletOrder ( const nodeID_t &  nodeIDa,
const nodeID_t &  nodeIDb,
const nodeID_t &  nodeIDc 
) const

checks the joining order of a given triplet

Parameters
nodeIDafirst node/leaf of the triplet
nodeIDbsecond node/leaf of the triplet
nodeIDcsecond node/leaf of the triplet
Returns
joining order: 0="non resolved" (a,b,c join at the same time), 1="ab before c", 2="ac before b", 3="bc before a"

Definition at line 612 of file WHtree.cpp.

References getCommonAncestor().

+ Here is the call graph for this function:

◆ insertPartColors()

void WHtree::insertPartColors ( const std::vector< std::vector< WHcoord > > &  selectedColors)

insert a set of partitions colors into the tree data in case a set of saved partitions is already present

Parameters
selectedColorsthe set of new colors for the included partitions

Definition at line 1511 of file WHtree.cpp.

References clearPartColors(), wlog::error(), m_selectedColors, and m_selectedPartitions.

+ Here is the call graph for this function:

◆ insertPartitions()

void WHtree::insertPartitions ( const std::vector< std::vector< size_t > > &  selectedPartitions,
const std::vector< float > &  selectedValues,
const std::vector< std::vector< WHcoord > > &  selectedColors = std::vector<std::vector<WHcoord> >() 
)

insert a set of partitions into the tree data

Parameters
selectedPartitionsa set of partitions
selectedValuesthe quality values for those partitions
selectedColorsthe colors for each cluster of each partitions

Definition at line 1473 of file WHtree.cpp.

References clearPartitions(), wlog::error(), m_selectedColors, m_selectedPartitions, and m_selectedValues.

Referenced by WMHierchClustDisplay::addPartitions(), and WMHierchClustDisplay::recolorPartitions().

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

◆ isLoaded()

bool WHtree::isLoaded ( ) const
inline

Returns the loading status of the tree.

Returns
load indicator

Definition at line 826 of file WHtree.h.

References m_loadStatus.

Referenced by WMHierchClustDisplay::dendrogramClick(), and WMHierchClustDisplay::dendrogramClickRight().

+ Here is the caller graph for this function:

◆ loadContainedLeaves()

void WHtree::loadContainedLeaves ( )

stores the contained leaves for each node

Definition at line 838 of file WHtree.cpp.

References m_containedLeaves, m_leaves, and m_nodes.

◆ readTree()

bool WHtree::readTree ( const std::string &  filename)

Reads the the tree data from a file and creates the structure, containing it in the leaves, nodes and coordinates vectors.

Parameters
filenamestring containing std::vector<hNode> m_leavesthe name of the file with the tree data
Returns
success indicator

Definition at line 911 of file WHtree.cpp.

References check(), clearPartitions(), wlog::error(), fetchNode(), WHnode::getHLevel(), WFileParser::getLinesForTagSeparated(), WFileParser::getRawLines(), WHnode::getSize(), m_coordinates, m_cpcc, m_datasetGrid, m_datasetSize, m_discarded, m_leaves, m_loadStatus, m_logFactor, m_nodes, m_numStreamlines, m_selectedColors, m_selectedPartitions, m_selectedValues, m_trackids, m_treeName, WFileParser::readFile(), and WHnode::setParent().

Referenced by WMHierchClustDisplay::moduleMain(), and WHtree().

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

◆ sortByHLevel() [1/4]

void WHtree::sortByHLevel ( std::list< nodeID_t > *const  nodeList) const

Reorders the nodes in the list according to their hierarchical level.

Parameters
nodeListvector of nodes to be reordered

Definition at line 832 of file WHtree.cpp.

◆ sortByHLevel() [2/4]

void WHtree::sortByHLevel ( std::list< size_t > *const  nodeList) const

Reorders the nodes in the list according to their hierarchical level.

Parameters
nodeListlist of nodes to be reordered

Definition at line 827 of file WHtree.cpp.

◆ sortByHLevel() [3/4]

void WHtree::sortByHLevel ( std::vector< nodeID_t > *const  nodeVector) const

Reorders the nodes in the vector according to their hierarchical level.

Parameters
nodeVectorvector of nodes to be reordered

Definition at line 822 of file WHtree.cpp.

◆ sortByHLevel() [4/4]

void WHtree::sortByHLevel ( std::vector< size_t > *const  nodeVector) const

Reorders the nodes in the vector according to their hierarchical level.

Parameters
nodeVectorvector of nodes to be reordered

Definition at line 817 of file WHtree.cpp.

Referenced by WHtreePartition::partitionClassic().

+ Here is the caller graph for this function:

◆ sortBySize() [1/4]

void WHtree::sortBySize ( std::list< nodeID_t > *const  nodeList) const

Reorders the nodes in the list according to their size.

Parameters
nodeListvector of nodes to be reordered

Definition at line 800 of file WHtree.cpp.

References wlog::error(), getNumLeaves(), and getNumNodes().

+ Here is the call graph for this function:

◆ sortBySize() [2/4]

void WHtree::sortBySize ( std::list< size_t > *const  nodeList) const

Reorders the nodes in the list according to their size.

Parameters
nodeListlist of nodes to be reordered

Definition at line 770 of file WHtree.cpp.

References wlog::error(), and getNumNodes().

+ Here is the call graph for this function:

◆ sortBySize() [3/4]

void WHtree::sortBySize ( std::vector< nodeID_t > *const  nodeVector) const

Reorders the nodes in the vector according to their size.

Parameters
nodeVectorvector of nodes to be reordered

Definition at line 784 of file WHtree.cpp.

References wlog::error(), getNumLeaves(), and getNumNodes().

+ Here is the call graph for this function:

◆ sortBySize() [4/4]

void WHtree::sortBySize ( std::vector< size_t > *const  nodeVector) const

Reorders the nodes in the vector according to their size.

Parameters
nodeVectorvector of nodes to be reordered

Definition at line 755 of file WHtree.cpp.

References wlog::error(), and getNumNodes().

Referenced by WMHierchClustDisplay::assignColorHierch(), WNonBinDendroGeode::findClickedCluster(), WMHierchClustDisplay::initializeColorsHdist(), WMHierchClustDisplay::initializeColorsSize(), WMHierchClustDisplay::initProperties(), WNonBinDendroGeode::layout(), WHtreePartition::partitionClassic(), and WMHierchClustDisplay::updateSelection().

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

◆ testRootBaseNodes()

bool WHtree::testRootBaseNodes ( ) const

tests if all base nodes have only leaf children

Returns
true if all base nodes have only leaf children

Definition at line 712 of file WHtree.cpp.

References getNode(), and getRootBaseNodes().

Referenced by WHtreeProcesser::baseNodes2Leaves(), debinarize(), and WHtreeProcesser::flattenSelection().

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

◆ writeTree()

bool WHtree::writeTree ( const std::string &  filename,
const bool  isNifti = true 
) const

writes the current tree data

Parameters
filenamestring containing the name of the file to be written
isNiftia flag indicating whether the tree should be written in nifti coordinates
Returns
success indicator

Definition at line 1233 of file WHtree.cpp.

References wlog::error(), m_coordinates, m_cpcc, m_datasetGrid, m_datasetSize, m_discarded, m_logFactor, m_nodes, m_numStreamlines, m_selectedColors, m_selectedPartitions, m_selectedValues, m_trackids, WHcoord::m_x, WHcoord::m_y, WHcoord::m_z, WHcoord::nifti2vista(), string_utils::toString(), and WHcoord::vista2nifti().

Referenced by WMHierchClustDisplay::moduleMain().

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

◆ writeTreeDebug()

bool WHtree::writeTreeDebug ( const std::string &  filename) const

writes all redundant tree data for debugging purposes

Parameters
filenamestring containing the name of the file to be written
Returns
success indicator

Definition at line 1380 of file WHtree.cpp.

References getCoordinate4leaf(), getTrackID(), m_cpcc, m_datasetGrid, m_datasetSize, m_leaves, m_logFactor, m_nodes, m_numStreamlines, and string_utils::toString().

+ Here is the call graph for this function:

◆ writeTreeOldWalnut()

bool WHtree::writeTreeOldWalnut ( const std::string &  filename) const

writes dta for working with the old walnut module

Parameters
filenamestring containing the name of the file to be written
Returns
success indicator

Definition at line 1416 of file WHtree.cpp.

References getNumLeaves(), m_coordinates, m_datasetGrid, m_datasetSize, m_nodes, WHcoord::m_x, WHcoord::m_y, WHcoord::m_z, string_utils::toString(), and WHcoord::vista2nifti().

+ Here is the call graph for this function:

◆ writeTreeSimple()

bool WHtree::writeTreeSimple ( const std::string &  filename) const

writes only join data without coordinates or reading labels

Parameters
filenamestring containing the name of the file to be written
Returns
success indicator

Definition at line 1457 of file WHtree.cpp.

References getNumLeaves(), and m_nodes.

+ Here is the call graph for this function:

Friends And Related Function Documentation

◆ CnbTreeBuilder

friend class CnbTreeBuilder
friend

friend class

Definition at line 608 of file WHtree.h.

◆ graphTreeBuilder

friend class graphTreeBuilder
friend

friend class

Definition at line 609 of file WHtree.h.

◆ image2treeBuilder

friend class image2treeBuilder
friend

friend class

Definition at line 613 of file WHtree.h.

◆ pruneTree

friend class pruneTree
friend

friend class

Definition at line 612 of file WHtree.h.

◆ randCnbTreeBuilder

friend class randCnbTreeBuilder
friend

friend class

Definition at line 610 of file WHtree.h.

◆ treeComparer

friend class treeComparer
friend

friend class

Definition at line 611 of file WHtree.h.

◆ treeManager

friend class treeManager
friend

friend class

Definition at line 604 of file WHtree.h.

◆ WHtreePartition

friend class WHtreePartition
friend

friend class

Definition at line 606 of file WHtree.h.

◆ WHtreeProcesser

friend class WHtreeProcesser
friend

friend class

Definition at line 605 of file WHtree.h.

Member Data Documentation

◆ m_containedLeaves

std::vector<std::vector<size_t> > WHtree::m_containedLeaves
private

Stores the contained leafs of each node.

Definition at line 658 of file WHtree.h.

Referenced by clearContainedLeaves(), getLeaves4node(), and loadContainedLeaves().

◆ m_coordinates

std::vector<WHcoord> WHtree::m_coordinates
private

Stores the coordinates of the leaf voxels.

Definition at line 649 of file WHtree.h.

Referenced by check(), cleanup(), WHtreeProcesser::coarseTree(), convert2grid(), getCoordinate4leaf(), getLeafID(), getRoi(), readTree(), writeTree(), and writeTreeOldWalnut().

◆ m_cpcc

float WHtree::m_cpcc
private

Stores the cpcc value of the tree.

Definition at line 637 of file WHtree.h.

Referenced by cleanup(), debinarize(), getCpcc(), getReport(), readTree(), writeTree(), and writeTreeDebug().

◆ m_datasetGrid

HC_GRID WHtree::m_datasetGrid
private

Stores the the type of coordinate grid of the dataset.

Definition at line 628 of file WHtree.h.

Referenced by convert2grid(), getDataGrid(), getReport(), readTree(), writeTree(), writeTreeDebug(), and writeTreeOldWalnut().

◆ m_datasetSize

WHcoord WHtree::m_datasetSize
private

Stores the size of the dataset this tree was built from.

Definition at line 625 of file WHtree.h.

Referenced by WHtreeProcesser::coarseTree(), convert2grid(), getDataSize(), getReport(), readTree(), writeTree(), writeTreeDebug(), and writeTreeOldWalnut().

◆ m_discarded

std::list<WHcoord> WHtree::m_discarded
private

Stores the coordinates of the voxels that were discarded during the process of building the tree.

Definition at line 655 of file WHtree.h.

Referenced by cleanup(), WHtreeProcesser::coarseTree(), convert2grid(), getDiscarded(), getNumDiscarded(), readTree(), and writeTree().

◆ m_leaves

std::vector<WHnode> WHtree::m_leaves
private

Stores all the leaves of the tree (represents a single voxel, for several purposes a leaf also counts as a node.

Definition at line 643 of file WHtree.h.

Referenced by check(), cleanup(), fetchLeaf(), getBaseNodes(), getLeaf(), getLeaves(), getNumLeaves(), getReport(), loadContainedLeaves(), WHtreeProcesser::pruneTree(), readTree(), and writeTreeDebug().

◆ m_loadStatus

bool WHtree::m_loadStatus
private

Stores all the leaves of the tree (represents a single voxel, for several purposes a leaf also counts as a node.

Definition at line 622 of file WHtree.h.

Referenced by getReport(), isLoaded(), readTree(), and WHtree().

◆ m_logFactor

float WHtree::m_logFactor
private

logarithmic normalization factor used in the tractograms when building the tree

Definition at line 634 of file WHtree.h.

Referenced by readTree(), writeTree(), and writeTreeDebug().

◆ m_nodes

std::vector<WHnode> WHtree::m_nodes
private

◆ m_numStreamlines

size_t WHtree::m_numStreamlines
private

number of streamlines generated form each seed voxel in the tractograms used to build the tree

Definition at line 631 of file WHtree.h.

Referenced by readTree(), writeTree(), and writeTreeDebug().

◆ m_selectedColors

std::vector< std::vector< WHcoord > > WHtree::m_selectedColors
private

Stores the colors of the selected partitions.

Definition at line 667 of file WHtree.h.

Referenced by clearPartColors(), clearPartitions(), getSelectedColors(), insertPartColors(), insertPartitions(), readTree(), and writeTree().

◆ m_selectedPartitions

std::vector< std::vector<size_t> > WHtree::m_selectedPartitions
private

Stores a set of selected partitions.

Definition at line 661 of file WHtree.h.

Referenced by clearPartitions(), getSelectedPartitions(), insertPartColors(), insertPartitions(), readTree(), and writeTree().

◆ m_selectedValues

std::vector< float > WHtree::m_selectedValues
private

Stores the quality values of the selected partitions.

Definition at line 664 of file WHtree.h.

Referenced by clearPartitions(), getSelectedValues(), insertPartitions(), readTree(), and writeTree().

◆ m_trackids

std::vector<size_t> WHtree::m_trackids
private

Stores the ids of the seed tracts correesponding to each leaf.

Definition at line 652 of file WHtree.h.

Referenced by check(), cleanup(), getTrackID(), getTrackids(), readTree(), and writeTree().

◆ m_treeName

std::string WHtree::m_treeName
private

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