Skip to content
  • Cory Quammen's avatar
    6657: Add out-of-range colors to color maps · 238163f9
    Cory Quammen authored
    This change adds special colors to color maps that can optionally be
    used for scalar values outside the range of the color map. It touches
    a number of classes in VTK.
    
    vtkLookupTable
    
    - Added AboveRangeColor for values above the lookup table range.
    
    - Added UseAboveRangeColor option to control whether the
      AboveRangeColor or the color that maps to the highest value is used
      for values above the range.
    
    - Added BelowRangeColor for values below the lookup table range.
    
    - Added UseBelowRangeColor option to control whether the
      BelowRangeColor or the color that maps to the lowest value is used
      for values below the range.
    
    - Made GetColorAsUnsignedChars() a static member so that other classes
      can use it.
    
    TestLookupTable
    
    - Modified test to include testing of {Above|Below}RangeColors
      functionality.
    
    TestOutOfRangeColorTransferFunction.py
    
    - Test of out-of-range color functionality in
      vtkColorTransferFunction.
    
    TestOutOfRangeDiscretizableColorTransferFunction.py
    
    - Test of out-of-range color functionality in
      vtkDiscretizableColorTransferFunction.
    
    vtkScalarsToColors
    
    - Made RGBABytes member protected so subclasses can use it.
    
    vtkColorTransferFunction
    
    - Added {Above|Below}RangeColor and Use{Above|Below}RangeColor member
      variables that function the same as the members with the same name
      in vtkLookupTable. These colors are specified as RGB colors instead
      of RGBA colors, as they are in vtkLookupTable. For better or worse,
      this is for consistency with how NanColor is specified in each of
      these classes.
    
    - Above and BelowRangeColor are used only if the Clamping option is
      enabled.
    
    vtkDiscretizableColorTransferFunction
    
    - Forwards {Above|Below}RangeColor and Use{Above|Below}RangeColor to
      the internal vtkLookupTable in the Build() method.
    
    - Fixed a bug that caused the internal vtkLookupTable to allocate
      3 times the amount of colors needed to hold the table.
    
    vtkScalarsToColorsPainter
    
    - Added two colors for {Above|Below}RangeColors in the lookup table
      texture map. The color map class fills in these colors appropriately
      based on the {Above|Below}RangeColors settings.
    
    - Fixed the texture coordinate calculation to accommodate out-of-range
      colors.
    
    Performance-wise, this change increases the time to map an array with
    10 million scalars to colors by 5.5% using
    vtkLookupTable::MapScalarsThroughTable2().
    
    Change-Id: Ia3535fae175e991c0d1a4cf70752845193b4166d
    238163f9