<meta charset="utf-8"><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">Steffen,</span><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br>
</span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">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:</span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><div>
from vtk import *</div><div>import time</div><div><br></div><div>s = vtkRandomGraphSource()</div><div>view = vtkGraphLayoutView()</div><div>rep = view.SetRepresentationFromInputConnection(s.GetOutputPort())</div><div>rep.ColorVerticesByArrayOn()</div>
<div>lut = vtkLookupTable()</div><div>lut.Build()</div><div>theme = vtkViewTheme()</div><div>theme.SetPointLookupTable(lut)</div><div>view.ApplyViewTheme(theme)</div><div>view.ResetCamera()</div><div>view.Render()</div><div>
time.sleep(2)</div><div><br></div><div># Modify the lookup table</div><div>lut.SetHueRange(0.0, 0.0)</div><div>lut.Build()</div><div>view.Render()</div><div>time.sleep(2)</div></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "><br>
</span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">Jeff</span></font></div><div><br><div class="gmail_quote">On Tue, Feb 8, 2011 at 11:18 AM, Steffen Oeltze <span dir="ltr">&lt;<a href="mailto:stoeltze@isg.cs.uni-magdeburg.de">stoeltze@isg.cs.uni-magdeburg.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 VTK-users<br>
<br>
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.<br>

<br>
1.) (works only after manual update)<br>
- generate the vtkLookupTable, a vtkViewTheme, and a vtkGraphLayoutView<br>
- assign the vtkLookupTable to the vtkViewTheme<br>
- assign the vtkViewTheme to the vtkGraphLayoutView<br>
- render the graph<br>
...user interaction...<br>
- update the vtkLookupTable<br>
- render the graph again<br>
<br>
2.) (works)<br>
- generate the vtkLookupTable, a vtkViewTheme, and a vtkGraphLayoutView<br>
- assign the vtkLookupTable to the vtkViewTheme<br>
- assign the vtkViewTheme to the vtkGraphLayoutView<br>
- delete the vtkViewTheme<br>
- render the graph<br>
...user interaction...<br>
update the vtkLookupTable<br>
- generate a new vtkViewTheme<br>
- assign the modified vtkLookupTable to the new vtkViewTheme<br>
- assign the new vtkViewTheme to the vtkGraphLayoutView<br>
- delete the new vtkViewTheme<br>
- render the graph again<br>
<br>
Steffen<br>
<br>
-- <br>
Dr.-Ing. Steffen Oeltze<br>
Department of Simulation and Graphics, School of Computer Science<br>
Otto-von-Guericke-University Magdeburg<br>
<br>
Universitätsplatz 2, 39106 Magdeburg<br>
GERMANY<br>
<br>
Phone:  (+49-391) 67-1 25 27<br>
Fax:    (+49 391) 67-1 11 64<br>
Email:  <a href="mailto:stoeltze@isg.cs.uni-magdeburg.de" target="_blank">stoeltze@isg.cs.uni-magdeburg.de</a><br>
Web:    <a href="http://www.vismd.de/" target="_blank">http://www.vismd.de/</a><br>
<br>
_______________________________________________<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/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_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/listinfo/vtkusers</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Jeff Baumes, Ph.D.<br>Technical Lead, Kitware Inc.<br>(518) 881-4932<br>
</div>