[vtkusers] ScalarRange of vtkContourFilter?
Marcus Stojek
stojek at part-gmbh.de
Mon May 12 10:12:12 EDT 2003
Hi,
I have an unstructured grid with scalar point data. I want to show the
geometry colorshaded (MapperSurf) PLUS colored contourlines (contourMapper).
My problem is that no matter what values minvalue and maxvalue have, the
contour lines are always colorcoded between 0 and 1. Because the printout
of vtkContourFilter shows that the values calculated by GenerateValues() are
correct, I guess there is something wrong with the Input for ContourFilter.
(vtk 4.0, Python 2.2, Windows NT)
Any hints?
self.grid=vtkUnstructuredGrid()
.....
self.lut = vtkLookupTable()
self.lut.SetHueRange(0.66667,0.0)
self.darray = Numeric.array(data,Numeric.Float32)
self.data = vtkFloatArray()
self.data.SetVoidArray(self.darray,len(data),1)
self.grid.GetPointData().SetScalars(self.data)
self.MapperSurf=vtkDataSetMapper()
self.MapperSurf.SetInput(self.grid)
self.MapperSurf.ScalarVisibilityOn()
self.MapperSurf.SetLookupTable(self.lut)
self.MapperSurf.SetScalarRange(minvalue,maxvalue)
self.ActorSurf=vtkActor()
self.ActorSurf.SetMapper(self.MapperSurf)
self.cf = vtkContourFilter()
self.cf.SetInput(self.grid)
self.cf.GenerateValues(15,minvalue,maxvalue)
self.contourMapper = vtkPolyDataMapper()
self.contourMapper.SetInput(self.cf.GetOutput())
self.contourMapper.ScalarVisibilityOn()
self.contourMapper.SetLookupTable(self.lut)
self.contours = vtkActor()
self.contours.SetMapper(self.contourMapper)
self.ren.AddActor(self.contours)
Thanks,
Marcus
More information about the vtkusers
mailing list