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 
51 class vtkLookupTable;
54 
56 {
57 public:
60  void PrintSelf(ostream& os, vtkIndent indent);
61 
62  int IsOpaque();
63 
65 
70  void SetIndexedColor(unsigned int index, const double rgb[3])
71  { this->SetIndexedColor(index, rgb[0], rgb[1], rgb[2]); }
72  void SetIndexedColor(unsigned int index, double r, double g, double b);
74 
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);
153 
155  double* GetRGBPoints();
156 
161  virtual void SetAlpha(double alpha);
162 
163 
165 
168  virtual void SetNanColor(double r, double g, double b);
169  virtual void SetNanColor(double rgb[3]) {
170  this->SetNanColor(rgb[0], rgb[1], rgb[2]);
171  }
173 
174 
176 
178  virtual int UsingLogScale()
179  { return this->UseLogScale; }
181 
184 
186 
187  virtual void SetScalarOpacityFunction(vtkPiecewiseFunction *function);
188  virtual vtkPiecewiseFunction* GetScalarOpacityFunction() const;
190 
192 
193  vtkSetMacro(EnableOpacityMapping, bool)
194  vtkGetMacro(EnableOpacityMapping, bool)
195  vtkBooleanMacro(EnableOpacityMapping, bool)
197 
199  virtual unsigned long GetMTime();
200 
201 protected:
203  ~vtkDiscretizableColorTransferFunction();
204 
205  int Discretize;
206  int UseLogScale;
207 
208  vtkIdType NumberOfValues;
209  vtkLookupTable* LookupTable;
210 
212 
213  bool EnableOpacityMapping;
214  vtkSmartPointer<vtkPiecewiseFunction> ScalarOpacityFunction;
215  unsigned long ScalarOpacityFunctionObserverId;
216 
217  void MapDataArrayToOpacity(
218  vtkDataArray *scalars, int component, vtkUnsignedCharArray* colors);
219 
220 private:
221  vtkDiscretizableColorTransferFunction(const vtkDiscretizableColorTransferFunction&); // Not implemented.
222  void operator=(const vtkDiscretizableColorTransferFunction&); // Not implemented.
223  template<typename T, typename VectorGetter>
224  void MapVectorToOpacity (
225  VectorGetter getter, T* scalars, int component,
226  int numberOfComponents, vtkIdType numberOfTuples, unsigned char* colors);
227  template<template<class> class VectorGetter>
228  void AllTypesMapVectorToOpacity (
229  int scalarType,
230  void* scalarsPtr, int component,
231  int numberOfComponents, vtkIdType numberOfTuples, unsigned char* colors);
232 
233 
234  // Pointer used by GetRGBPoints().
235  double* Data;
236 
237  class vtkInternals;
238  vtkInternals* Internals;
239 };
240 
241 #endif
GLboolean GLboolean GLboolean b
Definition: vtkgl.h:12312
vtkTimeStamp BuildTime
const GLdouble * v
Definition: vtkgl.h:11595
virtual vtkIdType GetNumberOfAvailableColors()
GLuint index
Definition: vtkgl.h:11983
Defines a 1D piecewise function.
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
record modification and/or execution time
Definition: vtkTimeStamp.h:34
static vtkColorTransferFunction * New()
map scalar values into colors via a lookup table
virtual void SetAlpha(double alpha)
virtual unsigned char * MapValue(double v)
GLuint GLuint GLsizei count
Definition: vtkgl.h:11315
Hold a reference to a vtkObjectBase instance.
int vtkIdType
Definition: vtkType.h:268
GLdouble GLdouble GLdouble r
Definition: vtkgl.h:11610
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
virtual void SetNanColor(double, double, double)
void PrintSelf(ostream &os, vtkIndent indent)
virtual double GetOpacity(double v)
virtual int IsOpaque()
virtual void GetIndexedColor(vtkIdType idx, double rgba[4])
a simple class to control print indentation
Definition: vtkIndent.h:38
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:53
dynamic, self-adjusting array of unsigned char
a combination of vtkColorTransferFunction and vtkLookupTable.
virtual vtkUnsignedCharArray * MapScalars(vtkDataArray *scalars, int colorMode, int component)
Defines a transfer function for mapping a property to an RGB color value.
GLboolean GLboolean g
Definition: vtkgl.h:12312
#define VTKRENDERINGCORE_EXPORT
virtual void Build()
void SetIndexedColor(unsigned int index, const double rgb[3])
#define vtkBooleanMacro(name, type)
Definition: vtkSetGet.h:234
GLclampf GLclampf GLclampf alpha
Definition: vtkgl.h:11313
#define vtkSetMacro(name, type)
Definition: vtkSetGet.h:69