[vtkusers] GetColor from vtkLookupTable problem

Jothy jothybasu at gmail.com
Fri Jul 9 07:57:20 EDT 2010


Hi all,

I am trying to get the color of cntours using
Mapper->GetLookupTable()->GetColor(0,color)

But the color doesn't exactly matches with the actual one!

What the problem in this code?


*import vtk

quadric =vtk.vtkQuadric()
quadric.SetCoefficients(1,2,3,0,1,0,0,0,0,0);

sample = vtk.vtkSampleFunction();
sample.SetSampleDimensions(40,40,40);
sample.SetImplicitFunction(quadric);

#Generate implicit surface
contour = vtk.vtkContourFilter();
contour.SetInput(sample.GetOutput());
range1=[1.0,6.0]
contour.GenerateValues(3,range1);



# The contour lines are mapped to the graphics library.
contMapper = vtk.vtkPolyDataMapper()
contMapper.SetInputConnection(contour.GetOutputPort())
contMapper.SetScalarRange(0,7)

contActor = vtk.vtkActor()
contActor.SetMapper(contMapper)

mapr=contMapper.GetLookupTable()
cc=[0,0,0]
mapr.GetColor(2,cc)
print cc,'color'


# Create the renderer, render window, and interactor.
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)

# Set the background color to white. Associate the actors with the
# renderer.
ren.SetBackground(0,0,0)
ren.AddActor(contActor)


# Zoom in a little bit.
ren.ResetCamera()
ren.GetActiveCamera().Zoom(1)

# Initialize and start the event loop.
iren.Initialize()
renWin.Render()
iren.Start()*

Thanks,
Jothy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100709/93aa9a29/attachment.htm>


More information about the vtkusers mailing list