Map Scalars Into Jet Colormap

Synopsis

Map scalars into a jet colormap.

Results

Output:

0: 0  0  142
0.5: 134  255  119
1: 126  0  0

Code

C++

#include "itkJetColormapFunction.h"
#include "itkRGBPixel.h"

int
main(int, char *[])
{
  using PixelType = itk::RGBPixel<unsigned char>;
  using ColormapType = itk::Function::JetColormapFunction<float, PixelType>;
  ColormapType::Pointer colormap = ColormapType::New();

  colormap->SetMinimumInputValue(0.0);
  colormap->SetMaximumInputValue(1.0);
  std::cout << "0: " << colormap->  operator()(0.0f) << std::endl;
  std::cout << "0.5: " << colormap->operator()(0.5f) << std::endl;
  std::cout << "1: " << colormap->  operator()(1.0f) << std::endl;
  return EXIT_SUCCESS;
}

Classes demonstrated