[vtkusers] Reverse color in vtkScalarsToColors?

Bill Lorensen bill.lorensen at gmail.com
Sun Dec 4 21:56:02 EST 2016


Set the hue range of the lookup table to
.667,0

On Dec 4, 2016 7:33 PM, "BBerco" <bebe0705 at colorado.edu> wrote:

> Hi all,
>
> I am using a vtkColorBarActor provided with an instance of
> vtkScalarsToColors obtained from a vtkPolyDataMapper to display a range of
> scalar values shown on the vtkPolyData connected to the mapper.
>
> My problem is that the maximum scalar value (i.e the max in "surface_data"
> below) corresponds to the blue end of the colorbar, while the minimum
> scalar
> value is associated with its red end.
>
> I have been looking for a way to reverse this behavior (so as to have the
> maximum value matched with the red and the minimum with the blue), to no
> avail. I thought I had found what I was looking for  there
> <http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/
> ElevationBandsWithGlyphs>
> , but this was unsuccessful as the GetLookupTable method returns an
> instance
> of vtkScalarsToColors and not vtkLookUpTable...
>
> Any suggestions?
>
> Thanks!
>
> ps: below is how I construct the colorbar from the input data mapper
> associated with the polydata
> the data corresponds to
>
>
>         vtkSmartPointer<vtkActor> shape_actor = this -> parent ->
> get_actor_vector()[0];
>
>         shape_actor -> GetMapper() -> SetScalarRange(min_magnitude,
> max_magnitude);
>
>         shape_actor -> GetMapper() -> GetInput() -> GetCellData() ->
> SetScalars(surface_data);
>         shape_actor -> GetMapper() -> ScalarVisibilityOn();
>         shape_actor -> GetMapper() -> SetScalarModeToUseCellData();
>
>         vtkSmartPointer<vtkScalarBarActor> scalarBar =
>             vtkSmartPointer<vtkScalarBarActor>::New();
>
>         scalarBar -> SetLookupTable(shape_actor -> GetMapper() ->
> GetLookupTable());
>         scalarBar -> SetTitle("Orthonormal acceleration magnitude
> (m/s^2)");
>         scalarBar -> SetUnconstrainedFontSize (true);
>         scalarBar -> GetTitleTextProperty() -> SetFontSize(10);
>         scalarBar -> GetLabelTextProperty() -> SetFontSize(10);
>         scalarBar -> SetNumberOfLabels(4);
>
>         this -> parent -> get_renderer() -> AddActor2D(scalarBar);
>         this -> parent -> qvtkWidget -> GetRenderWindow() -> Render();
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.
> com/Reverse-color-in-vtkScalarsToColors-tp5741412.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> 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
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161204/b1c2a079/attachment.html>


More information about the vtkusers mailing list