[vtkusers] converting a tree stored in vtkGraph into vtkTree (or creating a loop walk through a tree)

Jeff Baumes jeff.baumes at kitware.com
Thu Jan 24 09:55:59 EST 2013


If you have a vtkGraph, you can convert it to a vtkTree with
vtkBoostBreadthFirstSearchTree. Then you can probably use the tree
iterators do make the path you desire.

Jeff


On Fri, Jan 18, 2013 at 2:49 PM, Dr. Roman Grothausmann <
grothausmann.roman at mh-hannover.de> wrote:

> Dear mailing list members,
>
>
> Now that I have managed to convert vtkPolyData (which represents a tree,
> the root node position is known) to a vtkGraph (thanks to David Doria's
> vtkPolyDataToGraph: https://github.com/daviddoria/**VTK-GraphConversions<https://github.com/daviddoria/VTK-GraphConversions>
> )
> I'm now facing the problem how to convert the tree that is contained in
> the vtkGraph into a vtkTree?
> In the docs it is said that a tree can only be created via
> vtkMutableDirectedGraph, so guess I need to traverse the vtkGraph in a way
> that the traversal yields a tree and during traversal a
> vtkMutableDirectedGraph needs to be created.
> But how to traverse the graph? In the docs it says that vtkTreeDFSIterator
> would iterate through a graph but it inherits vtkTreeIterator and only has
> a method setTree (no setGraph).
> Is there any other way to tell a PC that a graph is actually a tree if it
> is told where the root node is?
>
> My final goal is to create a vtkPolyData that represents the path walked
> by e.g. a person that starts walking along the tree from the root, visiting
> every node along a branch till it reaches its end, then goes back to the
> next branching node (i.e. parent node with more than one child) and then
> goes an like that until it comes back to the root. The person should then
> have visited each node at least twice except end-nodes. If the start and
> the end point of the path are connected the result would be a directed loop.
> The result could be created very easily by duplicating the initial
> vtkPolyData and joining the two at each end-node, only the joints needed at
> the branching-nodes give trouble.
>
> Any help or hints is very much appreciated
> Roman
>
>
> --
> Dr. Roman Grothausmann
>
> Tomographie und Digitale Bildverarbeitung
> Tomography and Digital Image Analysis
>
> Institut für Funktionelle und Angewandte Anatomie, OE 4120
> Medizinische Hochschule Hannover
> Carl-Neuberg-Str. 1
> D-30625 Hannover
>
> Tel. +49 511 532-9574
> ______________________________**_________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/**
> opensource/opensource.html<http://www.kitware.com/opensource/opensource.html>
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_**FAQ <http://www.vtk.org/Wiki/VTK_FAQ>
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/**listinfo/vtkusers<http://www.vtk.org/mailman/listinfo/vtkusers>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130124/3cf8d005/attachment.htm>


More information about the vtkusers mailing list