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¶
-
template<typename
TScalar
, typenameTRGBPixel
>
classJetColormapFunction
: public itk::Function::ColormapFunction<TScalar, TRGBPixel> Function object which maps a scalar value into an RGB colormap value.
This code was contributed in the Insight Journal paper:
- Author
Nicholas Tustison, Hui Zhang, Gaetan Lehmann, Paul Yushkevich and James C. Gee
“Meeting Andy Warhol Somewhere Over the Rainbow: RGB Colormapping and ITK” https://www.insight-journal.org/browse/publication/285
- ITK Sphinx Examples: