vtkScalarsToColors.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00044 #ifndef __vtkScalarsToColors_h
00045 #define __vtkScalarsToColors_h
00046
00047 #include "vtkObject.h"
00048
00049 class vtkDataArray;
00050 class vtkUnsignedCharArray;
00051
00052 class VTK_COMMON_EXPORT vtkScalarsToColors : public vtkObject
00053 {
00054 public:
00055 vtkTypeRevisionMacro(vtkScalarsToColors,vtkObject);
00056 void PrintSelf(ostream& os, vtkIndent indent);
00057
00059 virtual void Build() {};
00060
00062
00063 virtual double *GetRange() = 0;
00064 virtual void SetRange(double min, double max) = 0;
00065 void SetRange(double rng[2])
00066 {this->SetRange(rng[0],rng[1]);}
00068
00071 virtual unsigned char *MapValue(double v) = 0;
00072
00075 virtual void GetColor(double v, double rgb[3]) = 0;
00076
00078
00080 double *GetColor(double v)
00081 {this->GetColor(v,this->RGB); return this->RGB;}
00083
00085
00087 virtual double GetOpacity(double vtkNotUsed(v))
00088 {return 1.0;}
00090
00092
00095 double GetLuminance(double x)
00096 {double rgb[3]; this->GetColor(x,rgb);
00097 return static_cast<double>(rgb[0]*0.30 + rgb[1]*0.59 + rgb[2]*0.11);}
00099
00101
00105 void SetAlpha(double alpha);
00106 vtkGetMacro(Alpha,double);
00108
00110
00119 vtkUnsignedCharArray *MapScalars(vtkDataArray *scalars, int colorMode,
00120 int component);
00122
00124
00125 vtkSetMacro(VectorMode, int);
00126 vtkGetMacro(VectorMode, int);
00127 void SetVectorModeToMagnitude();
00128 void SetVectorModeToComponent();
00130
00131
00132 enum VectorModes {
00133 MAGNITUDE=0,
00134 COMPONENT=1
00135 };
00136
00137
00138
00140
00142 vtkSetMacro(VectorComponent, int);
00143 vtkGetMacro(VectorComponent, int);
00145
00147
00152 void MapScalarsThroughTable(vtkDataArray *scalars,
00153 unsigned char *output,
00154 int outputFormat);
00155 void MapScalarsThroughTable(vtkDataArray *scalars,
00156 unsigned char *output)
00157 {this->MapScalarsThroughTable(scalars,output,VTK_RGBA);}
00159
00160
00162
00163 virtual void MapScalarsThroughTable2(void *input, unsigned char *output,
00164 int inputDataType, int numberOfValues,
00165 int inputIncrement,
00166 int outputFormat) = 0;
00168
00170
00173 virtual vtkUnsignedCharArray *ConvertUnsignedCharToRGBA(
00174 vtkUnsignedCharArray *colors, int numComp, int numTuples);
00176
00177 protected:
00178 vtkScalarsToColors();
00179 ~vtkScalarsToColors() {}
00180
00181 double Alpha;
00182
00183
00184 int VectorMode;
00185
00186
00187
00188 int UseMagnitude;
00189 int VectorComponent;
00190
00191 private:
00192 double RGB[3];
00193 private:
00194 vtkScalarsToColors(const vtkScalarsToColors&);
00195 void operator=(const vtkScalarsToColors&);
00196 };
00197
00198 #endif
00199
00200
00201