Common/vtkLookupTable.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00050 #ifndef __vtkLookupTable_h
00051 #define __vtkLookupTable_h
00052
00053 #include "vtkScalarsToColors.h"
00054
00055 #include "vtkUnsignedCharArray.h"
00056
00057 #define VTK_RAMP_LINEAR 0
00058 #define VTK_RAMP_SCURVE 1
00059 #define VTK_RAMP_SQRT 2
00060 #define VTK_SCALE_LINEAR 0
00061 #define VTK_SCALE_LOG10 1
00062
00063 class VTK_COMMON_EXPORT vtkLookupTable : public vtkScalarsToColors
00064 {
00065 public:
00068 static vtkLookupTable *New();
00069
00070 vtkTypeRevisionMacro(vtkLookupTable,vtkScalarsToColors);
00071 void PrintSelf(ostream& os, vtkIndent indent);
00072
00074 int Allocate(int sz=256, int ext=256);
00075
00078 virtual void Build();
00079
00085 virtual void ForceBuild();
00086
00088
00095 vtkSetMacro(Ramp,int);
00096 void SetRampToLinear() { this->SetRamp(VTK_RAMP_LINEAR); };
00097 void SetRampToSCurve() { this->SetRamp(VTK_RAMP_SCURVE); };
00098 void SetRampToSQRT() { this->SetRamp(VTK_RAMP_SQRT); };
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 virtual vtkIdType GetIndex(float v);
00166
00168
00169 void SetNumberOfTableValues(vtkIdType number);
00170 vtkIdType GetNumberOfTableValues() { return this->NumberOfColors; };
00172
00177 void SetTableValue(vtkIdType indx, float rgba[4]);
00178
00181 void SetTableValue(vtkIdType indx, float r, float g, float b, float a=1.0);
00182
00185 float *GetTableValue(vtkIdType id);
00186
00189 void GetTableValue(vtkIdType id, float rgba[4]);
00190
00192
00194 unsigned char *GetPointer(const vtkIdType id) {
00195 return this->Table->GetPointer(4*id); };
00197
00202 unsigned char *WritePointer(const vtkIdType id, const int number);
00203
00205
00207 float *GetRange() { return this->GetTableRange(); };
00208 void SetRange(float min, float max) { this->SetTableRange(min, max); };
00209 void SetRange(float rng[2]) { this->SetRange(rng[0], rng[1]); };
00211
00213
00217 vtkSetClampMacro(NumberOfColors,vtkIdType,2,VTK_LARGE_ID);
00218 vtkGetMacro(NumberOfColors,vtkIdType);
00220
00222
00223 void MapScalarsThroughTable2(void *input, unsigned char *output,
00224 int inputDataType, int numberOfValues,
00225 int inputIncrement, int outputIncrement);
00227
00229 void DeepCopy(vtkLookupTable *lut);
00230
00231 protected:
00232 vtkLookupTable(int sze=256, int ext=256);
00233 ~vtkLookupTable();
00234
00235 vtkIdType NumberOfColors;
00236 vtkUnsignedCharArray *Table;
00237 float TableRange[2];
00238 float HueRange[2];
00239 float SaturationRange[2];
00240 float ValueRange[2];
00241 float AlphaRange[2];
00242 int Scale;
00243 int Ramp;
00244 vtkTimeStamp InsertTime;
00245 vtkTimeStamp BuildTime;
00246 float RGBA[4];
00247
00248 private:
00249 vtkLookupTable(const vtkLookupTable&);
00250 void operator=(const vtkLookupTable&);
00251 };
00252
00253 inline unsigned char *vtkLookupTable::WritePointer(const vtkIdType id,
00254 const int number)
00255 {
00256 return this->Table->WritePointer(4*id,4*number);
00257 }
00258
00259 #endif
00260
00261
00262