[vtkusers] How to apply different colours to the extracted mean curvature in vtkcurvature

Andrew Maclean andrew.amaclean at gmail.com
Thu Feb 1 15:49:40 EST 2018


These examples will help you.

https://lorensen.github.io/VTKExamples/site/Cxx/Visualization/CurvatureBandsWithGlyphs/

https://lorensen.github.io/VTKExamples/site/Cxx/Visualization/ElevationBandsWithGlyphs/

The idea is to use a banded contour filter along with an indexed lookup
table.

Regards
   Andrew


> ---------- Forwarded message ----------
> From: Polly Lina <polly_sukting at hotmail.com>
> To: vtkusers at vtk.org
> Cc:
> Bcc:
> Date: Wed, 31 Jan 2018 10:29:13 -0700 (MST)
> Subject: [vtkusers] How to apply different colours to the extracted mean
> curvature in vtkcurvature
> I am applying vtkCurvature "SetCurvatureToMean" to extract the 3D face
> polydata.
> My question is:
> Can anyone please help me on how can I apply different colours to the
> extracted dataset by giving a mean curvature threshold.  Eg: The values >
> 0.05 label the surface to black, the values <=0.05 label the surface to
> red..etc
>
> This is my code:
> vtkCurvatures> meanCurve = vtkCurvatures::New();
>         meanCurve->SetInputConnection(reader->GetOutputPort());
>         meanCurve->SetCurvatureTypeToMean();
>         meanCurve->Update();
>
> vtkLookupTable* lut = vtkLookupTable::New();
>         lut->SetNumberOfColors(2);
>
> double H;
>         for (int i = 0; i < nOfPnts; i++)
>         {
>                 H =
> (double)meanCurve->GetOutput()->GetPointData()->GetScalars()
> ->GetTuple1(i);
>                 if (H >= 0.05)
>                 {
>                         lut->SetTableValue(0.0, 0.0, 0.0, 1);
>                 }
>                 else
>                 {
>                         lut->SetTableValue(1.0, 1.0, 1.0, 1);
>                 }
>         }
> lut->Build();
>
> I could only get partially coloured and it is not what i expected.
> Thanks and helps are so much appreciated!
>
>
>
> --
> Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
>
>
>
> --
___________________________________________
Andrew J. P. Maclean

___________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180202/b2baad42/attachment.html>


More information about the vtkusers mailing list