本文整理汇总了C++中ZSwcTree::resortId方法的典型用法代码示例。如果您正苦于以下问题:C++ ZSwcTree::resortId方法的具体用法?C++ ZSwcTree::resortId怎么用?C++ ZSwcTree::resortId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZSwcTree
的用法示例。
在下文中一共展示了ZSwcTree::resortId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createSwc
ZSwcTree* ZSwcGenerator::createSwc(const ZFlyEmNeuronRange &range)
{
if (range.isEmpty()) {
return NULL;
}
double minZ = range.getMinZ();
double maxZ = range.getMaxZ();
double dz = (maxZ - minZ) / 50.0;
if (dz == 0.0) { //Avoid dead loop
dz = 1.0;
}
ZSwcTree *tree = createVirtualRootSwc();
for (double z = minZ; z <= maxZ; z += dz) {
double r = range.getRadius(z);
ZSwcTree *subtree = createCircleSwc(0, 0, z, r);
tree->merge(subtree, true);
}
tree->resortId();
return tree;
}
示例2: createCircleSwc
ZSwcTree* ZSwcGenerator::createCircleSwc(double cx, double cy, double cz, double r)
{
if (r < 0.0) {
return NULL;
}
ZSwcTree *tree = createVirtualRootSwc();
Swc_Tree_Node *parent = tree->root();
double nodeRadius = r * 0.05;
for (double angle = 0.0; angle < 6.0; angle += 0.314) {
double x, y, z;
x = r * cos(angle) + cx;
y = r * sin(angle) + cy;
z = cz;
Swc_Tree_Node *tn = SwcTreeNode::makePointer(x, y, z, nodeRadius);
SwcTreeNode::setParent(tn, parent);
parent = tn;
}
Swc_Tree_Node *tn = SwcTreeNode::makePointer();
SwcTreeNode::copyProperty(SwcTreeNode::firstChild(tree->root()), tn);
SwcTreeNode::setParent(tn, parent);
tree->resortId();
return tree;
}
示例3: createRangeCompareSwc
ZSwcTree* ZSwcGenerator::createRangeCompareSwc(
const ZFlyEmNeuronRange &range, const ZFlyEmNeuronRange &reference)
{
if (range.isEmpty()) {
return NULL;
}
double minZ = range.getMinZ();
double maxZ = range.getMaxZ();
double dz = (maxZ - minZ) / 50.0;
if (dz == 0.0) { //Avoid dead loop
dz = 1.0;
}
ZSwcTree *tree = createVirtualRootSwc();
double minReferenceZ = reference.getMinZ();
double maxReferenceZ = reference.getMaxZ();
for (double z = minReferenceZ; z < minZ; z += dz) {
ZSwcTree *subtree = createCircleSwc(0, 0, z, reference.getRadius(z));
subtree->setType(5);
tree->merge(subtree, true);
}
for (double z = maxZ + dz; z <= maxReferenceZ; z += dz) {
ZSwcTree *subtree = createCircleSwc(0, 0, z, reference.getRadius(z));
subtree->setType(5);
tree->merge(subtree, true);
}
for (double z = minZ; z <= maxZ; z += dz) {
double r = range.getRadius(z);
ZSwcTree *subtree = createCircleSwc(0, 0, z, r);
ZFlyEmNeuronRangeCompare comp;
ZFlyEmNeuronRangeCompare::EMatchStatus status =
comp.compare(range, reference, z);
switch (status) {
case ZFlyEmNeuronRangeCompare::MISSING_BRANCH:
subtree->setType(2);
break;
case ZFlyEmNeuronRangeCompare::EXTRA_BRANCH:
subtree->setType(3);
break;
case ZFlyEmNeuronRangeCompare::GOOD_MATCH:
subtree->setType(0);
break;
default:
subtree->setType(0);
}
tree->merge(subtree, true);
}
tree->resortId();
return tree;
}
示例4:
void FlyEm::ZSubstackRoi::exportSwc(const string &filePath)
{
if (!m_cuboidArray.empty()) {
ZSwcTree *tree = new ZSwcTree;
int index = 0;
for (ZIntCuboidArray::const_iterator iter = m_cuboidArray.begin();
iter != m_cuboidArray.end(); ++iter, ++index) {
ZCuboid cuboid;
cuboid.set(iter->cb[0], iter->cb[1], iter->cb[2], iter->ce[0], iter->ce[1],
iter->ce[2]);
ZSwcTree *subtree = ZSwcTree::CreateCuboidSwc(cuboid);
if (!m_idArray.empty()) {
subtree->setType(m_idArray[index]);
} else {
subtree->setType(index);
}
tree->merge(subtree, true);
}
tree->resortId();
tree->save(filePath);
delete tree;
}
}
示例5: free
ZSwcTree *ZNeuronConstructor::reconstruct(
std::vector<Locseg_Chain*> &chainArray)
{
ZSwcTree *tree = NULL;
if (!chainArray.empty()) {
int chain_number = chainArray.size();
/* <neuronComponent> allocated */
Neuron_Component *neuronComponent =
Make_Neuron_Component_Array(chain_number);
for (int i = 0; i < chain_number; i++) {
Set_Neuron_Component(neuronComponent + i,
NEUROCOMP_TYPE_LOCSEG_CHAIN,
chainArray[i]);
}
/* reconstruct neuron */
/* alloc <ns> */
double zscale = 1.0;
Neuron_Structure *ns = Locseg_Chain_Comp_Neurostruct(
neuronComponent, chain_number, m_signal, zscale, m_connWorkspace);
Process_Neuron_Structure(ns);
if (m_connWorkspace->crossover_test == TRUE) {
Neuron_Structure_Crossover_Test(ns, zscale);
}
/* alloc <ns2> */
Neuron_Structure* ns2=
Neuron_Structure_Locseg_Chain_To_Circle_S(ns, 1.0, 1.0);
Neuron_Structure_To_Tree(ns2);
tree = new ZSwcTree;
tree->setData(Neuron_Structure_To_Swc_Tree_Circle_Z(ns2, 1.0, NULL));
tree->resortId();
/* free <ns2> */
Kill_Neuron_Structure(ns2);
/* free <ns> */
ns->comp = NULL;
Kill_Neuron_Structure(ns);
/* free <neuronComponent> */
Clean_Neuron_Component_Array(neuronComponent, chain_number);
free(neuronComponent);
}
return tree;
}
示例6: exportSwc
void ZIntCuboidArray::exportSwc(const string &filePath) const
{
if (!empty()) {
ZSwcTree *tree = new ZSwcTree;
int index = 0;
for (ZIntCuboidArray::const_iterator iter = begin(); iter != end();
++iter, ++index) {
ZCuboid cuboid;
cuboid.set(iter->cb[0], iter->cb[1], iter->cb[2], iter->ce[0], iter->ce[1],
iter->ce[2]);
ZSwcTree *subtree = ZSwcTree::CreateCuboidSwc(cuboid);
subtree->setType(index);
tree->merge(subtree, true);
}
tree->resortId();
tree->save(filePath);
delete tree;
}
}
示例7: toSwc
ZSwcTree* ZIntCuboidArray::toSwc() const
{
ZSwcTree *tree = NULL;
if (!empty()) {
tree = new ZSwcTree;
int index = 0;
for (ZIntCuboidArray::const_iterator iter = begin(); iter != end();
++iter, ++index) {
ZCuboid cuboid;
cuboid.set(iter->cb[0], iter->cb[1], iter->cb[2], iter->ce[0], iter->ce[1],
iter->ce[2]);
ZSwcTree *subtree = ZSwcTree::CreateCuboidSwc(cuboid);
subtree->setType(index);
tree->merge(subtree, true);
}
tree->resortId();
}
return tree;
}