VTK
vtkVolumeProperty.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkVolumeProperty.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 =========================================================================*/
15 
44 #ifndef vtkVolumeProperty_h
45 #define vtkVolumeProperty_h
46 
47 #include "vtkRenderingCoreModule.h" // For export macro
48 #include "vtkObject.h"
49 
51 class vtkTimeStamp;
53 
54 class VTKRENDERINGCORE_EXPORT vtkVolumeProperty : public vtkObject
55 {
56 public:
57  static vtkVolumeProperty *New();
58  vtkTypeMacro(vtkVolumeProperty, vtkObject);
59  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
60  void DeepCopy(vtkVolumeProperty *p);
61 
66  vtkMTimeType GetMTime() VTK_OVERRIDE;
67 
69 
90  vtkSetClampMacro(IndependentComponents, int, 0, 1);
91  vtkGetMacro(IndependentComponents, int);
92  vtkBooleanMacro(IndependentComponents, int);
94 
96 
100  vtkSetClampMacro(InterpolationType, int,
102  vtkGetMacro(InterpolationType, int);
103  void SetInterpolationTypeToNearest()
104  { this->SetInterpolationType(VTK_NEAREST_INTERPOLATION); }
106  { this->SetInterpolationType(VTK_LINEAR_INTERPOLATION); }
107  const char *GetInterpolationTypeAsString(void);
109 
111 
115  virtual void SetComponentWeight(int index, double value);
116  virtual double GetComponentWeight(int index);
118 
124  void SetColor(int index, vtkPiecewiseFunction *function);
126  { this->SetColor(0, function); }
127 
134  void SetColor(int index, vtkColorTransferFunction *function);
136  { this->SetColor(0, function); }
137 
142  int GetColorChannels(int index);
144  { return this->GetColorChannels(0); }
145 
151  vtkPiecewiseFunction *GetGrayTransferFunction(int index);
153  { return this->GetGrayTransferFunction(0); }
154 
160  vtkColorTransferFunction *GetRGBTransferFunction(int index);
162  { return this->GetRGBTransferFunction(0); }
163 
168  void SetScalarOpacity(int index, vtkPiecewiseFunction *function);
170  { this->SetScalarOpacity(0, function); }
171 
177  vtkPiecewiseFunction *GetScalarOpacity(int index);
179  { return this->GetScalarOpacity(0); }
180 
182 
188  void SetScalarOpacityUnitDistance(int index, double distance);
189  void SetScalarOpacityUnitDistance(double distance)
190  { this->SetScalarOpacityUnitDistance(0, distance); }
191  double GetScalarOpacityUnitDistance(int index);
193  { return this->GetScalarOpacityUnitDistance(0); }
195 
196 
201  void SetGradientOpacity(int index, vtkPiecewiseFunction *function);
203  { this->SetGradientOpacity(0, function); }
204 
213  vtkPiecewiseFunction *GetGradientOpacity(int index);
215  { return this->GetGradientOpacity(0); }
216 
218 
225  virtual void SetDisableGradientOpacity(int index, int value);
226  virtual void SetDisableGradientOpacity(int value)
227  { this->SetDisableGradientOpacity(0, value); }
228  virtual void DisableGradientOpacityOn(int index )
229  { this->SetDisableGradientOpacity(index, 1); }
231  { this->DisableGradientOpacityOn(0); }
232  virtual void DisableGradientOpacityOff(int index)
233  { this->SetDisableGradientOpacity(index, 0); }
235  { this->DisableGradientOpacityOff(0); }
236  virtual int GetDisableGradientOpacity(int index);
238  { return this->GetDisableGradientOpacity(0); }
239  vtkPiecewiseFunction *GetStoredGradientOpacity(int index);
241  { return this->GetStoredGradientOpacity(0); }
243 
250  bool HasGradientOpacity(int index=0) {
251  return (this->GradientOpacity[index] != NULL);
252  }
253 
255 
275  void SetShade(int index, int value);
276  void SetShade(int value)
277  { this->SetShade(0,value); }
278  int GetShade(int index);
279  int GetShade()
280  { return this->GetShade(0); }
281  void ShadeOn(int index);
282  void ShadeOn()
283  { this->ShadeOn(0); }
284  void ShadeOff(int index);
285  void ShadeOff()
286  { this->ShadeOff(0); }
288 
290 
293  void SetAmbient(int index, double value);
294  void SetAmbient(double value)
295  { this->SetAmbient(0, value); }
296  double GetAmbient(int index);
297  double GetAmbient()
298  { return this->GetAmbient(0); }
300 
302 
305  void SetDiffuse(int index, double value);
306  void SetDiffuse(double value)
307  { this->SetDiffuse(0, value); }
308  double GetDiffuse(int index);
309  double GetDiffuse()
310  { return this->GetDiffuse(0); }
312 
314 
317  void SetSpecular(int index, double value);
318  void SetSpecular(double value)
319  { this->SetSpecular(0, value); }
320  double GetSpecular(int index);
321  double GetSpecular()
322  { return this->GetSpecular(0); }
324 
326 
329  void SetSpecularPower(int index, double value);
330  void SetSpecularPower(double value)
331  { this->SetSpecularPower(0, value); }
332  double GetSpecularPower(int index);
334  { return this->GetSpecularPower(0); }
336 
344  void UpdateMTimes();
345 
350  vtkTimeStamp GetGradientOpacityMTime(int index);
352  { return this->GetGradientOpacityMTime(0); }
353 
358  vtkTimeStamp GetScalarOpacityMTime(int index);
360  { return this->GetScalarOpacityMTime(0); }
361 
366  vtkTimeStamp GetRGBTransferFunctionMTime(int index);
368  { return this->GetRGBTransferFunctionMTime(0); }
369 
374  vtkTimeStamp GetGrayTransferFunctionMTime(int index);
376  { return this->GetGrayTransferFunctionMTime(0); }
377 
378 protected:
380  ~vtkVolumeProperty() VTK_OVERRIDE;
381 
383  double ComponentWeight[VTK_MAX_VRCOMP];
384 
386 
387  int ColorChannels[VTK_MAX_VRCOMP];
388 
389  vtkPiecewiseFunction *GrayTransferFunction[VTK_MAX_VRCOMP];
390  vtkTimeStamp GrayTransferFunctionMTime[VTK_MAX_VRCOMP];
391 
393  vtkTimeStamp RGBTransferFunctionMTime[VTK_MAX_VRCOMP];
394 
396  vtkTimeStamp ScalarOpacityMTime[VTK_MAX_VRCOMP];
397  double ScalarOpacityUnitDistance[VTK_MAX_VRCOMP];
398 
400  vtkTimeStamp GradientOpacityMTime[VTK_MAX_VRCOMP];
401  vtkPiecewiseFunction *DefaultGradientOpacity[VTK_MAX_VRCOMP];
402  int DisableGradientOpacity[VTK_MAX_VRCOMP];
403 
404  int Shade[VTK_MAX_VRCOMP];
405  double Ambient[VTK_MAX_VRCOMP];
406  double Diffuse[VTK_MAX_VRCOMP];
407  double Specular[VTK_MAX_VRCOMP];
408  double SpecularPower[VTK_MAX_VRCOMP];
409 
410  virtual void CreateDefaultGradientOpacity(int index);
411 
412 private:
413  vtkVolumeProperty(const vtkVolumeProperty&) VTK_DELETE_FUNCTION;
414  void operator=(const vtkVolumeProperty&) VTK_DELETE_FUNCTION;
415 };
416 
418 
422 {
423  if (this->InterpolationType == VTK_NEAREST_INTERPOLATION)
424  {
425  return "Nearest Neighbor";
426  }
427  if (this->InterpolationType == VTK_LINEAR_INTERPOLATION)
428  {
429  return "Linear";
430  }
431  return "Unknown";
432 }
434 
435 #endif
int GetShade()
Set/Get the shading of a volume.
vtkColorTransferFunction * GetRGBTransferFunction()
virtual void DisableGradientOpacityOn()
Enable/Disable the gradient opacity function for the given component.
abstract base class for most VTK objects
Definition: vtkObject.h:53
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
double GetDiffuse()
Set/Get the diffuse lighting coefficient.
void SetAmbient(double value)
Set/Get the ambient lighting coefficient.
Defines a 1D piecewise function.
void SetSpecularPower(double value)
Set/Get the specular power.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:300
void SetColor(vtkColorTransferFunction *function)
vtkPiecewiseFunction * GetGrayTransferFunction()
record modification and/or execution time
Definition: vtkTimeStamp.h:32
#define VTK_LINEAR_INTERPOLATION
void SetScalarOpacity(vtkPiecewiseFunction *function)
double GetSpecular()
Set/Get the specular lighting coefficient.
void SetGradientOpacity(vtkPiecewiseFunction *function)
void SetColor(vtkPiecewiseFunction *function)
double GetScalarOpacityUnitDistance()
Set/Get the unit distance on which the scalar opacity transfer function is defined.
#define VTK_MAX_VRCOMP
vtkPiecewiseFunction * GetScalarOpacity()
vtkTimeStamp GetRGBTransferFunctionMTime()
const char * GetInterpolationTypeAsString(void)
Return the interpolation type as a descriptive character string.
vtkPiecewiseFunction * GetStoredGradientOpacity()
Enable/Disable the gradient opacity function for the given component.
vtkTimeStamp GetScalarOpacityMTime()
a simple class to control print indentation
Definition: vtkIndent.h:33
bool HasGradientOpacity(int index=0)
Check whether or not we have the gradient opacity.
vtkTimeStamp GetGrayTransferFunctionMTime()
void ShadeOff()
Set/Get the shading of a volume.
virtual vtkMTimeType GetMTime()
Return this object's modified time.
represents the common properties for rendering a volume.
virtual void SetDisableGradientOpacity(int value)
Enable/Disable the gradient opacity function for the given component.
void SetSpecular(double value)
Set/Get the specular lighting coefficient.
void SetShade(int value)
Set/Get the shading of a volume.
Defines a transfer function for mapping a property to an RGB color value.
void SetDiffuse(double value)
Set/Get the diffuse lighting coefficient.
void SetInterpolationTypeToLinear()
Set the interpolation type for sampling a volume.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual int GetDisableGradientOpacity()
Enable/Disable the gradient opacity function for the given component.
vtkTimeStamp GetGradientOpacityMTime()
virtual void DisableGradientOpacityOff(int index)
Enable/Disable the gradient opacity function for the given component.
virtual void DisableGradientOpacityOn(int index)
Enable/Disable the gradient opacity function for the given component.
#define VTK_NEAREST_INTERPOLATION
void ShadeOn()
Set/Get the shading of a volume.
virtual void DisableGradientOpacityOff()
Enable/Disable the gradient opacity function for the given component.
void SetScalarOpacityUnitDistance(double distance)
Set/Get the unit distance on which the scalar opacity transfer function is defined.
vtkPiecewiseFunction * GetGradientOpacity()
double GetAmbient()
Set/Get the ambient lighting coefficient.
double GetSpecularPower()
Set/Get the specular power.