vtkLookupTable.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00049 #ifndef __vtkLookupTable_h
00050 #define __vtkLookupTable_h
00051
00052 #include "vtkScalarsToColors.h"
00053
00054 #include "vtkUnsignedCharArray.h"
00055
00056 #define VTK_RAMP_LINEAR 0
00057 #define VTK_RAMP_SCURVE 1
00058 #define VTK_RAMP_SQRT 2
00059 #define VTK_SCALE_LINEAR 0
00060 #define VTK_SCALE_LOG10 1
00061
00062 class VTK_COMMON_EXPORT vtkLookupTable : public vtkScalarsToColors
00063 {
00064 public:
00067 static vtkLookupTable *New();
00068
00069 vtkTypeRevisionMacro(vtkLookupTable,vtkScalarsToColors);
00070 void PrintSelf(ostream& os, vtkIndent indent);
00071
00073 int Allocate(int sz=256, int ext=256);
00074
00077 virtual void Build();
00078
00084 virtual void ForceBuild();
00085
00087
00094 vtkSetMacro(Ramp,int);
00095 void SetRampToLinear() { this->SetRamp(VTK_RAMP_LINEAR); };
00096 void SetRampToSCurve() { this->SetRamp(VTK_RAMP_SCURVE); };
00097 void SetRampToSQRT() { this->SetRamp(VTK_RAMP_SQRT); };
00098 vtkGetMacro(Ramp,int);
00100
00102
00105 void SetScale(int scale);
00106 void SetScaleToLinear() { this->SetScale(VTK_SCALE_LINEAR); };
00107 void SetScaleToLog10() { this->SetScale(VTK_SCALE_LOG10); };
00108 vtkGetMacro(Scale,int);
00110
00112
00116 void SetTableRange(double r[2]);
00117 virtual void SetTableRange(double min, double max);
00118 vtkGetVectorMacro(TableRange,double,2);
00120
00122
00124 vtkSetVector2Macro(HueRange,double);
00125 vtkGetVector2Macro(HueRange,double);
00127
00129
00131 vtkSetVector2Macro(SaturationRange,double);
00132 vtkGetVector2Macro(SaturationRange,double);
00134
00136
00138 vtkSetVector2Macro(ValueRange,double);
00139 vtkGetVector2Macro(ValueRange,double);
00141
00143
00145 vtkSetVector2Macro(AlphaRange,double);
00146 vtkGetVector2Macro(AlphaRange,double);
00148
00150 unsigned char *MapValue(double v);
00151
00153
00155 double *GetColor(double x) { return vtkScalarsToColors::GetColor(x); }
00156 void GetColor(double x, double rgb[3]);
00158
00161 double GetOpacity(double v);
00162
00164 virtual vtkIdType GetIndex(double v);
00165
00167
00168 void SetNumberOfTableValues(vtkIdType number);
00169 vtkIdType GetNumberOfTableValues() { return this->NumberOfColors; };
00171
00176 void SetTableValue(vtkIdType indx, double rgba[4]);
00177
00180 void SetTableValue(vtkIdType indx, double r, double g, double b, double a=1.0);
00181
00184 double *GetTableValue(vtkIdType id);
00185
00188 void GetTableValue(vtkIdType id, double rgba[4]);
00189
00191
00193 unsigned char *GetPointer(const vtkIdType id) {
00194 return this->Table->GetPointer(4*id); };
00196
00201 unsigned char *WritePointer(const vtkIdType id, const int number);
00202
00204
00206 double *GetRange() { return this->GetTableRange(); };
00207 void SetRange(double min, double max) { this->SetTableRange(min, max); };
00208 void SetRange(double rng[2]) { this->SetRange(rng[0], rng[1]); };
00210
00212
00216 vtkSetClampMacro(NumberOfColors,vtkIdType,2,VTK_LARGE_ID);
00217 vtkGetMacro(NumberOfColors,vtkIdType);
00219
00221
00222 void MapScalarsThroughTable2(void *input, unsigned char *output,
00223 int inputDataType, int numberOfValues,
00224 int inputIncrement, int outputIncrement);
00226
00228 void DeepCopy(vtkLookupTable *lut);
00229
00230 protected:
00231 vtkLookupTable(int sze=256, int ext=256);
00232 ~vtkLookupTable();
00233
00234 vtkIdType NumberOfColors;
00235 vtkUnsignedCharArray *Table;
00236 double TableRange[2];
00237 double HueRange[2];
00238 double SaturationRange[2];
00239 double ValueRange[2];
00240 double AlphaRange[2];
00241 int Scale;
00242 int Ramp;
00243 vtkTimeStamp InsertTime;
00244 vtkTimeStamp BuildTime;
00245 double RGBA[4];
00246
00247 private:
00248 vtkLookupTable(const vtkLookupTable&);
00249 void operator=(const vtkLookupTable&);
00250 };
00251
00252 inline unsigned char *vtkLookupTable::WritePointer(const vtkIdType id,
00253 const int number)
00254 {
00255 this->InsertTime.Modified();
00256 return this->Table->WritePointer(4*id,4*number);
00257 }
00258
00259 #endif
00260
00261
00262