Make LAB the default color space

Interpolations in LAB are perceptually uniform, which generally makes it
a better choice as the color space.
This commit is contained in:
Kenneth Moreland 2018-04-02 10:46:43 -06:00
parent 22f38ecc43
commit 97a245597f
4 changed files with 15 additions and 8 deletions

@ -45,7 +45,7 @@ ColorTable::ColorTable(const std::string& name)
//so that the internal host side cache is constructed and we leave
//the constructor in a valid state. We use RGB as it is the default
//when the no parameter constructor is called
this->SetColorSpace(ColorSpace::RGB);
this->SetColorSpace(ColorSpace::LAB);
}
this->AddSegmentAlpha(this->Impl->TableRange.Min, 1.0f, this->Impl->TableRange.Max, 1.0f);
}

@ -108,7 +108,7 @@ class VTKM_CONT_EXPORT ColorTable
std::shared_ptr<detail::ColorTableInternals> Impl;
public:
/// Construct a color table from a preset color table
/// \brief Construct a color table from a preset color table
///
/// Constructs a color table from a given preset, which might include a NaN color.
/// The alpha table will have 2 entries of alpha = 1.0 with linear interpolation
@ -131,20 +131,20 @@ public:
/// "Jet"
/// "Rainbow"
///
ColorTable(const std::string& name);
explicit ColorTable(const std::string& name);
/// Construct a color table with a zero positions, and an invalid range
///
/// Note: The color table will have 0 entries
/// Note: The alpha table will have 0 entries
ColorTable(ColorSpace space = ColorSpace::RGB);
ColorTable(ColorSpace space = ColorSpace::LAB);
/// Construct a color table with a 2 positions
///
/// Note: The color table will have 2 entries of rgb = {1.0,1.0,1.0}
/// Note: The alpha table will have 2 entries of alpha = 1.0 with linear
/// interpolation
ColorTable(const vtkm::Range& range, ColorSpace space = ColorSpace::RGB);
ColorTable(const vtkm::Range& range, ColorSpace space = ColorSpace::LAB);
/// Construct a color table with 2 positions
//
@ -153,7 +153,7 @@ public:
ColorTable(const vtkm::Range& range,
const vtkm::Vec<float, 3>& rgb1,
const vtkm::Vec<float, 3>& rgb2,
ColorSpace space = ColorSpace::RGB);
ColorSpace space = ColorSpace::LAB);
/// Construct color and alpha and table with 2 positions
///
@ -161,7 +161,7 @@ public:
ColorTable(const vtkm::Range& range,
const vtkm::Vec<float, 4>& rgba1,
const vtkm::Vec<float, 4>& rgba2,
ColorSpace space = ColorSpace::RGB);
ColorSpace space = ColorSpace::LAB);
~ColorTable();

@ -36,7 +36,7 @@ namespace detail
struct ColorTableInternals
{
ColorSpace CSpace = ColorSpace::RGB;
ColorSpace CSpace = ColorSpace::LAB;
vtkm::Range TableRange = { 1.0, 0.0 };
//Host side version of the ColorTableBase. This holds data such as:

@ -18,6 +18,11 @@
// this software.
//============================================================================
#ifndef vtk_m_filter_Field_to_Colors_hxx
#define vtk_m_filter_Field_to_Colors_hxx
#include <vtkm/filter/FieldToColors.h>
#include <vtkm/VecTraits.h>
#include <vtkm/cont/ColorTable.hxx>
@ -268,3 +273,5 @@ inline VTKM_CONT vtkm::filter::Result FieldToColors::DoExecute(
}
}
} // namespace vtkm::filter
#endif //vtk_m_filter_Field_to_Colors_hxx