[vtkusers] Reordering/renumbering node-IDs of a tree to maximize the branch length

Dr. Roman Grothausmann grothausmann.roman at mh-hannover.de
Mon Jan 28 08:17:21 EST 2013


Dear mailing list members,


Is it possible to renumber node-IDs of a tree to maximize the branch length? 
Suppose I have a tree with one long branch (i.e. trunk) and a few small side 
branches.

0-1-5-6-7-8-9
   \2-3-4

Now I'd like the node-IDs numbering to indicate the branch length. E.g. if the 
trunk has 7 nodes the IDs should go from 0 to 6 and the next longest branch 
(e.g. 3 nodes, branching at node-ID 1) should be numbered from 7 to 9.

0-1-2-3-4-5-6
   \7-8-9

Could this perhaps be achieved with the vtkTreeDFSIterator? Using that together 
with AddChild, how could I keep track of what the parent should be when the 
iterator jumps to the next node after a branching node (e.g. from 6 to 7, that 7 
is a child of 1)?

Any help or hints are 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