[vtkusers] Cannot make unstructured points isosurface

Chris Scharver scharver at evl.uic.edu
Thu Nov 7 10:04:30 EST 2002


At 5:33 AM -0600 on 11/06/2002, Randy Heiland wrote:

>On Nov 5, 10:36pm, Chris Scharver wrote:
> >
> > Now that I have the surface, I still have to determine why resulting contours
>are always red... I only have two contours, but their colors should be based on
>the scalar values used to make the surfaces. I tried setting a color lookup
>table, but I always end up with the same color for both surfaces.
> >
>>   vtkContourFilter* iso = vtkContourFilter::New();
>>   iso->SetInput(shepard->GetOutput());
>>   iso->SetValue(0, -0.006f);
>>   iso->SetValue(1, 0.002f);
>>   iso->ComputeScalarsOn();
>>   iso->UseScalarTree();
>>   vtkLookupTable* lut = vtkLookupTable::New();
>>   lut->SetNumberOfColors(256);
>>   lut->SetTableRange(shepard->GetOutput()->GetScalarRange());

Changed to:
  lut->SetTableRange(-0.006f, 0.002f);

> >   lut->Build();
>>   vtkPolyDataMapper* isoMapper = vtkPolyDataMapper::New();
>>   isoMapper->SetInput(iso->GetOutput());
>>   isoMapper->SetLookupTable(lut);
>>   isoMapper->SetColorModeToMapScalars();
>>   isoMapper->SetScalarRange(shepard->GetOutput()->GetScalarRange());
>>   isoMapper->ScalarVisibilityOn();
>>   vtkActor* isoActor = vtkActor::New();
>>   isoActor->SetMapper(isoMapper);
>>   isoActor->GetProperty()->SetOpacity(0.5f);
>
>Try doing a:
>
>isoMapper->SetTableRange(-.006,.002)
>
>--Randy

I'm assuming that you meant to make that change to the color table. I also tried using vtkPolyDataMapper::SetScalarRange() on the mapper object I tried setting the table range to use the values for the two scalars, but they still ended up the same red. If I change the hue range for the color table, then I can get a different color, but that color is the same for both surfaces. Strangely, running the resulting polydata through vtkIVWriter results in a geometry containing no colors. vtkIVWriter includes colors only if it reads the scalars properly.

The machine with the code is being worked on at the moment, so maybe I'll try explicitly settings the scalars again to see if that helps.

Chris
--
Chris Scharver
Electronic Visualization Laboratory
The University of Illinois at Chicago
Ph: 312-996-3002   FAX: 312-413-7585
<http://www.evl.uic.edu/scharver/>



More information about the vtkusers mailing list