00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00040 #ifndef __vtkColorTransferFunction_h
00041 #define __vtkColorTransferFunction_h
00042
00043 #include "vtkScalarsToColors.h"
00044
00045 class vtkColorTransferFunctionInternals;
00046
00047 #define VTK_CTF_RGB 0
00048 #define VTK_CTF_HSV 1
00049 #define VTK_CTF_LAB 2
00050 #define VTK_CTF_DIVERGING 3
00051
00052 #define VTK_CTF_LINEAR 0
00053 #define VTK_CTF_LOG10 1
00054
00055 class VTK_FILTERING_EXPORT vtkColorTransferFunction : public vtkScalarsToColors
00056 {
00057 public:
00058 static vtkColorTransferFunction *New();
00059 vtkTypeMacro(vtkColorTransferFunction,vtkScalarsToColors);
00060 void DeepCopy( vtkColorTransferFunction *f );
00061 void ShallowCopy( vtkColorTransferFunction *f );
00062
00064 void PrintSelf(ostream& os, vtkIndent indent);
00065
00067 int GetSize();
00068
00070
00074 int AddRGBPoint( double x, double r, double g, double b );
00075 int AddRGBPoint( double x, double r, double g, double b,
00076 double midpoint, double sharpness );
00077 int AddHSVPoint( double x, double h, double s, double v );
00078 int AddHSVPoint( double x, double h, double s, double v,
00079 double midpoint, double sharpness );
00080 int RemovePoint( double x );
00082
00084
00085 void AddRGBSegment( double x1, double r1, double g1, double b1,
00086 double x2, double r2, double g2, double b2 );
00087 void AddHSVSegment( double x1, double h1, double s1, double v1,
00088 double x2, double h2, double s2, double v2 );
00090
00092 void RemoveAllPoints();
00093
00095
00096 double *GetColor(double x) {
00097 return vtkScalarsToColors::GetColor(x); }
00098 void GetColor(double x, double rgb[3]);
00100
00102
00103 double GetRedValue( double x );
00104 double GetGreenValue( double x );
00105 double GetBlueValue( double x );
00107
00109
00111 int GetNodeValue( int index, double val[6] );
00112 int SetNodeValue( int index, double val[6] );
00114
00116 virtual unsigned char *MapValue(double v);
00117
00119
00120 vtkGetVector2Macro( Range, double );
00122
00125 int AdjustRange(double range[2]);
00126
00128
00129 void GetTable( double x1, double x2, int n, double* table );
00130 void GetTable( double x1, double x2, int n, float* table );
00131 const unsigned char *GetTable( double x1, double x2, int n);
00133
00138 void BuildFunctionFromTable( double x1, double x2, int size, double *table);
00139
00141
00142 vtkSetClampMacro( Clamping, int, 0, 1 );
00143 vtkGetMacro( Clamping, int );
00144 vtkBooleanMacro( Clamping, int );
00146
00148
00155 vtkSetClampMacro( ColorSpace, int, VTK_CTF_RGB, VTK_CTF_DIVERGING );
00156 void SetColorSpaceToRGB(){this->SetColorSpace(VTK_CTF_RGB);};
00157 void SetColorSpaceToHSV(){this->SetColorSpace(VTK_CTF_HSV);};
00158 void SetColorSpaceToLab(){this->SetColorSpace(VTK_CTF_LAB);};
00159 void SetColorSpaceToDiverging(){this->SetColorSpace(VTK_CTF_DIVERGING);}
00160 vtkGetMacro( ColorSpace, int );
00161 vtkSetMacro(HSVWrap, int);
00162 vtkGetMacro(HSVWrap, int);
00163 vtkBooleanMacro(HSVWrap, int);
00165
00167
00170 vtkSetMacro(Scale,int);
00171 void SetScaleToLinear() { this->SetScale(VTK_CTF_LINEAR); };
00172 void SetScaleToLog10() { this->SetScale(VTK_CTF_LOG10); };
00173 vtkGetMacro(Scale,int);
00175
00177
00179 vtkSetVector3Macro(NanColor, double);
00180 vtkGetVector3Macro(NanColor, double);
00182
00184
00186 double *GetDataPointer();
00187 void FillFromDataPointer(int, double*);
00189
00191
00192 virtual void MapScalarsThroughTable2(void *input, unsigned char *output,
00193 int inputDataType, int numberOfValues,
00194 int inputIncrement, int outputIncrement);
00196
00198
00200 vtkSetMacro(AllowDuplicateScalars, int);
00201 vtkGetMacro(AllowDuplicateScalars, int);
00202 vtkBooleanMacro(AllowDuplicateScalars, int);
00204
00206 virtual vtkIdType GetNumberOfAvailableColors();
00207
00208 protected:
00209 vtkColorTransferFunction();
00210 ~vtkColorTransferFunction();
00211
00212 vtkColorTransferFunctionInternals *Internal;
00213
00214
00215
00216
00217
00218 int Clamping;
00219
00220
00221 int ColorSpace;
00222
00223
00224 int HSVWrap;
00225
00226
00227 int Scale;
00228
00229
00230 double NanColor[3];
00231
00232 double *Function;
00233
00234
00235 double Range[2];
00236
00237
00238 unsigned char UnsignedCharRGBAValue[4];
00239
00240 int AllowDuplicateScalars;
00241
00242 vtkTimeStamp BuildTime;
00243 unsigned char *Table;
00244 int TableSize;
00245
00247
00249 virtual void SetRange(double, double) {};
00250 void SetRange(double rng[2]) {this->SetRange(rng[0],rng[1]);};
00252
00253
00254
00255 void SortAndUpdateRange();
00256
00259 void MovePoint(double oldX, double newX);
00260
00261 private:
00262 vtkColorTransferFunction(const vtkColorTransferFunction&);
00263 void operator=(const vtkColorTransferFunction&);
00264 };
00265
00266 #endif
00267