Hey Peter,<br><br>Is it the creation of the lookuptable that&#39;s causing you problems or something else? I&#39;ve been experimenting a bit with lookuptables and can create a lookuptable as you described (see scrap of python-code below), does this help?
<br><br>Regards - Geofram<br><br><br><span style="color: rgb(0, 0, 153);">import vtk<br><br>#create the lookuptable for colors<br>lookupTable = vtk.vtkLookupTable()<br>lookupTable.SetNumberOfTableValues(100)<br>lookupTable.SetTableRange
(0, 100)<br>lookupTable.Build()<br><br>for i in range(100):<br>&nbsp;&nbsp;&nbsp; lookupTable.SetTableValue(i, 0.0, 0.0, 0.0, 1.0)<br>lookupTable.SetTableValue(5, 1.0, 0.0, 0.0, 1.0)<br>lookupTable.SetTableValue(10, 0.0, 1.0, 0.0, 1.0)<br>
lookupTable.SetTableValue(50, 0.0, 0.0, 1.0, 1.0)<br><br>#create a colorbar using the lookuptable to see if it&#39;s correct<br>colorbar = vtk.vtkScalarBarActor()<br>colorbar.SetMaximumNumberOfColors(400)<br>colorbar.SetLookupTable
(lookupTable)<br>colorbar.SetWidth(0.05)<br>colorbar.SetPosition(0.95, 0.1)<br>colorbar.SetLabelFormat(&quot;%.3g&quot;)<br>colorbar.VisibilityOn()<br><br>#create the stuff to visualise<br>ren = vtk.vtkRenderer()<br>renWin = 
vtk.vtkRenderWindow()<br>renWin.AddRenderer(ren)<br>renWin.SetSize(750,750)<br>interact = vtk.vtkRenderWindowInteractor()<br>interact.SetRenderWindow(renWin)<br>ren.AddActor(colorbar)<br>ren.SetBackground(0.5,0.6,0.7)<br>
renWin.GetInteractor().Initialize()<br>renWin.Render()<br>renWin.GetInteractor().Start()<br></span><br><br><br><div><span class="gmail_quote">On 5/21/07, <b class="gmail_sendername">Peter Kok</b> &lt;<a href="mailto:peter.kok@gmail.com">
peter.kok@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi there,<br><br>I am trying to map certain specific scalars to colors using a vtkLookupTable. Let&#39;s say I want to map the scalar 5 to red, 10 to green, 100 to blue and the rest to black. So what I need to do is similar to a vtkColorTransferFunction, which I cannot use, because I want to use it for a vtkImagePlaneWidget, which only accepts vtkLookupTables.
<br><br>One option seemed to be to extend vtkLookupTable and reimplement GetIndex(float) -&gt; int, which I expected to map the scalar to an index in the table values. This didn&#39;t work, but I am not sure if it is supposed to work.
<br><br>What are my options?<br><br>Regards,<br><span class="sg">Peter<br><br>
</span><br>_______________________________________________<br>This is the private VTK discussion list.<br>Please keep messages on-topic. Check the FAQ at: <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">
http://www.vtk.org/Wiki/VTK_FAQ</a><br>Follow this link to subscribe/unsubscribe:<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers
</a><br><br></blockquote></div><br>