<div dir="ltr">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.<div><br></div><div>Jeff</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Fri, Jan 18, 2013 at 2:49 PM, Dr. Roman Grothausmann <span dir="ltr"><<a href="mailto:grothausmann.roman@mh-hannover.de" target="_blank">grothausmann.roman@mh-hannover.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear mailing list members,<br>
<br>
<br>
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: <a href="https://github.com/daviddoria/VTK-GraphConversions" target="_blank">https://github.com/daviddoria/<u></u>VTK-GraphConversions</a>)<br>
I'm now facing the problem how to convert the tree that is contained in the vtkGraph into a vtkTree?<br>
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.<br>
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).<br>
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?<br>
<br>
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.<br>
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.<br>
<br>
Any help or hints is very much appreciated<br>
Roman<br>
<br>
<br>
-- <br>
Dr. Roman Grothausmann<br>
<br>
Tomographie und Digitale Bildverarbeitung<br>
Tomography and Digital Image Analysis<br>
<br>
Institut für Funktionelle und Angewandte Anatomie, OE 4120<br>
Medizinische Hochschule Hannover<br>
Carl-Neuberg-Str. 1<br>
D-30625 Hannover<br>
<br>
Tel. <a href="tel:%2B49%20511%20532-9574" value="+495115329574" target="_blank">+49 511 532-9574</a><br>
______________________________<u></u>_________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<u></u>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_<u></u>FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/<u></u>listinfo/vtkusers</a><br>
</blockquote></div><br></div>