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 
55 #ifndef vtkVolumeProperty_h
56 #define vtkVolumeProperty_h
57 
58 #include "vtkRenderingCoreModule.h" // For export macro
59 #include "vtkObject.h"
60 
62 class vtkImageData;
64 class vtkTimeStamp;
65 
66 class VTKRENDERINGCORE_EXPORT vtkVolumeProperty : public vtkObject
67 {
68 public:
69  static vtkVolumeProperty *New();
70  vtkTypeMacro(vtkVolumeProperty, vtkObject);
71  void PrintSelf(ostream& os, vtkIndent indent) override;
72  void DeepCopy(vtkVolumeProperty *p);
73 
78  vtkMTimeType GetMTime() override;
79 
81 
102  vtkSetClampMacro(IndependentComponents, int, 0, 1);
103  vtkGetMacro(IndependentComponents, int);
104  vtkBooleanMacro(IndependentComponents, int);
106 
108 
112  vtkSetClampMacro(InterpolationType, int,
114  vtkGetMacro(InterpolationType, int);
116  { this->SetInterpolationType(VTK_NEAREST_INTERPOLATION); }
118  { this->SetInterpolationType(VTK_LINEAR_INTERPOLATION); }
119  const char *GetInterpolationTypeAsString(void);
121 
123 
127  virtual void SetComponentWeight(int index, double value);
128  virtual double GetComponentWeight(int index);
130 
136  void SetColor(int index, vtkPiecewiseFunction *function);
138  { this->SetColor(0, function); }
139 
146  void SetColor(int index, vtkColorTransferFunction *function);
148  { this->SetColor(0, function); }
149 
154  int GetColorChannels(int index);
156  { return this->GetColorChannels(0); }
157 
163  vtkPiecewiseFunction *GetGrayTransferFunction(int index);
165  { return this->GetGrayTransferFunction(0); }
166 
172  vtkColorTransferFunction *GetRGBTransferFunction(int index);
174  { return this->GetRGBTransferFunction(0); }
175 
180  void SetScalarOpacity(int index, vtkPiecewiseFunction *function);
182  { this->SetScalarOpacity(0, function); }
183 
189  vtkPiecewiseFunction *GetScalarOpacity(int index);
191  { return this->GetScalarOpacity(0); }
192 
194 
200  void SetScalarOpacityUnitDistance(int index, double distance);
201  void SetScalarOpacityUnitDistance(double distance)
202  { this->SetScalarOpacityUnitDistance(0, distance); }
203  double GetScalarOpacityUnitDistance(int index);
205  { return this->GetScalarOpacityUnitDistance(0); }
207 
208 
213  void SetGradientOpacity(int index, vtkPiecewiseFunction *function);
215  { this->SetGradientOpacity(0, function); }
216 
218 
224  void SetTransferFunction2D(int index, vtkImageData* function);
226  {
227  this->SetTransferFunction2D(0, function);
228  };
229 
230  vtkImageData* GetTransferFunction2D(int index);
232  {
233  return this->GetTransferFunction2D(0);
234  };
235 
244  {
245  TF_1D = 0,
246  TF_2D
247  };
248 
249  vtkSetClampMacro(TransferFunctionMode, int, 0, 1)
250  vtkGetMacro(TransferFunctionMode, int)
252 
261  vtkPiecewiseFunction *GetGradientOpacity(int index);
262  vtkPiecewiseFunction *GetGradientOpacity()
263  { return this->GetGradientOpacity(0); }
264 
266 
273  virtual void SetDisableGradientOpacity(int index, int value);
275  { this->SetDisableGradientOpacity(0, value); }
276  virtual void DisableGradientOpacityOn(int index )
277  { this->SetDisableGradientOpacity(index, 1); }
279  { this->DisableGradientOpacityOn(0); }
281  { this->SetDisableGradientOpacity(index, 0); }
283  { this->DisableGradientOpacityOff(0); }
284  virtual int GetDisableGradientOpacity(int index);
286  { return this->GetDisableGradientOpacity(0); }
287  vtkPiecewiseFunction *GetStoredGradientOpacity(int index);
289  { return this->GetStoredGradientOpacity(0); }
291 
298  bool HasGradientOpacity(int index = 0) {
299  switch(this->TransferFunctionMode) {
300  case TF_1D: return (this->GradientOpacity[index] != nullptr);
301  case TF_2D: return true;
302  }
303  return false;
304  }
305 
307 
327  void SetShade(int index, int value);
328  void SetShade(int value)
329  { this->SetShade(0,value); }
330  int GetShade(int index);
331  int GetShade()
332  { return this->GetShade(0); }
333  void ShadeOn(int index);
334  void ShadeOn()
335  { this->ShadeOn(0); }
336  void ShadeOff(int index);
337  void ShadeOff()
338  { this->ShadeOff(0); }
340 
342 
345  void SetAmbient(int index, double value);
346  void SetAmbient(double value)
347  { this->SetAmbient(0, value); }
348  double GetAmbient(int index);
349  double GetAmbient()
350  { return this->GetAmbient(0); }
352 
354 
357  void SetDiffuse(int index, double value);
358  void SetDiffuse(double value)
359  { this->SetDiffuse(0, value); }
360  double GetDiffuse(int index);
361  double GetDiffuse()
362  { return this->GetDiffuse(0); }
364 
366 
369  void SetSpecular(int index, double value);
370  void SetSpecular(double value)
371  { this->SetSpecular(0, value); }
372  double GetSpecular(int index);
373  double GetSpecular()
374  { return this->GetSpecular(0); }
376 
378 
381  void SetSpecularPower(int index, double value);
382  void SetSpecularPower(double value)
383  { this->SetSpecularPower(0, value); }
384  double GetSpecularPower(int index);
386  { return this->GetSpecularPower(0); }
388 
396  void UpdateMTimes();
397 
402  vtkTimeStamp GetGradientOpacityMTime(int index);
404  { return this->GetGradientOpacityMTime(0); }
405 
410  vtkTimeStamp GetScalarOpacityMTime(int index);
412  { return this->GetScalarOpacityMTime(0); }
413 
418  vtkTimeStamp GetRGBTransferFunctionMTime(int index);
420  { return this->GetRGBTransferFunctionMTime(0); }
421 
426  vtkTimeStamp GetGrayTransferFunctionMTime(int index);
428  { return this->GetGrayTransferFunctionMTime(0); }
429 
430 protected:
432  ~vtkVolumeProperty() override;
433 
438  vtkTimeStamp GetTransferFunction2DMTime(int index);
440  {
441  return this->GetTransferFunction2DMTime(0);
442  }
443 
444  virtual void CreateDefaultGradientOpacity(int index);
445 
447  double ComponentWeight[VTK_MAX_VRCOMP];
448 
450 
451  int ColorChannels[VTK_MAX_VRCOMP];
452 
453  vtkPiecewiseFunction *GrayTransferFunction[VTK_MAX_VRCOMP];
454  vtkTimeStamp GrayTransferFunctionMTime[VTK_MAX_VRCOMP];
455 
457  vtkTimeStamp RGBTransferFunctionMTime[VTK_MAX_VRCOMP];
458 
460  vtkTimeStamp ScalarOpacityMTime[VTK_MAX_VRCOMP];
461  double ScalarOpacityUnitDistance[VTK_MAX_VRCOMP];
462 
464  vtkTimeStamp GradientOpacityMTime[VTK_MAX_VRCOMP];
465 
466  vtkPiecewiseFunction *DefaultGradientOpacity[VTK_MAX_VRCOMP];
467  int DisableGradientOpacity[VTK_MAX_VRCOMP];
468 
470  vtkImageData* TransferFunction2D[VTK_MAX_VRCOMP];
471  vtkTimeStamp TransferFunction2DMTime[VTK_MAX_VRCOMP];
472 
473  int Shade[VTK_MAX_VRCOMP];
474  double Ambient[VTK_MAX_VRCOMP];
475  double Diffuse[VTK_MAX_VRCOMP];
476  double Specular[VTK_MAX_VRCOMP];
477  double SpecularPower[VTK_MAX_VRCOMP];
478 
479 private:
480  vtkVolumeProperty(const vtkVolumeProperty&) = delete;
481  void operator=(const vtkVolumeProperty&) = delete;
482 };
483 
485 
489 {
491  {
492  return "Nearest Neighbor";
493  }
495  {
496  return "Linear";
497  }
498  return "Unknown";
499 }
501 
502 #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:59
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:35
#define VTK_LINEAR_INTERPOLATION
void SetScalarOpacity(vtkPiecewiseFunction *function)
double GetSpecular()
Set/Get the specular lighting coefficient.
vtkImageData * GetTransferFunction2D()
Color-opacity transfer function mode.
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
TransferMode
Color-opacity transfer function mode.
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:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
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.
void SetInterpolationTypeToNearest()
Set the interpolation type for sampling a volume.
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.
vtkTimeStamp GetTransferFunction2DMTime()
void SetTransferFunction2D(vtkImageData *function)
Color-opacity transfer function mode.
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.
double GetAmbient()
Set/Get the ambient lighting coefficient.
double GetSpecularPower()
Set/Get the specular power.