[vtkusers] Coloring of Iso-Surfaces (vtkContourFilter)

David E DeMarle dave.demarle at kitware.com
Mon Mar 15 06:41:50 EDT 2010


scalarIsoSurface->ComputeScalarsOn();

On Mon, Mar 15, 2010 at 4:55 AM, Sebastian Gatzka
<sebastian.gatzka at stud.tu-darmstadt.de> wrote:
> Hello world.
>
> After I have finally found a way of making the vtkContourFilter work I'm now
> facing how to color them.
> I want to color them according to the value they are having.
> Example: The cutting plane displays the "right" color for the scalar data,
> but the iso-surfaces (contours) are colored identically.
> Have a look at the screenshot in the attachment.
>
> So, what do I have to do, to set up the right coloring?
>
> Here is the code I am using to create the contours:
>
> vtkContourFilter *scalarIsoSurface = vtkContourFilter::New();
> scalarIsoSurface->SetInput(sGridPointData->GetOutput());
> scalarIsoSurface->SetValue(0,3);
> scalarIsoSurface->SetValue(1,5);
> scalarIsoSurface->Update();
>
> vtkPolyDataNormals *sGridPolyDataNormal = vtkPolyDataNormals::New();
> sGridPolyDataNormal->SetInput(scalarIsoSurface->GetOutput());
> sGridPolyDataNormal->Update();
>
> vtkPolyDataMapper *scalarIsoSurfaceMapper = vtkPolyDataMapper::New();
> scalarIsoSurfaceMapper->SetInput(sGridPolyDataNormal->GetOutput());
> scalarIsoSurfaceMapper->Update();
>
> vtkActor *scalarIsoSurfaceActor = vtkActor::New();
> scalarIsoSurfaceActor->SetMapper(scalarIsoSurfaceMapper);
>
> Have a nice day.
> Sebastian
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>



More information about the vtkusers mailing list