00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00045 #ifndef __vtkColorTransferFunction_h
00046 #define __vtkColorTransferFunction_h
00047
00048 #include "vtkScalarsToColors.h"
00049
00050 class vtkPiecewiseFunction;
00051
00052 #define VTK_CTF_RGB 0
00053 #define VTK_CTF_HSV 1
00054 #define VTK_CTF_HSV_NO_WRAP 2
00055
00056 class VTK_FILTERING_EXPORT vtkColorTransferFunction : public vtkScalarsToColors
00057 {
00058 public:
00059 static vtkColorTransferFunction *New();
00060 vtkTypeRevisionMacro(vtkColorTransferFunction,vtkScalarsToColors);
00061 void DeepCopy( vtkColorTransferFunction *f );
00062
00064 void PrintSelf(ostream& os, vtkIndent indent);
00065
00067 int GetSize() {return this->NumberOfPoints;};
00068
00070
00072 int AddRGBPoint( double x, double r, double g, double b );
00073 int AddHSVPoint( double x, double h, double s, double v );
00074 int RemovePoint( double x );
00076
00078
00079 void AddRGBSegment( double x1, double r1, double g1, double b1,
00080 double x2, double r2, double g2, double b2 );
00081 void AddHSVSegment( double x1, double h1, double s1, double v1,
00082 double x2, double h2, double s2, double v2 );
00084
00086 void RemoveAllPoints();
00087
00089
00091 double *GetColor(double x) {
00092 return vtkScalarsToColors::GetColor(x); }
00093 void GetColor(double x, double rgb[3]);
00095
00097
00098 double GetRedValue( double x );
00099 double GetGreenValue( double x );
00100 double GetBlueValue( double x );
00102
00104 virtual unsigned char *MapValue(double v);
00105
00107
00108 vtkGetVector2Macro( Range, double );
00110
00112
00113 void GetTable( double x1, double x2, int n, double* table );
00114 void GetTable( double x1, double x2, int n, float* table );
00115 const unsigned char *GetTable( double x1, double x2, int n);
00117
00122 void BuildFunctionFromTable( double x1, double x2, int size, double *table);
00123
00125
00126 vtkSetClampMacro( Clamping, int, 0, 1 );
00127 vtkGetMacro( Clamping, int );
00128 vtkBooleanMacro( Clamping, int );
00130
00132
00137 vtkSetClampMacro( ColorSpace, int, VTK_CTF_RGB, VTK_CTF_HSV_NO_WRAP );
00138 void SetColorSpaceToRGB(){this->SetColorSpace(VTK_CTF_RGB);};
00139 void SetColorSpaceToHSV(){this->SetColorSpace(VTK_CTF_HSV);};
00140 void SetColorSpaceToHSVNoWrap(){this->SetColorSpace(VTK_CTF_HSV_NO_WRAP);};
00141 vtkGetMacro( ColorSpace, int );
00143
00145
00147 double *GetDataPointer() {return this->Function;};
00148 void FillFromDataPointer(int, double*);
00150
00152
00153 virtual void MapScalarsThroughTable2(void *input, unsigned char *output,
00154 int inputDataType, int numberOfValues,
00155 int inputIncrement, int outputIncrement);
00157
00158 protected:
00159 vtkColorTransferFunction();
00160 ~vtkColorTransferFunction();
00161
00162
00163
00164
00165
00166 int Clamping;
00167
00168
00169 int ColorSpace;
00170
00171
00172 double *Function;
00173 int FunctionSize;
00174 int NumberOfPoints;
00175
00176
00177 unsigned char UnsignedCharRGBAValue[4];
00178
00179
00180 double Range[2];
00181
00182
00183
00184 vtkPiecewiseFunction *Red;
00185 vtkPiecewiseFunction *Green;
00186 vtkPiecewiseFunction *Blue;
00187 vtkTimeStamp BuildTime;
00188 unsigned char *Table;
00189 int TableSize;
00190
00192
00194 virtual void SetRange(double, double) {};
00195 void SetRange(double rng[2]) {this->SetRange(rng[0],rng[1]);};
00197
00198
00199 private:
00200 vtkColorTransferFunction(const vtkColorTransferFunction&);
00201 void operator=(const vtkColorTransferFunction&);
00202 };
00203
00204 #endif
00205
00206