OpenWalnut
1.5.0dev
|
this class implements a hierarchical tree and provides functions for creation, partitioning, selection and navigation More...
#include <WHtree.h>
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< WHnode > | getLeaves () const |
Returns the leaves of the tree. More... | |
std::vector< WHnode > | getNodes () 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< WHcoord > | getRoi () const |
Returns the roi coordinate vector. More... | |
std::vector< size_t > | getTrackids () const |
Returns the tractogram IDs vector. More... | |
std::list< WHcoord > | getDiscarded () 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< WHcoord > | getSelectedColors (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 WHnode & | getNode (const nodeID_t &thisNode) const |
returns a const pointer to the node indicated by the ID More... | |
const WHnode & | getNode (const size_t thisNode) const |
returns a const pointer to the node indicated by the ID More... | |
const WHnode & | getLeaf (const size_t thisLeaf) const |
returns a const pointer to the leaf indicated by the ID More... | |
const WHnode & | getRoot () 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< WHcoord > | getCoordinates4node (const size_t nodeID) const |
Returns a vector with all the seed voxel coordinates contained in that cluster. More... | |
std::vector< WHcoord > | getCoordinates4node (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 | |
WHnode * | fetchNode (const nodeID_t &thisNode) |
returns a pointer to the node indicated by the ID More... | |
WHnode * | fetchNode (const size_t thisNode) |
returns a pointer to the node indicated by the ID More... | |
WHnode * | fetchLeaf (const size_t thisLeaf) |
returns a pointer to the leaf indicated by the ID More... | |
WHnode * | fetchRoot () |
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< WHnode > | m_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< WHnode > | m_nodes |
Stores all the nodes (non-leaves) of the tree. More... | |
std::vector< WHcoord > | m_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< WHcoord > | m_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... | |
this class implements a hierarchical tree and provides functions for creation, partitioning, selection and navigation
|
explicit |
Constructor.
Definition at line 73 of file WHtree.cpp.
|
explicit |
Constructor.
filename | string containing the name of the file with the tree data |
Definition at line 77 of file WHtree.cpp.
References readTree().
|
explicit |
Constructor.
treeName | name of the tree |
datasetGridInit | type of grid coordinate space |
datasetSizeInit | size of the brain dataset |
numStreamlinesInit | number of streamlines per voxel on the tractograms that were processed to build this tree |
logFactorInit | logarithmic normalization factor that was applied on the tracts when building the tree |
leavesInit | vector of leaves |
nodesInit | vector of nodes |
trackidInit | vector of seed track ids |
coordInit | vector of seed voxel coordinates |
discardInit | vector of discarded seed voxel coordinates |
cpccInit | cpcc value of the tree |
Definition at line 82 of file WHtree.cpp.
References check(), and m_loadStatus.
|
explicit |
WHtree::~WHtree | ( | ) |
Destructor.
Definition at line 121 of file WHtree.cpp.
bool WHtree::check | ( | ) | const |
checks tree integrity
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().
|
private |
cleans leaves/nodes set to be pruned
outLookup | pointer to a vector where to store the lookup table of changes done to nodes |
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().
void WHtree::clearContainedLeaves | ( | ) |
frees the memory of m_containedLeaves
Definition at line 860 of file WHtree.cpp.
References m_containedLeaves.
Referenced by debinarize().
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().
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().
bool WHtree::convert2grid | ( | const HC_GRID | newGrid | ) |
converts all the coordinates to the grid format indicated
newGrid | coordinate space in which to convert |
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().
|
private |
merges nodes joining binary at the same level into non-binary structures
keepBaseNodes | if set basenodes will not be marged |
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().
|
private |
returns a pointer to the leaf indicated by the ID
thisLeaf | id of the required leaf |
Definition at line 1697 of file WHtree.cpp.
References m_leaves.
Referenced by WHtreeProcesser::baseNodes2Leaves(), WHtreeProcesser::coarseTree(), debinarize(), fetchNode(), WHtreeProcesser::flagLeaves(), and WHtreeProcesser::pruneRandom().
|
private |
returns a pointer to the node indicated by the ID
thisNode | full id of the required node |
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().
|
private |
returns a pointer to the node indicated by the ID
thisNode | id of the required node |
Definition at line 1673 of file WHtree.cpp.
References m_nodes.
|
private |
returns a pointer to the root node
Definition at line 1710 of file WHtree.cpp.
References fetchNode(), and getNumNodes().
|
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
errorMult | multiplier 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().
|
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().
|
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().
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
root | full id of the selected subtree root node |
Definition at line 686 of file WHtree.cpp.
References getBaseNodes().
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
root | id of the selected subtree root node |
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().
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)
thisPartition | the starting partition |
depthLevel | the number of levels down to look for sub-partitions |
excludeLeaves | if 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 |
Definition at line 1552 of file WHtree.cpp.
References WHnode::getHLevel(), and getNode().
Referenced by getBranching(), WHtreePartition::partitionOptimized(), and WHtreePartition::scanOptimalPartitions().
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)
thisPartition | the starting partition |
depthLevel | the number of levels down to look for sub-partitions |
partitionSet | (is a return value) the vector of returned sub-partitions |
Definition at line 1627 of file WHtree.cpp.
References wlog::error(), and getBranching().
std::vector< size_t > WHtree::getBranchNodes | ( | const size_t | nodeID | ) | const |
Returns a vector with all the node IDs contained in that branch.
nodeID | id of the selected node |
Definition at line 434 of file WHtree.cpp.
References wlog::error(), getNode(), and getNumNodes().
Referenced by WHtreeProcesser::collapseBranch().
nodeID_t WHtree::getCommonAncestor | ( | const nodeID_t & | nodeID1, |
const nodeID_t & | nodeID2 | ||
) | const |
retrieves the the first common ancestor node of two given nodes
nodeID1 | first node/leaf full id |
nodeID2 | second node/leaf full id |
Definition at line 558 of file WHtree.cpp.
References getCommonAncestor(), getLeaf(), and WHnode::getParent().
size_t WHtree::getCommonAncestor | ( | const size_t | nodeID1, |
const size_t | nodeID2 | ||
) | const |
retrieves the the first common ancestor node of two given nodes
nodeID1 | first node id |
nodeID2 | second node id |
Definition at line 535 of file WHtree.cpp.
References getNode(), and WHnode::getParent().
Referenced by getCommonAncestor(), getDistance(), WHtreePartition::getICDmatrix(), getLeafDistance(), and getTripletOrder().
WHcoord WHtree::getCoordinate4leaf | ( | const size_t | leafID | ) | const |
the coordinates of a particular leaf
leafID | id of the selected leaf |
Definition at line 466 of file WHtree.cpp.
References wlog::error(), and m_coordinates.
Referenced by getCoordinates4node(), getMeanCoordinate4node(), and writeTreeDebug().
std::vector< WHcoord > WHtree::getCoordinates4node | ( | const nodeID_t & | nodeID | ) | const |
Returns a vector with all the seed voxel coordinates contained in that cluster.
nodeID | full id of the selected node |
Definition at line 491 of file WHtree.cpp.
References getCoordinate4leaf(), and getCoordinates4node().
std::vector< WHcoord > WHtree::getCoordinates4node | ( | const size_t | nodeID | ) | const |
Returns a vector with all the seed voxel coordinates contained in that cluster.
nodeID | id of the selected node |
Definition at line 480 of file WHtree.cpp.
References getCoordinate4leaf(), and getLeaves4node().
Referenced by getCoordinates4node(), getMeanCoordinate4node(), WMHierchClustDisplay::initTreeData(), and WMHierchClustDisplay::writePartition().
|
inline |
Returns the cpcc value of the tree.
Definition at line 865 of file WHtree.h.
References m_cpcc.
Referenced by WMHierchClustDisplay::initProperties().
|
inline |
Returns the dataset grid type.
Definition at line 860 of file WHtree.h.
References m_datasetGrid.
|
inline |
Returns the dataset size.
Definition at line 855 of file WHtree.h.
References m_datasetSize.
|
inline |
Returns the discarded list.
Definition at line 880 of file WHtree.h.
References m_discarded.
Referenced by WMHierchClustDisplay::initTreeData(), and WMHierchClustDisplay::updateOutput2().
dist_t WHtree::getDistance | ( | const nodeID_t & | nodeID1, |
const nodeID_t & | nodeID2 | ||
) | const |
computes the cophenetic distance between 2 leaf/nodes
nodeID1 | first node/leaf to compute distance from |
nodeID2 | second node/leaf to compute distance from |
Definition at line 735 of file WHtree.cpp.
References getCommonAncestor(), WHnode::getDistLevel(), and getNode().
dist_t WHtree::getDistance | ( | const size_t | nodeID1, |
const size_t | nodeID2 | ||
) | const |
computes the cophenetic distance between 2 nodes
nodeID1 | first node to compute distance from |
nodeID2 | second node to compute distance from |
Definition at line 730 of file WHtree.cpp.
References getCommonAncestor(), WHnode::getDistLevel(), and getNode().
Referenced by getDistance().
computes the cophenetic distance between 2 leaves
coord1 | first coordinate to compute distance from |
coord2 | second ncoordinate to compute distance from |
Definition at line 740 of file WHtree.cpp.
References getDistance(), and getLeafID().
const WHnode & WHtree::getLeaf | ( | const size_t | thisLeaf | ) | const |
returns a const pointer to the leaf indicated by the ID
thisLeaf | id of the required leaf |
Definition at line 333 of file WHtree.cpp.
References wlog::error(), and m_leaves.
Referenced by getCommonAncestor(), getNode(), and WHtreePartition::partitionSmooth().
dist_t WHtree::getLeafDistance | ( | const size_t | leafID1, |
const size_t | leafID2 | ||
) | const |
computes the cophenetic distance between 2 leaves
leafID1 | first leaf to compute distance from |
leafID2 | second leaf to compute distance from |
Definition at line 748 of file WHtree.cpp.
References getCommonAncestor(), WHnode::getDistLevel(), and getNode().
size_t WHtree::getLeafID | ( | const WHcoord & | thisCoord | ) | const |
returns the leaf ID of a coordinate in the tree
thisCoord | coordinate of the required leaf |
Definition at line 354 of file WHtree.cpp.
References m_coordinates.
Referenced by getDistance().
|
inline |
std::vector< size_t > WHtree::getLeaves4node | ( | const nodeID_t & | nodeID | ) | const |
Returns a vector with all the leaf IDs contained in that cluster.
nodeID | full id of the selected node |
Definition at line 421 of file WHtree.cpp.
References getLeaves4node().
std::vector< size_t > WHtree::getLeaves4node | ( | const size_t | nodeID | ) | const |
Returns a vector with all the leaf IDs contained in that cluster.
nodeID | id of the selected node |
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().
WHcoord WHtree::getMeanCoordinate4node | ( | const nodeID_t & | nodeID | ) | const |
Returns the mean coordinate of all the seed voxel coordinates contained in that cluster.
nodeID | full id of the selected node |
Definition at line 522 of file WHtree.cpp.
References getCoordinate4leaf(), and getMeanCoordinate4node().
WHcoord WHtree::getMeanCoordinate4node | ( | const size_t | nodeID | ) | const |
Returns the mean coordinate of all the seed voxel coordinates contained in that cluster.
nodeID | id of the selected node |
Definition at line 504 of file WHtree.cpp.
References getCoordinates4node(), WHcoord::m_x, WHcoord::m_y, and WHcoord::m_z.
Referenced by getMeanCoordinate4node().
|
inline |
Returns the tree name.
Definition at line 821 of file WHtree.h.
References m_treeName.
Referenced by WMHierchClustDisplay::initProperties(), and WMHierchClustDisplay::moduleMain().
const WHnode & WHtree::getNode | ( | const nodeID_t & | thisNode | ) | const |
returns a const pointer to the node indicated by the ID
thisNode | full id of the required node |
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().
const WHnode & WHtree::getNode | ( | const size_t | thisNode | ) | const |
returns a const pointer to the node indicated by the ID
thisNode | id of the required node |
Definition at line 318 of file WHtree.cpp.
References wlog::error(), and m_nodes.
|
inline |
|
inline |
Returns the number of leaves of the tree.
Definition at line 850 of file WHtree.h.
References m_discarded.
Referenced by WMHierchClustDisplay::initProperties().
|
inline |
Returns the number of leaves of the tree.
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().
|
inline |
Returns the number of nodes of the tree.
Definition at line 836 of file WHtree.h.
References m_nodes.
Referenced by cleanup(), debinarize(), fetchRoot(), getBaseNodes(), getBranchNodes(), WMHierchClustDisplay::initializeColorsHdist(), WMHierchClustDisplay::initializeColorsSize(), WMHierchClustDisplay::initProperties(), WMHierchClustDisplay::initTreeData(), WHtreePartition::level2granularity(), WMHierchClustDisplay::moduleMain(), WHtreePartition::partitionClassic(), WHtreePartition::partitionOptimized(), WHtreePartition::partitionSharp(), WHtreePartition::partitionSmooth(), WMHierchClustDisplay::renderCubeMesh(), sortBySize(), and WMHierchClustDisplay::updateColors().
std::string WHtree::getReport | ( | bool | longMsg = true | ) | const |
writes out a small report status of the tree
longMsg | if set a longer two-line message will be output |
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().
|
inline |
Returns the roi coordinate vector.
Definition at line 870 of file WHtree.h.
References m_coordinates.
Referenced by WMHierchClustDisplay::updateOutput2().
const WHnode & WHtree::getRoot | ( | ) | const |
returns a const reference to the root node
Definition at line 348 of file WHtree.cpp.
References m_nodes.
Referenced by WMHierchClustDisplay::addPartitions(), WHtreeProcesser::collapseNode(), WHtreeProcesser::collapseTree(), WHtreeProcesser::collapseTreeLinear(), WHtreeProcesser::collapseTreeSquare(), WNonBinDendroGeode::create(), getBaseNodes(), getRootBaseNodes(), getRoute2Root(), WMHierchClustDisplay::initProperties(), WMHierchClustDisplay::moduleMain(), WHtreePartition::partitionClassic(), WHtreePartition::partitionOptimized(), WHtreePartition::partitionSharp(), WHtreePartition::partitionSmooth(), WHtreePartition::scanHozPartitions(), WHtreePartition::scanOptimalPartitions(), and WMHierchClustDisplay::updateColors().
std::vector< size_t > WHtree::getRootBaseNodes | ( | ) | const |
returns a vector with all the nodes that have direct link to leaves from the main root
Definition at line 706 of file WHtree.cpp.
References getBaseNodes(), and getRoot().
Referenced by WHtreeProcesser::baseNodes2Leaves(), WMHierchClustDisplay::initProperties(), WHtreePartition::level2granularity(), and testRootBaseNodes().
std::vector< nodeID_t > WHtree::getRoute2Root | ( | const nodeID_t & | nodeID | ) | const |
node route to root node
nodeID | full id of the selected node |
Definition at line 589 of file WHtree.cpp.
References wlog::error(), WHnode::getFullID(), WHnode::getHLevel(), getNode(), WHnode::getParent(), getRoot(), WHnode::isRoot(), and m_nodes.
|
inline |
Returns the set of the selected partition colors.
Definition at line 919 of file WHtree.h.
References m_selectedColors.
Referenced by WMHierchClustDisplay::addPartitions(), WMHierchClustDisplay::clusterSelection(), and WMHierchClustDisplay::recolorPartitions().
|
inline |
Returns the selected partition colors from the saved set.
index | index of the desired partition |
Definition at line 924 of file WHtree.h.
References m_selectedColors.
|
inline |
Returns the set of the selected partitions.
Definition at line 902 of file WHtree.h.
References m_selectedPartitions.
Referenced by WMHierchClustDisplay::addPartitions(), WMHierchClustDisplay::clusterSelection(), and WMHierchClustDisplay::recolorPartitions().
|
inline |
Returns the indicated selected partition from the saved set.
index | index of the desired partition |
Definition at line 907 of file WHtree.h.
References m_selectedPartitions.
|
inline |
Returns the cutting 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().
|
inline |
Returns the cutting values for the selected partition.
index | index of the desired partition |
Definition at line 890 of file WHtree.h.
References m_selectedValues.
size_t WHtree::getTrackID | ( | const size_t & | leafID | ) | const |
returns the corresponding track ID to a leaf ID on the tree
leafID | input leaf ID |
Definition at line 367 of file WHtree.cpp.
References m_trackids.
Referenced by writeTreeDebug().
|
inline |
Returns the tractogram IDs vector.
Definition at line 875 of file WHtree.h.
References m_trackids.
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
nodeIDa | first node/leaf of the triplet |
nodeIDb | second node/leaf of the triplet |
nodeIDc | second node/leaf of the triplet |
Definition at line 612 of file WHtree.cpp.
References getCommonAncestor().
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
selectedColors | the 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.
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
selectedPartitions | a set of partitions |
selectedValues | the quality values for those partitions |
selectedColors | the 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().
|
inline |
Returns the loading status of the tree.
Definition at line 826 of file WHtree.h.
References m_loadStatus.
Referenced by WMHierchClustDisplay::dendrogramClick(), and WMHierchClustDisplay::dendrogramClickRight().
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.
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.
filename | string containing std::vector<hNode> m_leavesthe name of the file with the tree data |
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().
void WHtree::sortByHLevel | ( | std::list< nodeID_t > *const | nodeList | ) | const |
Reorders the nodes in the list according to their hierarchical level.
nodeList | vector of nodes to be reordered |
Definition at line 832 of file WHtree.cpp.
void WHtree::sortByHLevel | ( | std::list< size_t > *const | nodeList | ) | const |
Reorders the nodes in the list according to their hierarchical level.
nodeList | list of nodes to be reordered |
Definition at line 827 of file WHtree.cpp.
void WHtree::sortByHLevel | ( | std::vector< nodeID_t > *const | nodeVector | ) | const |
Reorders the nodes in the vector according to their hierarchical level.
nodeVector | vector of nodes to be reordered |
Definition at line 822 of file WHtree.cpp.
void WHtree::sortByHLevel | ( | std::vector< size_t > *const | nodeVector | ) | const |
Reorders the nodes in the vector according to their hierarchical level.
nodeVector | vector of nodes to be reordered |
Definition at line 817 of file WHtree.cpp.
Referenced by WHtreePartition::partitionClassic().
void WHtree::sortBySize | ( | std::list< nodeID_t > *const | nodeList | ) | const |
Reorders the nodes in the list according to their size.
nodeList | vector of nodes to be reordered |
Definition at line 800 of file WHtree.cpp.
References wlog::error(), getNumLeaves(), and getNumNodes().
void WHtree::sortBySize | ( | std::list< size_t > *const | nodeList | ) | const |
Reorders the nodes in the list according to their size.
nodeList | list of nodes to be reordered |
Definition at line 770 of file WHtree.cpp.
References wlog::error(), and getNumNodes().
void WHtree::sortBySize | ( | std::vector< nodeID_t > *const | nodeVector | ) | const |
Reorders the nodes in the vector according to their size.
nodeVector | vector of nodes to be reordered |
Definition at line 784 of file WHtree.cpp.
References wlog::error(), getNumLeaves(), and getNumNodes().
void WHtree::sortBySize | ( | std::vector< size_t > *const | nodeVector | ) | const |
Reorders the nodes in the vector according to their size.
nodeVector | vector 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().
bool WHtree::testRootBaseNodes | ( | ) | const |
tests 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().
bool WHtree::writeTree | ( | const std::string & | filename, |
const bool | isNifti = true |
||
) | const |
writes the current tree data
filename | string containing the name of the file to be written |
isNifti | a flag indicating whether the tree should be written in nifti coordinates |
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().
bool WHtree::writeTreeDebug | ( | const std::string & | filename | ) | const |
writes all redundant tree data for debugging purposes
filename | string containing the name of the file to be written |
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().
bool WHtree::writeTreeOldWalnut | ( | const std::string & | filename | ) | const |
writes dta for working with the old walnut module
filename | string containing the name of the file to be written |
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().
bool WHtree::writeTreeSimple | ( | const std::string & | filename | ) | const |
writes only join data without coordinates or reading labels
filename | string containing the name of the file to be written |
Definition at line 1457 of file WHtree.cpp.
References getNumLeaves(), and m_nodes.
|
friend |
|
friend |
|
private |
Stores the contained leafs of each node.
Definition at line 658 of file WHtree.h.
Referenced by clearContainedLeaves(), getLeaves4node(), and loadContainedLeaves().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
private |
Stores all the nodes (non-leaves) of the tree.
Definition at line 646 of file WHtree.h.
Referenced by check(), cleanup(), debinarize(), fetchNode(), forceMonotonicity(), forceMonotonicityDown(), forceMonotonicityUp(), getLeaves4node(), getNode(), getNodes(), getNumNodes(), getReport(), getRoot(), getRoute2Root(), loadContainedLeaves(), WHtreeProcesser::pruneTree(), readTree(), writeTree(), writeTreeDebug(), writeTreeOldWalnut(), and writeTreeSimple().
|
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().
|
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().
|
private |
Stores a set of selected partitions.
Definition at line 661 of file WHtree.h.
Referenced by clearPartitions(), getSelectedPartitions(), insertPartColors(), insertPartitions(), readTree(), and writeTree().
|
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().
|
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().
|
private |
Stores the name of the tree file.
Definition at line 640 of file WHtree.h.
Referenced by WHtreeProcesser::baseNodes2Leaves(), WHtreeProcesser::coarseTree(), WHtreeProcesser::collapseTree(), WHtreeProcesser::collapseTreeLinear(), WHtreeProcesser::collapseTreeSquare(), getName(), WHtreeProcesser::pruneRandom(), WHtreeProcesser::pruneTree(), and readTree().