54 #ifndef vtkLookupTable_h
55 #define vtkLookupTable_h
57 #include "vtkCommonCoreModule.h"
58 #include "vtkScalarsToColors.h"
60 #include "vtkUnsignedCharArray.h"
62 #define VTK_RAMP_LINEAR 0
63 #define VTK_RAMP_SCURVE 1
64 #define VTK_RAMP_SQRT 2
65 #define VTK_SCALE_LINEAR 0
66 #define VTK_SCALE_LOG10 1
77 const static vtkIdType ABOVE_RANGE_COLOR_INDEX;
78 const static vtkIdType NAN_COLOR_INDEX;
79 const static vtkIdType NUMBER_OF_SPECIAL_COLORS;
89 void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
100 int Allocate(
int sz=256,
int ext=256);
106 void Build() VTK_OVERRIDE;
115 virtual
void ForceBuild();
120 void BuildSpecialColors();
132 vtkSetMacro(Ramp,
int);
133 void SetRampToLinear() { this->SetRamp(VTK_RAMP_LINEAR); };
134 void SetRampToSCurve() { this->SetRamp(VTK_RAMP_SCURVE); };
135 void SetRampToSQRT() { this->SetRamp(VTK_RAMP_SQRT); };
136 vtkGetMacro(Ramp,
int);
146 void SetScaleToLinear() { this->SetScale(VTK_SCALE_LINEAR); };
147 void SetScaleToLog10() { this->SetScale(VTK_SCALE_LOG10); };
148 vtkGetMacro(Scale,
int);
161 virtual void SetTableRange(
double min,
double max);
162 vtkGetVectorMacro(TableRange,
double,2);
170 vtkSetVector2Macro(HueRange,
double);
171 vtkGetVector2Macro(HueRange,
double);
179 vtkSetVector2Macro(SaturationRange,
double);
180 vtkGetVector2Macro(SaturationRange,
double);
188 vtkSetVector2Macro(ValueRange,
double);
189 vtkGetVector2Macro(ValueRange,
double);
197 vtkSetVector2Macro(AlphaRange,
double);
198 vtkGetVector2Macro(AlphaRange,
double);
206 vtkSetVector4Macro(NanColor,
double);
207 vtkGetVector4Macro(NanColor,
double);
221 unsigned char colorOut[4]);
228 vtkSetVector4Macro(BelowRangeColor,
double);
229 vtkGetVector4Macro(BelowRangeColor,
double);
236 vtkSetMacro(UseBelowRangeColor,
int);
237 vtkGetMacro(UseBelowRangeColor,
int);
238 vtkBooleanMacro(UseBelowRangeColor,
int);
246 vtkSetVector4Macro(AboveRangeColor,
double);
247 vtkGetVector4Macro(AboveRangeColor,
double);
254 vtkSetMacro(UseAboveRangeColor,
int);
255 vtkGetMacro(UseAboveRangeColor,
int);
256 vtkBooleanMacro(UseAboveRangeColor,
int);
268 void GetColor(
double x,
double rgb[3]) VTK_OVERRIDE;
292 vtkIdType GetNumberOfTableValues() {
return this->NumberOfColors; };
308 double r,
double g,
double b,
double a=1.0);
327 return this->Table->GetPointer(4*
id); };
339 unsigned char *WritePointer(
const vtkIdType
id,
const int number);
347 {
return this->GetTableRange(); };
348 void SetRange(
double min,
double max) VTK_OVERRIDE
349 { this->SetTableRange(min, max); };
350 void SetRange(
double rng[2]) { this->SetRange(rng[0], rng[1]); };
359 static void GetLogRange(
const double range[2],
double log_range[2]);
365 const double log_range[2]);
374 vtkSetClampMacro(NumberOfColors,vtkIdType,2,VTK_ID_MAX);
375 vtkGetMacro(NumberOfColors,vtkIdType);
385 vtkGetObjectMacro(Table,vtkUnsignedCharArray);
394 unsigned char *output,
398 int outputIncrement) VTK_OVERRIDE;
403 void DeepCopy(vtkScalarsToColors *lut) VTK_OVERRIDE;
411 return (this->GetScale() == VTK_SCALE_LOG10)? 1 : 0;
426 void GetIndexedColor(vtkIdType idx,
double rgba[4]) VTK_OVERRIDE;
432 vtkIdType NumberOfColors;
433 vtkUnsignedCharArray *Table;
434 double TableRange[2];
436 double SaturationRange[2];
437 double ValueRange[2];
438 double AlphaRange[2];
440 double BelowRangeColor[4];
441 int UseBelowRangeColor;
442 double AboveRangeColor[4];
443 int UseAboveRangeColor;
447 vtkTimeStamp InsertTime;
448 vtkTimeStamp BuildTime;
450 unsigned char NanColorChar[4];
453 vtkTimeStamp OpaqueFlagBuildTime;
458 void ResizeTableForSpecialColors();
469 this->InsertTime.Modified();
map scalar values into colors via a lookup table
Definition: vtkLookupTable.h:69
static vtkLookupTable * New()
int UsingLogScale() VTK_OVERRIDE
Definition: vtkLookupTable.h:409
static void GetColorAsUnsignedChars(const double colorIn[4], unsigned char colorOut[4])
static const vtkIdType BELOW_RANGE_COLOR_INDEX
Definition: vtkLookupTable.h:76
void SetNumberOfTableValues(vtkIdType number)
unsigned char * GetPointer(const vtkIdType id)
Definition: vtkLookupTable.h:326
unsigned char * WritePointer(const vtkIdType id, const int number)
Definition: vtkLookupTable.h:466
unsigned char * GetNanColorAsUnsignedChars()
void MapScalarsThroughTable2(void *input, unsigned char *output, int inputDataType, int numberOfValues, int inputIncrement, int outputIncrement) VTK_OVERRIDE
double GetOpacity(double v) VTK_OVERRIDE
virtual void SetTableValue(vtkIdType indx, double r, double g, double b, double a=1.0)
void GetTableValue(vtkIdType id, double rgba[4])
void DeepCopy(vtkScalarsToColors *lut) VTK_OVERRIDE
virtual vtkIdType GetIndex(double v)
void SetTableRange(double r[2])
double * GetRange() VTK_OVERRIDE
Definition: vtkLookupTable.h:346
static void GetLogRange(const double range[2], double log_range[2])
void SetTable(vtkUnsignedCharArray *)
void GetColor(double x, double rgb[3]) VTK_OVERRIDE
virtual void SetTableValue(vtkIdType indx, double rgba[4])
static double ApplyLogScale(double v, const double range[2], const double log_range[2])
double * GetTableValue(vtkIdType id)
vtkIdType GetNumberOfAvailableColors() VTK_OVERRIDE
unsigned char * MapValue(double v) VTK_OVERRIDE
int IsOpaque() VTK_OVERRIDE