本文整理汇总了C++中ZSwcTree::setLabel方法的典型用法代码示例。如果您正苦于以下问题:C++ ZSwcTree::setLabel方法的具体用法?C++ ZSwcTree::setLabel怎么用?C++ ZSwcTree::setLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZSwcTree
的用法示例。
在下文中一共展示了ZSwcTree::setLabel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: select
ZSwcTreeNodeArray ZSwcNodeDistSelector::select(const ZSwcTree &tree) const
{
tree.setLabel(0);
ZSwcTreeNodeArray nodeArray;
tree.updateIterator(SWC_TREE_ITERATOR_DEPTH_FIRST);
Swc_Tree_Node *tn = tree.begin();
if (SwcTreeNode::isVirtual(tn)) {
tn = tree.next();
}
if (SwcTreeNode::isRegular(tn)) {
nodeArray.push_back(tn);
SwcTreeNode::setLabel(tn, 1);
}
for (; tn != NULL; tn = tree.next()) {
double dist = 0.0;
Swc_Tree_Node *parent = tn;
while (parent != NULL) {
dist += SwcTreeNode::length(parent);
if (dist > m_minDistance) {
nodeArray.push_back(tn);
SwcTreeNode::setLabel(tn, 1);
}
parent = SwcTreeNode::parent(parent);
if ((parent == NULL) || SwcTreeNode::label(parent) > 0) {
break;
}
}
}
#if 0
#ifdef _DEBUG_2
tree.print();
#endif
tree.updateIterator(SWC_TREE_ITERATOR_LEAF);
for (Swc_Tree_Node *tn = tree.begin(); tn != NULL; tn = tree.next()) {
nodeArray.push_back(tn);
SwcTreeNode::setLabel(tn, 2);
double dist = 0;
Swc_Tree_Node *parent = SwcTreeNode::parent(tn);
if (SwcTreeNode::label(parent) > 0 || SwcTreeNode::isVirtual(parent)) {
continue;
}
dist += SwcTreeNode::length(tn);
while (SwcTreeNode::isRegular(parent)) {
SwcTreeNode::setLabel(parent, 1);
if (dist >= m_minDistance) {
nodeArray.push_back(parent);
dist = 0;
SwcTreeNode::setLabel(parent, 2);
}
dist += SwcTreeNode::length(parent);
parent = SwcTreeNode::parent(parent);
if (SwcTreeNode::label(parent) > 0) {
break;
}
}
}
#endif
return nodeArray;
}