VTK
vtkColorTransferFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkColorTransferFunction.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
41 #ifndef vtkColorTransferFunction_h
42 #define vtkColorTransferFunction_h
43 
44 #include "vtkRenderingCoreModule.h" // For export macro
45 #include "vtkScalarsToColors.h"
46 
47 class vtkColorTransferFunctionInternals;
48 
49 #define VTK_CTF_RGB 0
50 #define VTK_CTF_HSV 1
51 #define VTK_CTF_LAB 2
52 #define VTK_CTF_DIVERGING 3
53 
54 #define VTK_CTF_LINEAR 0
55 #define VTK_CTF_LOG10 1
56 
58 {
59 public:
64 
66  void PrintSelf(ostream& os, vtkIndent indent);
67 
69  int GetSize();
70 
72 
76  int AddRGBPoint( double x, double r, double g, double b );
77  int AddRGBPoint( double x, double r, double g, double b,
78  double midpoint, double sharpness );
79  int AddHSVPoint( double x, double h, double s, double v );
80  int AddHSVPoint( double x, double h, double s, double v,
81  double midpoint, double sharpness );
82  int RemovePoint( double x );
84 
86 
87  void AddRGBSegment( double x1, double r1, double g1, double b1,
88  double x2, double r2, double g2, double b2 );
89  void AddHSVSegment( double x1, double h1, double s1, double v1,
90  double x2, double h2, double s2, double v2 );
92 
95 
97 
98  double *GetColor(double x) {
100  void GetColor(double x, double rgb[3]);
102 
104 
105  double GetRedValue( double x );
106  double GetGreenValue( double x );
107  double GetBlueValue( double x );
109 
111 
113  int GetNodeValue( int index, double val[6] );
114  int SetNodeValue( int index, double val[6] );
116 
118  virtual unsigned char *MapValue(double v);
119 
121 
122  vtkGetVector2Macro( Range, double );
124 
127  int AdjustRange(double range[2]);
128 
130 
133  void GetTable( double x1, double x2, int n, double* table );
134  void GetTable( double x1, double x2, int n, float* table );
135  const unsigned char *GetTable( double x1, double x2, int n );
137 
145  void BuildFunctionFromTable( double x1, double x2, int size, double *table );
146 
148 
153  vtkSetClampMacro( Clamping, int, 0, 1 );
154  vtkGetMacro( Clamping, int );
155  vtkBooleanMacro( Clamping, int );
157 
159 
167  void SetColorSpaceToRGB(){this->SetColorSpace(VTK_CTF_RGB);};
168  void SetColorSpaceToHSV(){this->SetColorSpace(VTK_CTF_HSV);};
169  void SetColorSpaceToLab(){this->SetColorSpace(VTK_CTF_LAB);};
170  void SetColorSpaceToDiverging(){this->SetColorSpace(VTK_CTF_DIVERGING);}
171  vtkGetMacro( ColorSpace, int );
172  vtkSetMacro(HSVWrap, int);
173  vtkGetMacro(HSVWrap, int);
174  vtkBooleanMacro(HSVWrap, int);
176 
178 
181  vtkSetMacro(Scale,int);
182  void SetScaleToLinear() { this->SetScale(VTK_CTF_LINEAR); };
183  void SetScaleToLog10() { this->SetScale(VTK_CTF_LOG10); };
184  vtkGetMacro(Scale,int);
186 
188 
190  vtkSetVector3Macro(NanColor, double);
191  vtkGetVector3Macro(NanColor, double);
193 
195 
197  vtkSetVector3Macro(BelowRangeColor, double);
198  vtkGetVector3Macro(BelowRangeColor, double);
200 
202 
203  vtkSetMacro(UseBelowRangeColor, int);
204  vtkGetMacro(UseBelowRangeColor, int);
205  vtkBooleanMacro(UseBelowRangeColor, int);
207 
209 
211  vtkSetVector3Macro(AboveRangeColor, double);
212  vtkGetVector3Macro(AboveRangeColor, double);
214 
216 
217  vtkSetMacro(UseAboveRangeColor, int);
218  vtkGetMacro(UseAboveRangeColor, int);
219  vtkBooleanMacro(UseAboveRangeColor, int);
221 
227  double* GetDataPointer();
228 
232  void FillFromDataPointer(int n, double* ptr);
233 
235 
236  virtual void MapScalarsThroughTable2(void *input, unsigned char *output,
237  int inputDataType, int numberOfValues,
238  int inputIncrement, int outputIncrement);
240 
242 
244  vtkSetMacro(AllowDuplicateScalars, int);
245  vtkGetMacro(AllowDuplicateScalars, int);
246  vtkBooleanMacro(AllowDuplicateScalars, int);
248 
251 
255  virtual void GetIndexedColor(vtkIdType idx, double rgba[4]);
256 
257 protected:
260 
261  vtkColorTransferFunctionInternals *Internal;
262 
266  int Clamping;
267 
270 
272  int HSVWrap;
273 
275  int Scale;
276 
278  double NanColor[3];
279 
281  double BelowRangeColor[3];
282 
285 
287  double AboveRangeColor[3];
288 
291 
293  double* Function;
294 
296  double Range[2];
297 
299  unsigned char UnsignedCharRGBAValue[4];
300 
304 
306  unsigned char *Table;
307 
311 
313 
315  virtual void SetRange(double, double) {}
316  void SetRange(double rng[2]) {this->SetRange(rng[0],rng[1]);};
318 
322 
325  bool UpdateRange();
326 
329  void MovePoint(double oldX, double newX);
330 
331 private:
332  vtkColorTransferFunction(const vtkColorTransferFunction&); // Not implemented.
333  void operator=(const vtkColorTransferFunction&); // Not implemented.
334 };
335 
336 #endif
vtkColorTransferFunction::DeepCopy
void DeepCopy(vtkScalarsToColors *f)
vtkColorTransferFunction::GetColor
double * GetColor(double x)
Definition: vtkColorTransferFunction.h:98
vtkColorTransferFunction::BuildTime
vtkTimeStamp BuildTime
Definition: vtkColorTransferFunction.h:305
vtkgl::v2
GLfloat GLfloat GLfloat v2
Definition: vtkgl.h:12015
vtkColorTransferFunction::~vtkColorTransferFunction
~vtkColorTransferFunction()
vtkColorTransferFunction::GetDataPointer
double * GetDataPointer()
vtkgl::b
GLboolean GLboolean GLboolean b
Definition: vtkgl.h:12312
vtkgl::h
GLfloat GLfloat GLfloat GLfloat h
Definition: vtkgl.h:14364
vtkColorTransferFunction::AddHSVPoint
int AddHSVPoint(double x, double h, double s, double v)
vtkGetVector2Macro
#define vtkGetVector2Macro(name, type)
Definition: vtkSetGet.h:270
vtkSetVector3Macro
#define vtkSetVector3Macro(name, type)
Definition: vtkSetGet.h:287
vtkIdType
int vtkIdType
Definition: vtkType.h:275
vtkColorTransferFunction::New
static vtkColorTransferFunction * New()
vtkColorTransferFunction::GetTable
void GetTable(double x1, double x2, int n, float *table)
vtkColorTransferFunction::vtkColorTransferFunction
vtkColorTransferFunction()
vtkColorTransferFunction::GetNumberOfAvailableColors
virtual vtkIdType GetNumberOfAvailableColors()
vtkColorTransferFunction::MapValue
virtual unsigned char * MapValue(double v)
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:35
VTK_CTF_LAB
#define VTK_CTF_LAB
Definition: vtkColorTransferFunction.h:51
vtkgl::s
GLdouble s
Definition: vtkgl.h:11594
vtkColorTransferFunction::GetTable
const unsigned char * GetTable(double x1, double x2, int n)
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkColorTransferFunction::SetColorSpaceToDiverging
void SetColorSpaceToDiverging()
Definition: vtkColorTransferFunction.h:170
vtkgl::n
GLclampd n
Definition: vtkgl.h:14370
vtkColorTransferFunction::MovePoint
void MovePoint(double oldX, double newX)
vtkColorTransferFunction::Internal
vtkColorTransferFunctionInternals * Internal
Definition: vtkColorTransferFunction.h:261
vtkColorTransferFunction::GetTable
void GetTable(double x1, double x2, int n, double *table)
vtkgl::v
const GLdouble * v
Definition: vtkgl.h:11595
vtkgl::x
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
vtkColorTransferFunction::SetRange
void SetRange(double rng[2])
Definition: vtkColorTransferFunction.h:316
vtkColorTransferFunction::FillFromDataPointer
void FillFromDataPointer(int n, double *ptr)
vtkgl::table
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: vtkgl.h:11332
vtkColorTransferFunction::UpdateRange
bool UpdateRange()
vtkColorTransferFunction::Scale
int Scale
Definition: vtkColorTransferFunction.h:275
vtkgl::input
GLenum GLenum GLenum input
Definition: vtkgl.h:15941
vtkColorTransferFunction::HSVWrap
int HSVWrap
Definition: vtkColorTransferFunction.h:272
vtkColorTransferFunction::GetSize
int GetSize()
vtkgl::range
GLenum GLint * range
Definition: vtkgl.h:14180
vtkColorTransferFunction::BuildFunctionFromTable
void BuildFunctionFromTable(double x1, double x2, int size, double *table)
vtkColorTransferFunction
Defines a transfer function for mapping a property to an RGB color value.
Definition: vtkColorTransferFunction.h:58
vtkColorTransferFunction::SetRange
virtual void SetRange(double, double)
Definition: vtkColorTransferFunction.h:315
vtkColorTransferFunction::AddRGBPoint
int AddRGBPoint(double x, double r, double g, double b)
vtkgl::v1
GLfloat GLfloat v1
Definition: vtkgl.h:12014
vtkColorTransferFunction::SetColorSpaceToLab
void SetColorSpaceToLab()
Definition: vtkColorTransferFunction.h:169
vtkColorTransferFunction::AddRGBPoint
int AddRGBPoint(double x, double r, double g, double b, double midpoint, double sharpness)
vtkColorTransferFunction::GetRedValue
double GetRedValue(double x)
VTK_CTF_LINEAR
#define VTK_CTF_LINEAR
Definition: vtkColorTransferFunction.h:54
vtkgl::val
GLuint GLfloat * val
Definition: vtkgl.h:13789
vtkSetClampMacro
#define vtkSetClampMacro(name, type, min, max)
Definition: vtkSetGet.h:143
vtkColorTransferFunction::GetBlueValue
double GetBlueValue(double x)
vtkGetVector3Macro
#define vtkGetVector3Macro(name, type)
Definition: vtkSetGet.h:304
vtkColorTransferFunction::SetScaleToLog10
void SetScaleToLog10()
Definition: vtkColorTransferFunction.h:183
vtkColorTransferFunction::SetColorSpaceToRGB
void SetColorSpaceToRGB()
Definition: vtkColorTransferFunction.h:167
vtkColorTransferFunction::SetScaleToLinear
void SetScaleToLinear()
Definition: vtkColorTransferFunction.h:182
vtkColorTransferFunction::AdjustRange
int AdjustRange(double range[2])
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkRenderingCoreModule.h
vtkColorTransferFunction::AddHSVPoint
int AddHSVPoint(double x, double h, double s, double v, double midpoint, double sharpness)
vtkScalarsToColors.h
vtkColorTransferFunction::TableSize
int TableSize
Definition: vtkColorTransferFunction.h:310
VTK_CTF_RGB
#define VTK_CTF_RGB
Definition: vtkColorTransferFunction.h:49
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkColorTransferFunction::AddRGBSegment
void AddRGBSegment(double x1, double r1, double g1, double b1, double x2, double r2, double g2, double b2)
vtkColorTransferFunction::UseAboveRangeColor
int UseAboveRangeColor
Definition: vtkColorTransferFunction.h:290
vtkScalarsToColors
Superclass for mapping scalar values to colors.
Definition: vtkScalarsToColors.h:63
vtkColorTransferFunction::Table
unsigned char * Table
Definition: vtkColorTransferFunction.h:306
vtkColorTransferFunction::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkgl::f
GLclampf f
Definition: vtkgl.h:14181
vtkScalarsToColors::GetColor
virtual void GetColor(double v, double rgb[3])
vtkColorTransferFunction::UseBelowRangeColor
int UseBelowRangeColor
Definition: vtkColorTransferFunction.h:284
vtkColorTransferFunction::RemoveAllPoints
void RemoveAllPoints()
vtkColorTransferFunction::GetGreenValue
double GetGreenValue(double x)
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkColorTransferFunction::ColorSpace
int ColorSpace
Definition: vtkColorTransferFunction.h:269
vtkgl::index
GLuint index
Definition: vtkgl.h:11983
vtkgl::r
GLdouble GLdouble GLdouble r
Definition: vtkgl.h:11610
vtkgl::g
GLboolean GLboolean g
Definition: vtkgl.h:12312
vtkColorTransferFunction::RemovePoint
int RemovePoint(double x)
vtkColorTransferFunction::SetColorSpaceToHSV
void SetColorSpaceToHSV()
Definition: vtkColorTransferFunction.h:168
vtkColorTransferFunction::Clamping
int Clamping
Definition: vtkColorTransferFunction.h:266
vtkColorTransferFunction::SetNodeValue
int SetNodeValue(int index, double val[6])
vtkColorTransferFunction::GetNodeValue
int GetNodeValue(int index, double val[6])
vtkColorTransferFunction::SortAndUpdateRange
void SortAndUpdateRange()
vtkColorTransferFunction::AllowDuplicateScalars
int AllowDuplicateScalars
Definition: vtkColorTransferFunction.h:303
vtkColorTransferFunction::GetColor
void GetColor(double x, double rgb[3])
VTKRENDERINGCORE_EXPORT
#define VTKRENDERINGCORE_EXPORT
Definition: vtkRenderingCoreModule.h:15
VTK_CTF_LOG10
#define VTK_CTF_LOG10
Definition: vtkColorTransferFunction.h:55
vtkColorTransferFunction::Function
double * Function
Definition: vtkColorTransferFunction.h:293
vtkColorTransferFunction::GetIndexedColor
virtual void GetIndexedColor(vtkIdType idx, double rgba[4])
VTK_CTF_DIVERGING
#define VTK_CTF_DIVERGING
Definition: vtkColorTransferFunction.h:52
vtkColorTransferFunction::ShallowCopy
void ShallowCopy(vtkColorTransferFunction *f)
vtkColorTransferFunction::AddHSVSegment
void AddHSVSegment(double x1, double h1, double s1, double v1, double x2, double h2, double s2, double v2)
vtkColorTransferFunction::MapScalarsThroughTable2
virtual void MapScalarsThroughTable2(void *input, unsigned char *output, int inputDataType, int numberOfValues, int inputIncrement, int outputIncrement)
vtkgl::size
GLsizeiptr size
Definition: vtkgl.h:11843
VTK_CTF_HSV
#define VTK_CTF_HSV
Definition: vtkColorTransferFunction.h:50