[vtkusers] Interactively updating the edge colors of a graph
Steffen Oeltze
stoeltze at isg.cs.uni-magdeburg.de
Tue Feb 15 07:27:40 EST 2011
Thanks Jeff for the quick and helpful reply. I will update my VTK
installation as soon as possible.
Steffen
On 10.02.2011 20:53, Jeff Baumes wrote:
> Steffen,
>
> Thanks for your detailed report. The issue was that the filter that
> updated colors (vtkApplyColors) did not update when the underlying
> lookup table is modified. I just pushed a change to VTK master that
> fixes this. The following python script shows how to change the lookup
> table and re-render the view:
>
> from vtk import *
> import time
>
> s = vtkRandomGraphSource()
> view = vtkGraphLayoutView()
> rep = view.SetRepresentationFromInputConnection(s.GetOutputPort())
> rep.ColorVerticesByArrayOn()
> lut = vtkLookupTable()
> lut.Build()
> theme = vtkViewTheme()
> theme.SetPointLookupTable(lut)
> view.ApplyViewTheme(theme)
> view.ResetCamera()
> view.Render()
> time.sleep(2)
>
> # Modify the lookup table
> lut.SetHueRange(0.0, 0.0)
> lut.Build()
> view.Render()
> time.sleep(2)
>
> Jeff
>
> On Tue, Feb 8, 2011 at 11:18 AM, Steffen Oeltze
> <stoeltze at isg.cs.uni-magdeburg.de
> <mailto:stoeltze at isg.cs.uni-magdeburg.de>> wrote:
>
> Dear VTK-users
>
> I have written an application that displays a graph with colored
> edges. The application is interactive and I would like to change
> the edge coloring depending on some user interaction. The coloring
> is accomplished via a vtkLookupTable and a vtkViewTheme. I tried
> two different strategies so far. Unfortunately, only the second
> one works which I guess is slower and less effective than the
> first one. The first one only works if I manually enforce a new
> rendering of the graph by selecting, e.g., an edge. In my source
> code, I tried several update mechanisms, e.g., calling Modified()
> on the vtkViewTheme after reassigning the modified vtkLookupTable,
> but none of them worked. Any help on how I can imitate the
> update-mechanism which is initiated after edge selection is deeply
> appreciated.
>
> 1.) (works only after manual update)
> - generate the vtkLookupTable, a vtkViewTheme, and a
> vtkGraphLayoutView
> - assign the vtkLookupTable to the vtkViewTheme
> - assign the vtkViewTheme to the vtkGraphLayoutView
> - render the graph
> ...user interaction...
> - update the vtkLookupTable
> - render the graph again
>
> 2.) (works)
> - generate the vtkLookupTable, a vtkViewTheme, and a
> vtkGraphLayoutView
> - assign the vtkLookupTable to the vtkViewTheme
> - assign the vtkViewTheme to the vtkGraphLayoutView
> - delete the vtkViewTheme
> - render the graph
> ...user interaction...
> update the vtkLookupTable
> - generate a new vtkViewTheme
> - assign the modified vtkLookupTable to the new vtkViewTheme
> - assign the new vtkViewTheme to the vtkGraphLayoutView
> - delete the new vtkViewTheme
> - render the graph again
>
> Steffen
>
> --
> Dr.-Ing. Steffen Oeltze
> Department of Simulation and Graphics, School of Computer Science
> Otto-von-Guericke-University Magdeburg
>
> Universitätsplatz 2, 39106 Magdeburg
> GERMANY
>
> Phone: (+49-391) 67-1 25 27
> Fax: (+49 391) 67-1 11 64
> Email: stoeltze at isg.cs.uni-magdeburg.de
> <mailto:stoeltze at isg.cs.uni-magdeburg.de>
> Web: http://www.vismd.de/
>
> _______________________________________________
> Powered by www.kitware.com <http://www.kitware.com>
>
> Visit other Kitware open-source projects at
> 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
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>
>
> --
> Jeff Baumes, Ph.D.
> Technical Lead, Kitware Inc.
> (518) 881-4932
--
Dr.-Ing. Steffen Oeltze
Department of Simulation and Graphics, School of Computer Science
Otto-von-Guericke-University Magdeburg
Universitätsplatz 2, 39106 Magdeburg
GERMANY
Phone: (+49-391) 67-1 25 27
Fax: (+49 391) 67-1 11 64
Email: stoeltze at isg.cs.uni-magdeburg.de
Web: http://www.vismd.de/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110215/f0b57bc0/attachment.htm>
More information about the vtkusers
mailing list