00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00062 #ifndef __vtkLookupTable_h
00063 #define __vtkLookupTable_h
00064
00065 #include "vtkScalarsToColors.h"
00066
00067 #define VTK_RAMP_LINEAR 0
00068 #define VTK_RAMP_SCURVE 1
00069 #define VTK_SCALE_LINEAR 0
00070 #define VTK_SCALE_LOG10 1
00071
00072 class VTK_COMMON_EXPORT vtkLookupTable : public vtkScalarsToColors
00073 {
00074 public:
00077 static vtkLookupTable *New();
00078
00079 vtkTypeMacro(vtkLookupTable,vtkScalarsToColors);
00080 void PrintSelf(ostream& os, vtkIndent indent);
00081
00083 int Allocate(int sz=256, int ext=256);
00084
00087 virtual void Build();
00088
00090
00096 vtkSetMacro(Ramp,int);
00097 void SetRampToLinear() { this->SetRamp(VTK_RAMP_LINEAR); };
00098 void SetRampToSCurve() { this->SetRamp(VTK_RAMP_SCURVE); };
00099 vtkGetMacro(Ramp,int);
00101
00103
00106 void SetScale(int scale);
00107 void SetScaleToLinear() { this->SetScale(VTK_SCALE_LINEAR); };
00108 void SetScaleToLog10() { this->SetScale(VTK_SCALE_LOG10); };
00109 vtkGetMacro(Scale,int);
00111
00113
00117 void SetTableRange(float r[2]);
00118 virtual void SetTableRange(float min, float max);
00119 vtkGetVectorMacro(TableRange,float,2);
00121
00123
00125 vtkSetVector2Macro(HueRange,float);
00126 vtkGetVector2Macro(HueRange,float);
00128
00130
00132 vtkSetVector2Macro(SaturationRange,float);
00133 vtkGetVector2Macro(SaturationRange,float);
00135
00137
00139 vtkSetVector2Macro(ValueRange,float);
00140 vtkGetVector2Macro(ValueRange,float);
00142
00144
00146 vtkSetVector2Macro(AlphaRange,float);
00147 vtkGetVector2Macro(AlphaRange,float);
00149
00151 unsigned char *MapValue(float v);
00152
00154
00156 float *GetColor(float x) { return vtkScalarsToColors::GetColor(x); }
00157 void GetColor(float x, float rgb[3]);
00159
00162 float GetOpacity(float v);
00163
00165
00166 void SetNumberOfTableValues(int number);
00167 int GetNumberOfTableValues() { return this->NumberOfColors; };
00169
00174 void SetTableValue(int indx, float rgba[4]);
00175
00178 void SetTableValue(int indx, float r, float g, float b, float a=1.0);
00179
00182 float *GetTableValue(int id);
00183
00186 void GetTableValue(int id, float rgba[4]);
00187
00189
00191 unsigned char *GetPointer(const int id) {
00192 return this->Table->GetPointer(4*id); };
00194
00199 unsigned char *WritePointer(const int id, const int number);
00200
00202
00204 float *GetRange() { return this->GetTableRange(); };
00205 void SetRange(float min, float max) { this->SetTableRange(min, max); };
00206 void SetRange(float rng[2]) { this->SetRange(rng[0], rng[1]); };
00208
00210
00214 vtkSetClampMacro(NumberOfColors,int,2,65535);
00215 vtkGetMacro(NumberOfColors,int);
00217
00219
00220 void MapScalarsThroughTable2(void *input, unsigned char *output,
00221 int inputDataType, int numberOfValues,
00222 int inputIncrement, int outputIncrement);
00224
00225 protected:
00226 vtkLookupTable(int sze=256, int ext=256);
00227 ~vtkLookupTable();
00228
00229 int NumberOfColors;
00230 vtkUnsignedCharArray *Table;
00231 float TableRange[2];
00232 float HueRange[2];
00233 float SaturationRange[2];
00234 float ValueRange[2];
00235 float AlphaRange[2];
00236 int Scale;
00237 int Ramp;
00238 vtkTimeStamp InsertTime;
00239 vtkTimeStamp BuildTime;
00240 float RGBA[4];
00241 private:
00242 vtkLookupTable(const vtkLookupTable&);
00243 void operator=(const vtkLookupTable&);
00244 };
00245
00246 inline unsigned char *vtkLookupTable::WritePointer(const int id,
00247 const int number)
00248 {
00249 return this->Table->WritePointer(4*id,4*number);
00250 }
00251
00252 #endif
00253
00254
00255