VTK
vtkDiscretizableColorTransferFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDiscretizableColorTransferFunction.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 =========================================================================*/
44 #ifndef vtkDiscretizableColorTransferFunction_h
45 #define vtkDiscretizableColorTransferFunction_h
46 
47 #include "vtkRenderingCoreModule.h" // For export macro
49 #include "vtkSmartPointer.h" // for vtkSmartPointer
50 
52 class vtkLookupTable;
54 
56 {
57 public:
60  void PrintSelf(ostream& os, vtkIndent indent);
61 
63  int IsOpaque();
64 
66 
71  void SetIndexedColor(unsigned int index, const double rgb[3])
72  { this->SetIndexedColor(index, rgb[0], rgb[1], rgb[2]); }
73  void SetIndexedColor(unsigned int index, double r, double g, double b);
75 
86  virtual void GetIndexedColor(vtkIdType i, double rgba[4]);
87 
89 
92  void SetNumberOfIndexedColors(unsigned int count);
93  unsigned int GetNumberOfIndexedColors();
95 
100  virtual void Build();
101 
103 
107  vtkSetMacro(Discretize, int);
108  vtkGetMacro(Discretize, int);
109  vtkBooleanMacro(Discretize, int);
111 
113 
115  virtual void SetUseLogScale(int useLogScale);
116  vtkGetMacro(UseLogScale, int);
118 
120 
123  vtkSetMacro(NumberOfValues, vtkIdType);
124  vtkGetMacro(NumberOfValues, vtkIdType);
126 
129  virtual unsigned char *MapValue(double v);
130 
133  virtual void GetColor(double v, double rgb[3]);
134 
136  virtual double GetOpacity(double v);
137 
139 
150  virtual vtkUnsignedCharArray *MapScalars(vtkDataArray *scalars, int colorMode,
151  int component);
152  virtual vtkUnsignedCharArray *MapScalars(vtkAbstractArray *scalars, int colorMode,
153  int component);
155 
160 
165  virtual void SetAlpha(double alpha);
166 
168 
171  virtual void SetNanColor(double r, double g, double b);
172  virtual void SetNanColor(double rgb[3]) {
173  this->SetNanColor(rgb[0], rgb[1], rgb[2]);
174  }
176 
178 
180  virtual int UsingLogScale()
181  { return this->UseLogScale; }
183 
186 
188 
192 
194 
195  vtkSetMacro(EnableOpacityMapping, bool)
196  vtkGetMacro(EnableOpacityMapping, bool)
197  vtkBooleanMacro(EnableOpacityMapping, bool)
199 
201  virtual unsigned long GetMTime();
202 
203 protected:
206 
208  int Discretize;
209 
211  int UseLogScale;
212 
214  vtkIdType NumberOfValues;
215 
217  vtkLookupTable* LookupTable;
218 
220 
221  bool EnableOpacityMapping;
222  vtkSmartPointer<vtkPiecewiseFunction> ScalarOpacityFunction;
223 
224  void MapDataArrayToOpacity(
225  vtkDataArray *scalars, int component, vtkUnsignedCharArray* colors);
226 
227 private:
229  void operator=(const vtkDiscretizableColorTransferFunction&); // Not implemented.
230 
231  template<typename T, typename VectorGetter>
232  void MapVectorToOpacity (
233  VectorGetter getter, T* scalars, int component,
234  int numberOfComponents, vtkIdType numberOfTuples, unsigned char* colors);
235 
236  template<template<class> class VectorGetter>
237  void AllTypesMapVectorToOpacity (
238  int scalarType,
239  void* scalarsPtr, int component,
240  int numberOfComponents, vtkIdType numberOfTuples, unsigned char* colors);
241 
242  class vtkInternals;
243  vtkInternals* Internals;
244 };
245 
246 #endif
vtkDiscretizableColorTransferFunction::SetIndexedColor
void SetIndexedColor(unsigned int index, double r, double g, double b)
vtkDiscretizableColorTransferFunction::GetNumberOfIndexedColors
unsigned int GetNumberOfIndexedColors()
vtkgl::b
GLboolean GLboolean GLboolean b
Definition: vtkgl.h:12312
vtkX3D::component
@ component
Definition: vtkX3D.h:175
vtkDiscretizableColorTransferFunction::SetNumberOfIndexedColors
void SetNumberOfIndexedColors(unsigned int count)
vtkgl::count
GLuint GLuint GLsizei count
Definition: vtkgl.h:11315
vtkDiscretizableColorTransferFunction::GetRGBPoints
double * GetRGBPoints()
vtkIdType
int vtkIdType
Definition: vtkType.h:275
vtkDiscretizableColorTransferFunction::SetAlpha
virtual void SetAlpha(double alpha)
vtkDiscretizableColorTransferFunction::UsingLogScale
virtual int UsingLogScale()
Definition: vtkDiscretizableColorTransferFunction.h:180
vtkDiscretizableColorTransferFunction::GetOpacity
virtual double GetOpacity(double v)
vtkColorTransferFunction::SetNanColor
virtual void SetNanColor(double, double, double)
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkDiscretizableColorTransferFunction::IsOpaque
int IsOpaque()
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:49
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkSmartPointer
Hold a reference to a vtkObjectBase instance.
Definition: vtkSmartPointer.h:35
vtkgl::v
const GLdouble * v
Definition: vtkgl.h:11595
vtkDiscretizableColorTransferFunction::GetColor
virtual void GetColor(double v, double rgb[3])
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
vtkDiscretizableColorTransferFunction::New
static vtkDiscretizableColorTransferFunction * New()
vtkDiscretizableColorTransferFunction
a combination of vtkColorTransferFunction and vtkLookupTable.
Definition: vtkDiscretizableColorTransferFunction.h:56
vtkColorTransferFunction
Defines a transfer function for mapping a property to an RGB color value.
Definition: vtkColorTransferFunction.h:58
vtkDiscretizableColorTransferFunction::SetNanColor
virtual void SetNanColor(double r, double g, double b)
vtkDiscretizableColorTransferFunction::Build
virtual void Build()
vtkColorTransferFunction.h
vtkDiscretizableColorTransferFunction::SetNanColor
virtual void SetNanColor(double rgb[3])
Definition: vtkDiscretizableColorTransferFunction.h:172
vtkDiscretizableColorTransferFunction::MapScalars
virtual vtkUnsignedCharArray * MapScalars(vtkAbstractArray *scalars, int colorMode, int component)
vtkDiscretizableColorTransferFunction::GetNumberOfAvailableColors
virtual vtkIdType GetNumberOfAvailableColors()
vtkDiscretizableColorTransferFunction::GetScalarOpacityFunction
virtual vtkPiecewiseFunction * GetScalarOpacityFunction() const
vtkDiscretizableColorTransferFunction::MapScalars
virtual vtkUnsignedCharArray * MapScalars(vtkDataArray *scalars, int colorMode, int component)
vtkDiscretizableColorTransferFunction::SetUseLogScale
virtual void SetUseLogScale(int useLogScale)
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkDiscretizableColorTransferFunction::MapValue
virtual unsigned char * MapValue(double v)
vtkRenderingCoreModule.h
vtkSmartPointer.h
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkPiecewiseFunction
Defines a 1D piecewise function.
Definition: vtkPiecewiseFunction.h:51
vtkAbstractArray
Abstract superclass for all arrays.
Definition: vtkAbstractArray.h:65
vtkDiscretizableColorTransferFunction::SetScalarOpacityFunction
virtual void SetScalarOpacityFunction(vtkPiecewiseFunction *function)
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkLookupTable
map scalar values into colors via a lookup table
Definition: vtkLookupTable.h:74
vtkgl::alpha
GLclampf GLclampf GLclampf alpha
Definition: vtkgl.h:11313
VTK_LEGACY
#define VTK_LEGACY(method)
Definition: vtkSetGet.h:801
vtkgl::index
GLuint index
Definition: vtkgl.h:11983
vtkgl::r
GLdouble GLdouble GLdouble r
Definition: vtkgl.h:11610
vtkDiscretizableColorTransferFunction::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkgl::g
GLboolean GLboolean g
Definition: vtkgl.h:12312
VTKRENDERINGCORE_EXPORT
#define VTKRENDERINGCORE_EXPORT
Definition: vtkRenderingCoreModule.h:15
vtkDiscretizableColorTransferFunction::GetIndexedColor
virtual void GetIndexedColor(vtkIdType i, double rgba[4])
vtkDiscretizableColorTransferFunction::SetIndexedColor
void SetIndexedColor(unsigned int index, const double rgb[3])
Definition: vtkDiscretizableColorTransferFunction.h:71
BuildTime
vtkTimeStamp BuildTime
Definition: vtkOpenGLExtensionManager.h:327