VTK  9.1.0
vtkVolume.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkVolume.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 =========================================================================*/
120 #ifndef vtkVolume_h
121 #define vtkVolume_h
122 
123 #include "vtkProp3D.h"
124 #include "vtkRenderingCoreModule.h" // For export macro
125 
126 class vtkRenderer;
127 class vtkPropCollection;
128 class vtkVolumeCollection;
129 class vtkWindow;
130 class vtkVolumeProperty;
132 
133 class VTKRENDERINGCORE_EXPORT vtkVolume : public vtkProp3D
134 {
135 public:
136  vtkTypeMacro(vtkVolume, vtkProp3D);
137  void PrintSelf(ostream& os, vtkIndent indent) override;
138 
144  static vtkVolume* New();
145 
147 
151  vtkGetObjectMacro(Mapper, vtkAbstractVolumeMapper);
153 
155 
158  virtual void SetProperty(vtkVolumeProperty* property);
161 
167  void GetVolumes(vtkPropCollection* vc) override;
168 
172  void Update();
173 
175 
179  double* GetBounds() VTK_SIZEHINT(6) override;
180  void GetBounds(double bounds[6]) { this->vtkProp3D::GetBounds(bounds); }
181  double GetMinXBound();
182  double GetMaxXBound();
183  double GetMinYBound();
184  double GetMaxYBound();
185  double GetMinZBound();
186  double GetMaxZBound();
188 
192  vtkMTimeType GetMTime() override;
193 
201 
205  void ShallowCopy(vtkProp* prop) override;
206 
215  int RenderVolumetricGeometry(vtkViewport* viewport) override;
216 
224 
231 
237  float* GetScalarOpacityArray() { return this->GetScalarOpacityArray(0); }
238 
244  float* GetGradientOpacityArray() { return this->GetGradientOpacityArray(0); }
245 
250  float* GetGrayArray(int);
251  float* GetGrayArray() { return this->GetGrayArray(0); }
252 
257  float* GetRGBArray(int);
258  float* GetRGBArray() { return this->GetRGBArray(0); }
259 
266 
271  float GetArraySize() { return static_cast<float>(this->ArraySize); }
272 
278 
283  void UpdateScalarOpacityforSampleSize(vtkRenderer* ren, float sample_distance);
284 
292  bool GetSupportsSelection() override { return true; }
293 
294 protected:
296  ~vtkVolume() override;
297 
300 
301  // The rgb transfer function array - for unsigned char data this
302  // is 256 elements, for short or unsigned short it is 65536 elements
303  // This is a sample at each scalar value of the rgb transfer
304  // function. A time stamp is kept to know when it needs rebuilding
305  float* RGBArray[VTK_MAX_VRCOMP];
306  vtkTimeStamp RGBArrayMTime[VTK_MAX_VRCOMP];
307 
308  // The gray transfer function array - for unsigned char data this
309  // is 256 elements, for short or unsigned short it is 65536 elements
310  // This is a sample at each scalar value of the gray transfer
311  // function. A time stamp is kept to know when it needs rebuilding
312  float* GrayArray[VTK_MAX_VRCOMP];
313  vtkTimeStamp GrayArrayMTime[VTK_MAX_VRCOMP];
314 
315  // The scalar opacity transfer function array - for unsigned char data this
316  // is 256 elements, for short or unsigned short it is 65536 elements
317  // This is a sample at each scalar value of the opacity transfer
318  // function. A time stamp is kept to know when it needs rebuilding
319  float* ScalarOpacityArray[VTK_MAX_VRCOMP];
320  vtkTimeStamp ScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
321 
322  // The corrected scalar opacity transfer function array - this is identical
323  // to the opacity transfer function array when the step size is 1.
324  // In other cases, it is corrected to reflect the new material thickness
325  // modelled by a step size different than 1.
326  float* CorrectedScalarOpacityArray[VTK_MAX_VRCOMP];
327  vtkTimeStamp CorrectedScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
328 
329  // CorrectedStepSize is the step size currently modelled by
330  // CorrectedArray. It is used to determine when the
331  // CorrectedArray needs to be updated to match SampleDistance
332  // in the volume mapper.
334 
335  // Number of elements in the rgb, gray, and opacity transfer function arrays
337 
338  // The magnitude of gradient opacity transfer function array
339  float GradientOpacityArray[VTK_MAX_VRCOMP][256];
340  float GradientOpacityConstant[VTK_MAX_VRCOMP];
341  vtkTimeStamp GradientOpacityArrayMTime[VTK_MAX_VRCOMP];
342 
343  // Function to compute screen coverage of this volume
345 
346 private:
347  vtkVolume(const vtkVolume&) = delete;
348  void operator=(const vtkVolume&) = delete;
349 };
350 
351 #endif
vtkVolume::GetMaxZBound
double GetMaxZBound()
Get the bounds - either all six at once (xmin, xmax, ymin, ymax, zmin, zmax) or one at a time.
vtkVolumeCollection
an ordered list of volumes
Definition: vtkVolumeCollection.h:36
vtkVolume::ArraySize
int ArraySize
Definition: vtkVolume.h:336
vtkVolume
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:134
vtkVolume::ShallowCopy
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkVolume.
vtkVolume::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
vtkProp3D
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:93
vtkVolume::GetBounds
double * GetBounds() override
Get the bounds - either all six at once (xmin, xmax, ymin, ymax, zmin, zmax) or one at a time.
vtkVolume::GetArraySize
float GetArraySize()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
Definition: vtkVolume.h:271
vtkVolume::GetMaxXBound
double GetMaxXBound()
Get the bounds - either all six at once (xmin, xmax, ymin, ymax, zmin, zmax) or one at a time.
vtkVolume::GetScalarOpacityArray
float * GetScalarOpacityArray()
Definition: vtkVolume.h:237
vtkVolume::vtkVolume
vtkVolume()
vtkVolume::Update
void Update()
Update the volume rendering pipeline by updating the volume mapper.
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:52
vtkVolume::GetRGBArray
float * GetRGBArray()
Definition: vtkVolume.h:258
vtkVolume::GetMinYBound
double GetMinYBound()
Get the bounds - either all six at once (xmin, xmax, ymin, ymax, zmin, zmax) or one at a time.
vtkVolume::UpdateTransferFunctions
void UpdateTransferFunctions(vtkRenderer *ren)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
vtkVolume::GetMinZBound
double GetMinZBound()
Get the bounds - either all six at once (xmin, xmax, ymin, ymax, zmin, zmax) or one at a time.
vtkVolume::GetScalarOpacityArray
float * GetScalarOpacityArray(int)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
vtkVolume::Property
vtkVolumeProperty * Property
Definition: vtkVolume.h:299
vtkVolume::GetGrayArray
float * GetGrayArray()
Definition: vtkVolume.h:251
vtkVolume::GetRedrawMTime
vtkMTimeType GetRedrawMTime() override
Return the mtime of anything that would cause the rendered image to appear differently.
vtkProp3D::GetBounds
double * GetBounds() override=0
Return a reference to the Prop3D's composite transform.
vtkVolume::GetProperty
virtual vtkVolumeProperty * GetProperty()
Set/Get the volume property.
vtkVolume::CorrectedStepSize
float CorrectedStepSize
Definition: vtkVolume.h:333
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
vtkVolume::GetMaxYBound
double GetMaxYBound()
Get the bounds - either all six at once (xmin, xmax, ymin, ymax, zmin, zmax) or one at a time.
vtkVolume::GetVolumes
void GetVolumes(vtkPropCollection *vc) override
For some exporters and other other operations we must be able to collect all the actors or volumes.
vtkVolume::SetProperty
virtual void SetProperty(vtkVolumeProperty *property)
Set/Get the volume property.
vtkVolume::GetCorrectedScalarOpacityArray
float * GetCorrectedScalarOpacityArray(int)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:48
vtkVolume::GetGradientOpacityArray
float * GetGradientOpacityArray()
Definition: vtkVolume.h:244
vtkBlockSortHelper::GetBounds
void GetBounds(T a, double bds[6])
Definition: vtkBlockSortHelper.h:37
vtkVolume::RenderVolumetricGeometry
int RenderVolumetricGeometry(vtkViewport *viewport) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
vtkVolume::~vtkVolume
~vtkVolume() override
vtkVolume::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkVolume::GetMinXBound
double GetMinXBound()
Get the bounds - either all six at once (xmin, xmax, ymin, ymax, zmin, zmax) or one at a time.
vtkVolume::SetMapper
void SetMapper(vtkAbstractVolumeMapper *mapper)
Set/Get the volume mapper.
vtkVolume::Mapper
vtkAbstractVolumeMapper * Mapper
Definition: vtkVolume.h:298
vtkVolume::GetRGBArray
float * GetRGBArray(int)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
vtkVolume::New
static vtkVolume * New()
Creates a Volume with the following defaults: origin(0,0,0) position=(0,0,0) scale=1 visibility=1 pic...
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkVolume::GetGradientOpacityArray
float * GetGradientOpacityArray(int)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
vtkVolume::GetCorrectedScalarOpacityArray
float * GetCorrectedScalarOpacityArray()
Definition: vtkVolume.h:230
vtkVolume::ComputeScreenCoverage
double ComputeScreenCoverage(vtkViewport *vp)
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:76
vtkVolume::UpdateScalarOpacityforSampleSize
void UpdateScalarOpacityforSampleSize(vtkRenderer *ren, float sample_distance)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
vtkVolume::GetGrayArray
float * GetGrayArray(int)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
vtkAbstractVolumeMapper
Abstract class for a volume mapper.
Definition: vtkAbstractVolumeMapper.h:39
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:182
vtkVolume::GetMTime
vtkMTimeType GetMTime() override
Return the MTime also considering the property etc.
vtkVolume::GetSupportsSelection
bool GetSupportsSelection() override
Used by vtkHardwareSelector to determine if the prop supports hardware selection.
Definition: vtkVolume.h:292
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:85
vtkVolume::GetGradientOpacityConstant
float GetGradientOpacityConstant()
Definition: vtkVolume.h:265
vtkVolume::GetGradientOpacityConstant
float GetGradientOpacityConstant(int)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
vtkVolumeProperty
represents the common properties for rendering a volume.
Definition: vtkVolumeProperty.h:164
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
VTK_MAX_VRCOMP
#define VTK_MAX_VRCOMP
Definition: vtkSystemIncludes.h:105
vtkProp3D.h