00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00031 #ifndef __vtkScalarsToColors_h
00032 #define __vtkScalarsToColors_h
00033
00034 #include "vtkObject.h"
00035
00036 class vtkDataArray;
00037 class vtkUnsignedCharArray;
00038
00039 class VTK_COMMON_EXPORT vtkScalarsToColors : public vtkObject
00040 {
00041 public:
00042 vtkTypeMacro(vtkScalarsToColors,vtkObject);
00043 void PrintSelf(ostream& os, vtkIndent indent);
00044
00047 virtual int IsOpaque();
00048
00050 virtual void Build() {};
00051
00053
00054 virtual double *GetRange() = 0;
00055 virtual void SetRange(double min, double max) = 0;
00056 void SetRange(double rng[2])
00057 {this->SetRange(rng[0],rng[1]);}
00059
00062 virtual unsigned char *MapValue(double v) = 0;
00063
00066 virtual void GetColor(double v, double rgb[3]) = 0;
00067
00069
00071 double *GetColor(double v)
00072 {this->GetColor(v,this->RGB); return this->RGB;}
00074
00076
00078 virtual double GetOpacity(double vtkNotUsed(v))
00079 {return 1.0;}
00081
00083
00086 double GetLuminance(double x)
00087 {double rgb[3]; this->GetColor(x,rgb);
00088 return static_cast<double>(rgb[0]*0.30 + rgb[1]*0.59 + rgb[2]*0.11);}
00090
00092
00096 virtual void SetAlpha(double alpha);
00097 vtkGetMacro(Alpha,double);
00099
00101
00110 virtual vtkUnsignedCharArray *MapScalars(vtkDataArray *scalars, int colorMode,
00111 int component);
00113
00115
00116 vtkSetMacro(VectorMode, int);
00117 vtkGetMacro(VectorMode, int);
00118 void SetVectorModeToMagnitude();
00119 void SetVectorModeToComponent();
00121
00122
00123 enum VectorModes {
00124 MAGNITUDE=0,
00125 COMPONENT=1
00126 };
00127
00128
00129
00131
00133 vtkSetMacro(VectorComponent, int);
00134 vtkGetMacro(VectorComponent, int);
00136
00138
00143 void MapScalarsThroughTable(vtkDataArray *scalars,
00144 unsigned char *output,
00145 int outputFormat);
00146 void MapScalarsThroughTable(vtkDataArray *scalars,
00147 unsigned char *output)
00148 {this->MapScalarsThroughTable(scalars,output,VTK_RGBA);}
00150
00151
00153
00154 virtual void MapScalarsThroughTable2(void *input, unsigned char *output,
00155 int inputDataType, int numberOfValues,
00156 int inputIncrement,
00157 int outputFormat) = 0;
00159
00161
00164 virtual vtkUnsignedCharArray *ConvertUnsignedCharToRGBA(
00165 vtkUnsignedCharArray *colors, int numComp, int numTuples);
00167
00169
00171 virtual int UsingLogScale()
00172 { return 0; }
00174 protected:
00175 vtkScalarsToColors();
00176 ~vtkScalarsToColors() {}
00177
00178 double Alpha;
00179
00180
00181 int VectorMode;
00182
00183
00184
00185 int UseMagnitude;
00186 int VectorComponent;
00187
00188 private:
00189 double RGB[3];
00190
00191 vtkScalarsToColors(const vtkScalarsToColors&);
00192 void operator=(const vtkScalarsToColors&);
00193 };
00194
00195 #endif
00196
00197
00198