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 
50 #ifndef vtkVolumeProperty_h
51 #define vtkVolumeProperty_h
52 
53 #include "vtkRenderingCoreModule.h" // For export macro
54 #include "vtkObject.h"
55 
57 class vtkTimeStamp;
59 
60 class VTKRENDERINGCORE_EXPORT vtkVolumeProperty : public vtkObject
61 {
62 public:
63  static vtkVolumeProperty *New();
64  vtkTypeMacro(vtkVolumeProperty, vtkObject);
65  void PrintSelf(ostream& os, vtkIndent indent);
66  void DeepCopy(vtkVolumeProperty *p);
67 
73 
75 
96  vtkSetClampMacro(IndependentComponents, int, 0, 1);
97  vtkGetMacro(IndependentComponents, int);
98  vtkBooleanMacro(IndependentComponents, int);
100 
102 
106  vtkSetClampMacro(InterpolationType, int,
108  vtkGetMacro(InterpolationType, int);
110  { this->SetInterpolationType(VTK_NEAREST_INTERPOLATION); }
112  { this->SetInterpolationType(VTK_LINEAR_INTERPOLATION); }
113  const char *GetInterpolationTypeAsString(void);
115 
117 
121  virtual void SetComponentWeight(int index, double value);
122  virtual double GetComponentWeight(int index);
124 
130  void SetColor(int index, vtkPiecewiseFunction *function);
132  { this->SetColor(0, function); }
133 
140  void SetColor(int index, vtkColorTransferFunction *function);
142  { this->SetColor(0, function); }
143 
148  int GetColorChannels(int index);
150  { return this->GetColorChannels(0); }
151 
157  vtkPiecewiseFunction *GetGrayTransferFunction(int index);
159  { return this->GetGrayTransferFunction(0); }
160 
166  vtkColorTransferFunction *GetRGBTransferFunction(int index);
168  { return this->GetRGBTransferFunction(0); }
169 
174  void SetScalarOpacity(int index, vtkPiecewiseFunction *function);
176  { this->SetScalarOpacity(0, function); }
177 
183  vtkPiecewiseFunction *GetScalarOpacity(int index);
185  { return this->GetScalarOpacity(0); }
186 
188 
194  void SetScalarOpacityUnitDistance(int index, double distance);
195  void SetScalarOpacityUnitDistance(double distance)
196  { this->SetScalarOpacityUnitDistance(0, distance); }
197  double GetScalarOpacityUnitDistance(int index);
199  { return this->GetScalarOpacityUnitDistance(0); }
201 
202 
207  void SetGradientOpacity(int index, vtkPiecewiseFunction *function);
209  { this->SetGradientOpacity(0, function); }
210 
219  vtkPiecewiseFunction *GetGradientOpacity(int index);
221  { return this->GetGradientOpacity(0); }
222 
224 
231  virtual void SetDisableGradientOpacity(int index, int value);
233  { this->SetDisableGradientOpacity(0, value); }
234  virtual void DisableGradientOpacityOn(int index )
235  { this->SetDisableGradientOpacity(index, 1); }
237  { this->DisableGradientOpacityOn(0); }
239  { this->SetDisableGradientOpacity(index, 0); }
241  { this->DisableGradientOpacityOff(0); }
242  virtual int GetDisableGradientOpacity(int index);
244  { return this->GetDisableGradientOpacity(0); }
245  vtkPiecewiseFunction *GetStoredGradientOpacity(int index);
247  { return this->GetStoredGradientOpacity(0); }
249 
256  bool HasGradientOpacity(int index=0) {
257  return (this->GradientOpacity[index] != NULL);
258  }
259 
261 
281  void SetShade(int index, int value);
282  void SetShade(int value)
283  { this->SetShade(0,value); }
284  int GetShade(int index);
285  int GetShade()
286  { return this->GetShade(0); }
287  void ShadeOn(int index);
288  void ShadeOn()
289  { this->ShadeOn(0); }
290  void ShadeOff(int index);
291  void ShadeOff()
292  { this->ShadeOff(0); }
294 
296 
299  void SetAmbient(int index, double value);
300  void SetAmbient(double value)
301  { this->SetAmbient(0, value); }
302  double GetAmbient(int index);
303  double GetAmbient()
304  { return this->GetAmbient(0); }
306 
308 
311  void SetDiffuse(int index, double value);
312  void SetDiffuse(double value)
313  { this->SetDiffuse(0, value); }
314  double GetDiffuse(int index);
315  double GetDiffuse()
316  { return this->GetDiffuse(0); }
318 
320 
323  void SetSpecular(int index, double value);
324  void SetSpecular(double value)
325  { this->SetSpecular(0, value); }
326  double GetSpecular(int index);
327  double GetSpecular()
328  { return this->GetSpecular(0); }
330 
332 
335  void SetSpecularPower(int index, double value);
336  void SetSpecularPower(double value)
337  { this->SetSpecularPower(0, value); }
338  double GetSpecularPower(int index);
340  { return this->GetSpecularPower(0); }
342 
350  void UpdateMTimes();
351 
356  vtkTimeStamp GetGradientOpacityMTime(int index);
358  { return this->GetGradientOpacityMTime(0); }
359 
364  vtkTimeStamp GetScalarOpacityMTime(int index);
366  { return this->GetScalarOpacityMTime(0); }
367 
372  vtkTimeStamp GetRGBTransferFunctionMTime(int index);
374  { return this->GetRGBTransferFunctionMTime(0); }
375 
380  vtkTimeStamp GetGrayTransferFunctionMTime(int index);
382  { return this->GetGrayTransferFunctionMTime(0); }
383 
384 protected:
387 
389  double ComponentWeight[VTK_MAX_VRCOMP];
390 
392 
393  int ColorChannels[VTK_MAX_VRCOMP];
394 
395  vtkPiecewiseFunction *GrayTransferFunction[VTK_MAX_VRCOMP];
396  vtkTimeStamp GrayTransferFunctionMTime[VTK_MAX_VRCOMP];
397 
399  vtkTimeStamp RGBTransferFunctionMTime[VTK_MAX_VRCOMP];
400 
402  vtkTimeStamp ScalarOpacityMTime[VTK_MAX_VRCOMP];
403  double ScalarOpacityUnitDistance[VTK_MAX_VRCOMP];
404 
406  vtkTimeStamp GradientOpacityMTime[VTK_MAX_VRCOMP];
407  vtkPiecewiseFunction *DefaultGradientOpacity[VTK_MAX_VRCOMP];
408  int DisableGradientOpacity[VTK_MAX_VRCOMP];
409 
410  int Shade[VTK_MAX_VRCOMP];
411  double Ambient[VTK_MAX_VRCOMP];
412  double Diffuse[VTK_MAX_VRCOMP];
413  double Specular[VTK_MAX_VRCOMP];
414  double SpecularPower[VTK_MAX_VRCOMP];
415 
416  virtual void CreateDefaultGradientOpacity(int index);
417 
418 private:
419  vtkVolumeProperty(const vtkVolumeProperty&) VTK_DELETE_FUNCTION;
420  void operator=(const vtkVolumeProperty&) VTK_DELETE_FUNCTION;
421 };
422 
424 
428 {
430  {
431  return "Nearest Neighbor";
432  }
434  {
435  return "Linear";
436  }
437  return "Unknown";
438 }
440 
441 #endif
vtkpiston::DeepCopy
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
vtkVolumeProperty::DisableGradientOpacityOn
virtual void DisableGradientOpacityOn(int index)
Definition: vtkVolumeProperty.h:234
vtkVolumeProperty::DisableGradientOpacityOff
virtual void DisableGradientOpacityOff()
Definition: vtkVolumeProperty.h:240
vtkVolumeProperty::GetSpecular
double GetSpecular()
Definition: vtkVolumeProperty.h:327
vtkVolumeProperty::SetScalarOpacityUnitDistance
void SetScalarOpacityUnitDistance(double distance)
Definition: vtkVolumeProperty.h:195
vtkVolumeProperty::GetGradientOpacity
vtkPiecewiseFunction * GetGradientOpacity()
Definition: vtkVolumeProperty.h:220
vtkX3D::value
@ value
Definition: vtkX3D.h:220
vtkVolumeProperty::GetGrayTransferFunction
vtkPiecewiseFunction * GetGrayTransferFunction()
Definition: vtkVolumeProperty.h:158
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkVolumeProperty::GetShade
int GetShade()
Definition: vtkVolumeProperty.h:285
vtkVolumeProperty::GetRGBTransferFunction
vtkColorTransferFunction * GetRGBTransferFunction()
Definition: vtkVolumeProperty.h:167
vtkVolumeProperty::SetSpecularPower
void SetSpecularPower(double value)
Definition: vtkVolumeProperty.h:336
vtkVolumeProperty::SetColor
void SetColor(vtkColorTransferFunction *function)
Definition: vtkVolumeProperty.h:141
vtkVolumeProperty::DisableGradientOpacityOn
virtual void DisableGradientOpacityOn()
Definition: vtkVolumeProperty.h:236
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:59
vtkVolumeProperty::GetRGBTransferFunctionMTime
vtkTimeStamp GetRGBTransferFunctionMTime()
Definition: vtkVolumeProperty.h:373
vtkVolumeProperty::SetScalarOpacity
void SetScalarOpacity(vtkPiecewiseFunction *function)
Definition: vtkVolumeProperty.h:175
VTK_NEAREST_INTERPOLATION
#define VTK_NEAREST_INTERPOLATION
Definition: vtkSystemIncludes.h:107
vtkColorTransferFunction
Defines a transfer function for mapping a property to an RGB color value.
Definition: vtkColorTransferFunction.h:58
vtkVolumeProperty::SetGradientOpacity
void SetGradientOpacity(vtkPiecewiseFunction *function)
Definition: vtkVolumeProperty.h:208
vtkVolumeProperty::GetScalarOpacity
vtkPiecewiseFunction * GetScalarOpacity()
Definition: vtkVolumeProperty.h:184
vtkVolumeProperty::GetScalarOpacityUnitDistance
double GetScalarOpacityUnitDistance()
Definition: vtkVolumeProperty.h:198
vtkMTimeType
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248
vtkVolumeProperty::GetScalarOpacityMTime
vtkTimeStamp GetScalarOpacityMTime()
Definition: vtkVolumeProperty.h:365
vtkVolumeProperty::InterpolationType
int InterpolationType
Definition: vtkVolumeProperty.h:391
vtkVolumeProperty::SetColor
void SetColor(vtkPiecewiseFunction *function)
Definition: vtkVolumeProperty.h:131
vtkVolumeProperty::HasGradientOpacity
bool HasGradientOpacity(int index=0)
Check whether or not we have the gradient opacity.
Definition: vtkVolumeProperty.h:256
vtkObject::GetMTime
virtual vtkMTimeType GetMTime()
Return this object's modified time.
vtkVolumeProperty::IndependentComponents
int IndependentComponents
Definition: vtkVolumeProperty.h:388
vtkVolumeProperty::GetStoredGradientOpacity
vtkPiecewiseFunction * GetStoredGradientOpacity()
Definition: vtkVolumeProperty.h:246
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkVolumeProperty::ShadeOff
void ShadeOff()
Definition: vtkVolumeProperty.h:291
vtkVolumeProperty::GetGrayTransferFunctionMTime
vtkTimeStamp GetGrayTransferFunctionMTime()
Definition: vtkVolumeProperty.h:381
vtkVolumeProperty::GetColorChannels
int GetColorChannels()
Definition: vtkVolumeProperty.h:149
VTK_LINEAR_INTERPOLATION
#define VTK_LINEAR_INTERPOLATION
Definition: vtkSystemIncludes.h:108
vtkVolumeProperty::SetDisableGradientOpacity
virtual void SetDisableGradientOpacity(int value)
Definition: vtkVolumeProperty.h:232
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkVolumeProperty::SetSpecular
void SetSpecular(double value)
Definition: vtkVolumeProperty.h:324
vtkVolumeProperty::GetInterpolationTypeAsString
const char * GetInterpolationTypeAsString(void)
Return the interpolation type as a descriptive character string.
Definition: vtkVolumeProperty.h:427
vtkObject.h
vtkPiecewiseFunction
Defines a 1D piecewise function.
Definition: vtkPiecewiseFunction.h:51
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkVolumeProperty::GetGradientOpacityMTime
vtkTimeStamp GetGradientOpacityMTime()
Definition: vtkVolumeProperty.h:357
vtkVolumeProperty::DisableGradientOpacityOff
virtual void DisableGradientOpacityOff(int index)
Definition: vtkVolumeProperty.h:238
vtkVolumeProperty::SetInterpolationTypeToNearest
void SetInterpolationTypeToNearest()
Definition: vtkVolumeProperty.h:109
vtkVolumeProperty::GetDisableGradientOpacity
virtual int GetDisableGradientOpacity()
Definition: vtkVolumeProperty.h:243
vtkVolumeProperty::SetShade
void SetShade(int value)
Definition: vtkVolumeProperty.h:282
vtkVolumeProperty::SetInterpolationTypeToLinear
void SetInterpolationTypeToLinear()
Definition: vtkVolumeProperty.h:111
vtkX3D::index
@ index
Definition: vtkX3D.h:246
vtkVolumeProperty::GetAmbient
double GetAmbient()
Definition: vtkVolumeProperty.h:303
vtkVolumeProperty::GetSpecularPower
double GetSpecularPower()
Definition: vtkVolumeProperty.h:339
vtkVolumeProperty::GetDiffuse
double GetDiffuse()
Definition: vtkVolumeProperty.h:315
vtkVolumeProperty
represents the common properties for rendering a volume.
Definition: vtkVolumeProperty.h:60
vtkVolumeProperty::ShadeOn
void ShadeOn()
Definition: vtkVolumeProperty.h:288
vtkVolumeProperty::SetAmbient
void SetAmbient(double value)
Definition: vtkVolumeProperty.h:300
VTK_MAX_VRCOMP
#define VTK_MAX_VRCOMP
Definition: vtkSystemIncludes.h:118
vtkVolumeProperty::SetDiffuse
void SetDiffuse(double value)
Definition: vtkVolumeProperty.h:312