本文整理汇总了C++中ZSwcTree::forceVirtualRoot方法的典型用法代码示例。如果您正苦于以下问题:C++ ZSwcTree::forceVirtualRoot方法的具体用法?C++ ZSwcTree::forceVirtualRoot怎么用?C++ ZSwcTree::forceVirtualRoot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZSwcTree
的用法示例。
在下文中一共展示了ZSwcTree::forceVirtualRoot方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createSwc
ZSwcTree* ZSwcGenerator::createSwc(const ZObject3dScan &obj)
{
if (obj.isEmpty()) {
return NULL;
}
ZSwcTree *tree = new ZSwcTree();
tree->forceVirtualRoot();
Swc_Tree_Node *root = tree->root();
size_t stripeNumber = obj.getStripeNumber();
for (size_t i = 0; i < stripeNumber; ++i) {
const ZObject3dStripe &stripe = obj.getStripe(i);
int segNumber = stripe.getSegmentNumber();
int y = stripe.getY();
int z = stripe.getZ();
for (int j = 0; j < segNumber; ++j) {
Swc_Tree_Node *tn =
SwcTreeNode::makePointer(stripe.getSegmentStart(j), y, z, 2.0);
SwcTreeNode::setFirstChild(root, tn);
Swc_Tree_Node *tn2 =
SwcTreeNode::makePointer(stripe.getSegmentEnd(j), y, z, 2.0);
SwcTreeNode::setFirstChild(tn, tn2);
}
}
tree->resortId();
return tree;
}
示例2: createVirtualRootSwc
ZSwcTree* ZSwcGenerator::createVirtualRootSwc()
{
ZSwcTree *tree = new ZSwcTree;
tree->forceVirtualRoot();
return tree;
}
示例3: extractSeedSkel
Geo3d_Scalar_Field* ZNeuronTracer::extractSeedSkel(const Stack *mask)
{
Stack *skel = Stack_Bwthin(mask, NULL);
/* alloc <dist> */
Stack *dist = Stack_Bwdist_L_U16(mask, NULL, 0);
ZStackProcessor::RemoveBranchPoint(skel, 26);
Stack *skel_proc = C_Stack::clone(skel);
Geo3d_Scalar_Field *field1 = extractLineSeed(skel_proc, dist);
C_Stack::kill(skel_proc);
for (int i = 0; i <field1->size; ++i) {
int x = field1->points[i][0];
int y = field1->points[i][1];
int z = field1->points[i][2];
Set_Stack_Pixel(skel, x, y, z, 0, 0);
}
#ifdef _DEBUG_2
C_Stack::write(GET_TEST_DATA_DIR + "/test.tif", skel);
#endif
Geo3d_Scalar_Field *field2 = extractLineSeed(skel, dist, 0);
Geo3d_Scalar_Field *field = Geo3d_Scalar_Field_Merge(field1, field2, NULL);
Kill_Geo3d_Scalar_Field(field1);
Kill_Geo3d_Scalar_Field(field2);
#ifdef _DEBUG_2
ZSwcTree tree;
tree.forceVirtualRoot();
for (int i = 0; i <field->size; ++i) {
int x = field->points[i][0];
int y = field->points[i][1];
int z = field->points[i][2];
double radius = field->values[i];
SwcTreeNode::setFirstChild(
tree.root(), SwcTreeNode::makePointer(x, y, z, radius));
}
tree.save(GET_TEST_DATA_DIR + "/test.swc");
#endif
/* free <dist> */
C_Stack::kill(dist);
C_Stack::kill(skel);
return field;
}
示例4: getCompleteData
ZSwcTree* ZStroke2dPlayer::getSwcDecoration() const
{
ZSwcTree *tree = NULL;
ZStroke2d *stroke = getCompleteData();
if (stroke != NULL) {
if (!stroke->isEmpty()) {
tree->forceVirtualRoot();
Swc_Tree_Node *parent = tree->root();
double z = stroke->getZ();
double radius = stroke->getWidth() / 2.0;
for (size_t i = 0; i < stroke->getPointNumber(); ++i) {
double x = 0;
double y = 0;
stroke->getPoint(&x, &y, i);
Swc_Tree_Node *tn = SwcTreeNode::makePointer(x, y, z, radius, parent);
parent = tn;
}
}
}
return tree;
}
示例5: createSurfaceSwc
ZSwcTree* ZSwcGenerator::createSurfaceSwc(const ZStack &stack, int sparseLevel)
{
if (stack.kind() != GREY) {
return NULL;
}
ZSwcTree *tree = NULL;
if (stack.hasData()) {
int width = stack.width();
int height = stack.height();
int depth = stack.depth();
int cwidth = width - 1;
int cheight = height - 1;
int cdepth = depth - 1;
const uint8_t* in_array = stack.array8();
int conn = 6;
size_t offset = 0;
int neighbor[26];
int is_in_bound[26];
int n_in_bound;
int count = 0;
tree = new ZSwcTree();
tree->forceVirtualRoot();
Swc_Tree_Node *root = tree->root();
Stack_Neighbor_Offset(conn, width, height, neighbor);
for (int k = 0; k <= cdepth; k++) {
for (int j = 0; j <= cheight; j++) {
for (int i = 0; i <= cwidth; i++) {
// out_array[offset] = 0;
if (in_array[offset] > 0) {
n_in_bound = Stack_Neighbor_Bound_Test_S(
conn, cwidth, cheight, cdepth, i, j, k, is_in_bound);
bool isSurface = false;
if (n_in_bound == conn) {
for (int n = 0; n < n_in_bound; n++) {
if (in_array[offset + neighbor[n]] != in_array[offset]) {
isSurface = true;
break;
}
}
} else {
isSurface = true;
}
if (isSurface) {
if (count++ % sparseLevel == 0) {
SwcTreeNode::makePointer(i + stack.getOffset().getX(),
j + stack.getOffset().getY(),
k + stack.getOffset().getZ(),
sparseLevel * 0.7, root);
}
}
}
offset++;
}
}
}
}
#if 0
Stack *surface = Stack_Perimeter(stack.c_stack(), NULL, 6);
#ifdef _DEBUG_2
C_Stack::write(GET_DATA_DIR + "/test.tif", surface);
#endif
if (surface != NULL) {
tree = new ZSwcTree();
tree->forceVirtualRoot();
Swc_Tree_Node *root = tree->root();
int width = C_Stack::width(surface);
int height = C_Stack::height(surface);
int depth = C_Stack::depth(surface);
size_t offset = 0;
int count = 0;
for (int z = 0; z < depth; ++z) {
for (int y = 0; y < height; ++y) {
for (int x = 0; x < width; ++x) {
if ((surface->array[offset++]) > 0) {
if (count++ % sparseLevel == 0) {
SwcTreeNode::makePointer(x + stack.getOffset().getX(),
y + stack.getOffset().getY(),
z + stack.getOffset().getZ(),
sparseLevel * 0.7, root);
}
}
}
}
}
//.........这里部分代码省略.........