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

Dr. Roman Grothausmann grothausmann.roman at mh-hannover.de
Fri Jan 18 14:49:33 EST 2013


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)
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



More information about the vtkusers mailing list