00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00032 #ifndef __vtkColorTransferFunction_h
00033 #define __vtkColorTransferFunction_h
00034
00035 #include "vtkScalarsToColors.h"
00036
00037 class vtkPiecewiseFunction;
00038
00039 #define VTK_CTF_RGB 0
00040 #define VTK_CTF_HSV 1
00041
00042 class VTK_FILTERING_EXPORT vtkColorTransferFunction : public vtkScalarsToColors
00043 {
00044 public:
00045 static vtkColorTransferFunction *New();
00046 vtkTypeRevisionMacro(vtkColorTransferFunction,vtkScalarsToColors);
00047 void DeepCopy( vtkColorTransferFunction *f );
00048
00050 void PrintSelf(ostream& os, vtkIndent indent);
00051
00053 int GetSize() {return this->NumberOfPoints;};
00054
00056
00058 int AddRGBPoint( double x, double r, double g, double b );
00059 int AddHSVPoint( double x, double h, double s, double v );
00060 int RemovePoint( double x );
00062
00064
00065 void AddRGBSegment( double x1, double r1, double g1, double b1,
00066 double x2, double r2, double g2, double b2 );
00067 void AddHSVSegment( double x1, double h1, double s1, double v1,
00068 double x2, double h2, double s2, double v2 );
00070
00072 void RemoveAllPoints();
00073
00075
00077 double *GetColor(double x) {
00078 return vtkScalarsToColors::GetColor(x); }
00079 void GetColor(double x, double rgb[3]);
00081
00083
00084 double GetRedValue( double x );
00085 double GetGreenValue( double x );
00086 double GetBlueValue( double x );
00088
00090 virtual unsigned char *MapValue(double v);
00091
00093
00094 vtkGetVector2Macro( Range, double );
00096
00098
00099 void GetTable( double x1, double x2, int n, double* table );
00100 void GetTable( double x1, double x2, int n, float* table );
00101 const unsigned char *GetTable( double x1, double x2, int n);
00103
00108 void BuildFunctionFromTable( double x1, double x2, int size, double *table);
00109
00111
00112 vtkSetClampMacro( Clamping, int, 0, 1 );
00113 vtkGetMacro( Clamping, int );
00114 vtkBooleanMacro( Clamping, int );
00116
00118
00119 vtkSetClampMacro( ColorSpace, int, VTK_CTF_RGB, VTK_CTF_HSV );
00120 void SetColorSpaceToRGB(){this->SetColorSpace(VTK_CTF_RGB);};
00121 void SetColorSpaceToHSV(){this->SetColorSpace(VTK_CTF_HSV);};
00122 vtkGetMacro( ColorSpace, int );
00124
00126
00128 double *GetDataPointer() {return this->Function;};
00129 void FillFromDataPointer(int, double*);
00131
00133
00134 virtual void MapScalarsThroughTable2(void *input, unsigned char *output,
00135 int inputDataType, int numberOfValues,
00136 int inputIncrement, int outputIncrement);
00138
00139 protected:
00140 vtkColorTransferFunction();
00141 ~vtkColorTransferFunction();
00142
00143
00144
00145
00146
00147 int Clamping;
00148
00149
00150 int ColorSpace;
00151
00152
00153 double *Function;
00154 int FunctionSize;
00155 int NumberOfPoints;
00156
00157
00158 unsigned char UnsignedCharRGBAValue[4];
00159
00160
00161 double Range[2];
00162
00163
00164
00165 vtkPiecewiseFunction *Red;
00166 vtkPiecewiseFunction *Green;
00167 vtkPiecewiseFunction *Blue;
00168 vtkTimeStamp BuildTime;
00169 unsigned char *Table;
00170 int TableSize;
00171
00173
00175 virtual void SetRange(double, double) {};
00176 void SetRange(double rng[2]) {this->SetRange(rng[0],rng[1]);};
00178
00179
00180 private:
00181 vtkColorTransferFunction(const vtkColorTransferFunction&);
00182 void operator=(const vtkColorTransferFunction&);
00183 };
00184
00185 #endif
00186
00187