I don&#39;t know of anything that does this type of traversal and tracking of branches out of the box, at least in VTK. It sounds like you want vtkGraph (which you create with vtkMutableUndirectedGraph/vtkMutableDirectedGraph) instead of vtkTree since you may have back edges. You can give the vertices positions with graph-&gt;SetPoint(i, x, y, z), and add other properties by calling graph-&gt;Get[Vertex|Edge]Data()-&gt;AddArray(arr). As for traversal, the most flexible way would be to use boost&#39;s dfs/bfs traversal algorithms, which is possible if you build VTK with vtkInfovisBoost and vtkInfovisBoostGraphAlgorithms modules enabled. A vtkGraph instance can be used directly with boost&#39;s algorithms if you include vtkBoostGraphAdapter.h. See Infovis/BoostGraphAlgorithms/vtkBoostBreadthFirstSearch.cxx for an example of how to implement a bfs_visitor.<div>
<br></div><div>BTW, you can view the graph with vtkGraphLayoutView. Make sure to set the layout strategy to PassThrough and turn on 3D interaction if you set your own 3D coordinates.<br><div><br></div><div>Jeff<br><br><div class="gmail_quote">
On Thu, Jul 26, 2012 at 9:56 AM, Roman Grothausmann <span dir="ltr">&lt;<a href="mailto:roman.grothausmann@helmholtz-berlin.de" target="_blank">roman.grothausmann@helmholtz-berlin.de</a>&gt;</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>
My aim is to store the result of AnalyzeSkeleton imagej plug-in (<a href="http://fiji.sc/wiki/index.php/AnalyzeSkeleton#Loop_detection_and_pruning" target="_blank">http://fiji.sc/wiki/index.<u></u>php/AnalyzeSkeleton#Loop_<u></u>detection_and_pruning</a>) as an itk or vtk tree. Or if easier, the result of Skeletonize3D, i.e. a not analysed skeleton, into a vtkGraph (there seems to be no itkGraph strucutre).<br>


Each tree or graph node should also store its voxel position it originated from. Therefore, the vtk structures might be better, since they already offer to store extra data, which itkTree does not (if I&#39;m not mistaken).<br>


<br>
What would be the best way to do this?<br>
<br>
At the moment my plan is to use a ConstNeighborhoodIterator starting at the root of the tree, which is supplied by the user. I&#39;d add each CenterPixel as a node to the tree and check its 26 neighbors for other foreground pixels. If there is at least one, take that as the next center pixel and so iterate on. However, I&#39;d need to keep track of branching points (i.e. nodes with more than one child). Therefore, it might be best to recursively traverse through the tree up to its leafs, adding branches from the leafs. This would need, I think, separate ConstNeighborhoodIterators for each branch.<br>


<br>
Before I start implementing this, I wonder, is there perhaps already a filter/tree-generator that does this? Can the KdTreeGenerator be used for my purpose some how?<br>
<br>
Any help or hints are very much appreciated<br>
Roman<br>
<br>
<br>
<br>
-- <br>
Roman Grothausmann<br>
<br>
Helmholtz-Zentrum Berlin für Materialien und Energie GmbH<br>
Bereich Funktionale Materialien<br>
Institut für angewandte Materialforschung<br>
Hahn-Meitner-Platz 1<br>
D-14109 Berlin  <br>
<br>
(früher Hahn-Meitner-Institut und BESSY)<br>
<br>
<br>
Tel.: <a href="tel:%2B49-%280%2930-8062-42816" value="+4930806242816" target="_blank">+49-(0)30-8062-42816</a><br>
Fax.: <a href="tel:%2B49-%280%2930-8062-43059" value="+4930806243059" target="_blank">+49-(0)30-8062-43059</a><br>
<br>
Vorsitzender des Aufsichtsrats: Prof. Dr. Dr. h.c. mult. Joachim Treusch<br>
Stellvertretende Vorsitzende: Dr. Beatrix Vierkorn-Rudolph<br>
Geschäftsführer: Prof. Dr. Anke Rita Kaysser-Pyzalla, Dr. Ulrich Breuer<br>
Sitz der Gesellschaft: Berlin<br>
Handelsregister: AG Charlottenburg, 89 HRB 5583<br>
<br>
<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>
</div>