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
00045 virtual void Build() {};
00046
00048
00049 virtual double *GetRange() = 0;
00050 virtual void SetRange(double min, double max) = 0;
00051 void SetRange(double rng[2])
00052 {this->SetRange(rng[0],rng[1]);}
00054
00057 virtual unsigned char *MapValue(double v) = 0;
00058
00061 virtual void GetColor(double v, double rgb[3]) = 0;
00062
00064
00066 double *GetColor(double v)
00067 {this->GetColor(v,this->RGB); return this->RGB;}
00069
00071
00073 virtual double GetOpacity(double vtkNotUsed(v))
00074 {return 1.0;}
00076
00078
00081 double GetLuminance(double x)
00082 {double rgb[3]; this->GetColor(x,rgb);
00083 return static_cast<double>(rgb[0]*0.30 + rgb[1]*0.59 + rgb[2]*0.11);}
00085
00087
00091 void SetAlpha(double alpha);
00092 vtkGetMacro(Alpha,double);
00094
00096
00105 vtkUnsignedCharArray *MapScalars(vtkDataArray *scalars, int colorMode,
00106 int component);
00108
00110
00111 vtkSetMacro(VectorMode, int);
00112 vtkGetMacro(VectorMode, int);
00113 void SetVectorModeToMagnitude();
00114 void SetVectorModeToComponent();
00116
00117
00118 enum VectorModes {
00119 MAGNITUDE=0,
00120 COMPONENT=1
00121 };
00122
00123
00124
00126
00128 vtkSetMacro(VectorComponent, int);
00129 vtkGetMacro(VectorComponent, int);
00131
00133
00138 void MapScalarsThroughTable(vtkDataArray *scalars,
00139 unsigned char *output,
00140 int outputFormat);
00141 void MapScalarsThroughTable(vtkDataArray *scalars,
00142 unsigned char *output)
00143 {this->MapScalarsThroughTable(scalars,output,VTK_RGBA);}
00145
00146
00148
00149 virtual void MapScalarsThroughTable2(void *input, unsigned char *output,
00150 int inputDataType, int numberOfValues,
00151 int inputIncrement,
00152 int outputFormat) = 0;
00154
00156
00159 virtual vtkUnsignedCharArray *ConvertUnsignedCharToRGBA(
00160 vtkUnsignedCharArray *colors, int numComp, int numTuples);
00162
00163 protected:
00164 vtkScalarsToColors();
00165 ~vtkScalarsToColors() {}
00166
00167 double Alpha;
00168
00169
00170 int VectorMode;
00171
00172
00173
00174 int UseMagnitude;
00175 int VectorComponent;
00176
00177 private:
00178 double RGB[3];
00179
00180 vtkScalarsToColors(const vtkScalarsToColors&);
00181 void operator=(const vtkScalarsToColors&);
00182 };
00183
00184 #endif
00185
00186
00187