Common/vtkLookupTable.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00034 #ifndef __vtkLookupTable_h
00035 #define __vtkLookupTable_h
00036
00037 #include "vtkScalarsToColors.h"
00038
00039 #include "vtkUnsignedCharArray.h"
00040
00041 #define VTK_RAMP_LINEAR 0
00042 #define VTK_RAMP_SCURVE 1
00043 #define VTK_RAMP_SQRT 2
00044 #define VTK_SCALE_LINEAR 0
00045 #define VTK_SCALE_LOG10 1
00046
00047 class VTK_COMMON_EXPORT vtkLookupTable : public vtkScalarsToColors
00048 {
00049 public:
00052 static vtkLookupTable *New();
00053
00054 vtkTypeRevisionMacro(vtkLookupTable,vtkScalarsToColors);
00055 void PrintSelf(ostream& os, vtkIndent indent);
00056
00058 int Allocate(int sz=256, int ext=256);
00059
00062 virtual void Build();
00063
00069 virtual void ForceBuild();
00070
00072
00079 vtkSetMacro(Ramp,int);
00080 void SetRampToLinear() { this->SetRamp(VTK_RAMP_LINEAR); };
00081 void SetRampToSCurve() { this->SetRamp(VTK_RAMP_SCURVE); };
00082 void SetRampToSQRT() { this->SetRamp(VTK_RAMP_SQRT); };
00083 vtkGetMacro(Ramp,int);
00085
00087
00090 void SetScale(int scale);
00091 void SetScaleToLinear() { this->SetScale(VTK_SCALE_LINEAR); };
00092 void SetScaleToLog10() { this->SetScale(VTK_SCALE_LOG10); };
00093 vtkGetMacro(Scale,int);
00095
00097
00101 void SetTableRange(double r[2]);
00102 virtual void SetTableRange(double min, double max);
00103 vtkGetVectorMacro(TableRange,double,2);
00105
00107
00109 vtkSetVector2Macro(HueRange,double);
00110 vtkGetVector2Macro(HueRange,double);
00112
00114
00116 vtkSetVector2Macro(SaturationRange,double);
00117 vtkGetVector2Macro(SaturationRange,double);
00119
00121
00123 vtkSetVector2Macro(ValueRange,double);
00124 vtkGetVector2Macro(ValueRange,double);
00126
00128
00130 vtkSetVector2Macro(AlphaRange,double);
00131 vtkGetVector2Macro(AlphaRange,double);
00133
00135 unsigned char *MapValue(double v);
00136
00138
00140 double *GetColor(double x) { return vtkScalarsToColors::GetColor(x); }
00141 void GetColor(double x, double rgb[3]);
00143
00146 double GetOpacity(double v);
00147
00149 virtual vtkIdType GetIndex(double v);
00150
00152
00153 void SetNumberOfTableValues(vtkIdType number);
00154 vtkIdType GetNumberOfTableValues() { return this->NumberOfColors; };
00156
00161 void SetTableValue(vtkIdType indx, double rgba[4]);
00162
00165 void SetTableValue(vtkIdType indx, double r, double g, double b, double a=1.0);
00166
00169 double *GetTableValue(vtkIdType id);
00170
00173 void GetTableValue(vtkIdType id, double rgba[4]);
00174
00176
00178 unsigned char *GetPointer(const vtkIdType id) {
00179 return this->Table->GetPointer(4*id); };
00181
00186 unsigned char *WritePointer(const vtkIdType id, const int number);
00187
00189
00191 double *GetRange() { return this->GetTableRange(); };
00192 void SetRange(double min, double max) { this->SetTableRange(min, max); };
00193 void SetRange(double rng[2]) { this->SetRange(rng[0], rng[1]); };
00195
00197
00201 vtkSetClampMacro(NumberOfColors,vtkIdType,2,VTK_LARGE_ID);
00202 vtkGetMacro(NumberOfColors,vtkIdType);
00204
00206
00207 void MapScalarsThroughTable2(void *input, unsigned char *output,
00208 int inputDataType, int numberOfValues,
00209 int inputIncrement, int outputIncrement);
00211
00213 void DeepCopy(vtkLookupTable *lut);
00214
00215 protected:
00216 vtkLookupTable(int sze=256, int ext=256);
00217 ~vtkLookupTable();
00218
00219 vtkIdType NumberOfColors;
00220 vtkUnsignedCharArray *Table;
00221 double TableRange[2];
00222 double HueRange[2];
00223 double SaturationRange[2];
00224 double ValueRange[2];
00225 double AlphaRange[2];
00226 int Scale;
00227 int Ramp;
00228 vtkTimeStamp InsertTime;
00229 vtkTimeStamp BuildTime;
00230 double RGBA[4];
00231
00232 private:
00233 vtkLookupTable(const vtkLookupTable&);
00234 void operator=(const vtkLookupTable&);
00235 };
00236
00237 inline unsigned char *vtkLookupTable::WritePointer(const vtkIdType id,
00238 const int number)
00239 {
00240 return this->Table->WritePointer(4*id,4*number);
00241 }
00242
00243 #endif
00244
00245
00246