00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00030 #ifndef __vtkScalarsToColors_h
00031 #define __vtkScalarsToColors_h
00032
00033 #include "vtkObject.h"
00034
00035 class vtkDataArray;
00036 class vtkUnsignedCharArray;
00037
00038 class VTK_COMMON_EXPORT vtkScalarsToColors : public vtkObject
00039 {
00040 public:
00041 vtkTypeRevisionMacro(vtkScalarsToColors,vtkObject);
00042 void PrintSelf(ostream& os, vtkIndent indent);
00043
00046 virtual int IsOpaque();
00047
00049 virtual void Build() {};
00050
00052
00053 virtual double *GetRange() = 0;
00054 virtual void SetRange(double min, double max) = 0;
00055 void SetRange(double rng[2])
00056 {this->SetRange(rng[0],rng[1]);}
00058
00061 virtual unsigned char *MapValue(double v) = 0;
00062
00065 virtual void GetColor(double v, double rgb[3]) = 0;
00066
00068
00070 double *GetColor(double v)
00071 {this->GetColor(v,this->RGB); return this->RGB;}
00073
00075
00077 virtual double GetOpacity(double vtkNotUsed(v))
00078 {return 1.0;}
00080
00082
00085 double GetLuminance(double x)
00086 {double rgb[3]; this->GetColor(x,rgb);
00087 return static_cast<double>(rgb[0]*0.30 + rgb[1]*0.59 + rgb[2]*0.11);}
00089
00091
00095 virtual void SetAlpha(double alpha);
00096 vtkGetMacro(Alpha,double);
00098
00100
00109 virtual vtkUnsignedCharArray *MapScalars(vtkDataArray *scalars, int colorMode,
00110 int component);
00112
00114
00115 vtkSetMacro(VectorMode, int);
00116 vtkGetMacro(VectorMode, int);
00117 void SetVectorModeToMagnitude();
00118 void SetVectorModeToComponent();
00120
00121
00122 enum VectorModes {
00123 MAGNITUDE=0,
00124 COMPONENT=1
00125 };
00126
00127
00128
00130
00132 vtkSetMacro(VectorComponent, int);
00133 vtkGetMacro(VectorComponent, int);
00135
00137
00142 void MapScalarsThroughTable(vtkDataArray *scalars,
00143 unsigned char *output,
00144 int outputFormat);
00145 void MapScalarsThroughTable(vtkDataArray *scalars,
00146 unsigned char *output)
00147 {this->MapScalarsThroughTable(scalars,output,VTK_RGBA);}
00149
00150
00152
00153 virtual void MapScalarsThroughTable2(void *input, unsigned char *output,
00154 int inputDataType, int numberOfValues,
00155 int inputIncrement,
00156 int outputFormat) = 0;
00158
00160
00163 virtual vtkUnsignedCharArray *ConvertUnsignedCharToRGBA(
00164 vtkUnsignedCharArray *colors, int numComp, int numTuples);
00166
00168
00170 virtual int UsingLogScale()
00171 { return 0; }
00173 protected:
00174 vtkScalarsToColors();
00175 ~vtkScalarsToColors() {}
00176
00177 double Alpha;
00178
00179
00180 int VectorMode;
00181
00182
00183
00184 int UseMagnitude;
00185 int VectorComponent;
00186
00187 private:
00188 double RGB[3];
00189
00190 vtkScalarsToColors(const vtkScalarsToColors&);
00191 void operator=(const vtkScalarsToColors&);
00192 };
00193
00194 #endif
00195
00196
00197