[vtkusers] Out of range colors in LookupTable in VTK 5.10

Cory Quammen cory.quammen at kitware.com
Thu Mar 30 08:10:57 EDT 2017


Fernando,

It should be possible with a little work. You will need to set the
color table values yourself. For illustration, let's say you have 4
colors in your color table with data range [0, 8]. You'll need to add
one color at the bottom of the table for the below range color and one
at the top for the above range color for a total of 6 table colors.
You'll need to adjust your range so that 0 still gets mapped to the
previously lowest color and 8 to the previously highest color. In this
example, your new range should be [-2, 10]. Now, anything below 0
should map to your below range color in the table and anything about 7
should map to your above range color.

To set table values explicitly, you can use
vtkLookupTable::SetTableValue (vtkIdType indx, double rgba[4]). The
trick will be to maintain the lookup table generation of the colors
via HSV range while setting table values explicitly - you can't do
both in the same vtkLookupTable instance. You might want to use two
vtkLookupTables in this case, one that generates the colors via the
HSV range, and then use that to build a second vtkLookupTable in which
you modify the range and add the above/below range colors.

HTH,
Cory

On Thu, Mar 30, 2017 at 7:56 AM, Fernando Nellmeldin
<f.nellmeldin at open-engineering.com> wrote:
> Hello.
> I have an unstructuredgrid with point data which I display as a color map in
> the model.
> Let's say the range of the values is [100, 500] and I map blue to 100 and
> red to 500. I create a lookuptable with the range of HSV values for the
> colors I want, and everything works as expected.
> Problem is, I would like to have a special color for values below 100 and
> values over 500 (gray, for example).
>
> I do know that this feature exist from VTK 6 as
> vtkLookupTable::setBelowRangeColor and vtkLookupTable::setAboveRangeColor.
> But, for compatibility reasons, we are stuck -for the moment- with VTK 5.10.
>
> Is there an easy way to accomplish this with VTK 5.10? I've seen the code
> inside vtkLookupTable but there were a lot of changes and I can't find the
> way to do it by myself without modifying my own version of VTK (by editing
> vtkLookupTable in VTK 5.10 with the code added in VTK 6).
>
> Thank you.
>
> --
> Fernando NELLMELDIN
> Software Engineer
> _______________________________________________________________
>
> Open Engineering s.a.
>
> Rue Bois Saint-Jean 15/1
> B-4102 Seraing (Belgium)
> Tel: +32.4.353.30.34
>
> http://www.open-engineering.com
> https://www.linkedin.com/company/open-engineering?trk=biz-companies-cym
> _________________________________________________________________________
>
> _______________________________________________
> 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
>



-- 
Cory Quammen
Staff R&D Engineer
Kitware, Inc.


More information about the vtkusers mailing list