VTK  9.0.1
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 =========================================================================*/
31 #ifndef vtkVolume_h
32 #define vtkVolume_h
33 
34 #include "vtkProp3D.h"
35 #include "vtkRenderingCoreModule.h" // For export macro
36 
37 class vtkRenderer;
38 class vtkPropCollection;
40 class vtkWindow;
41 class vtkVolumeProperty;
43 
44 class VTKRENDERINGCORE_EXPORT vtkVolume : public vtkProp3D
45 {
46 public:
47  vtkTypeMacro(vtkVolume, vtkProp3D);
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
55  static vtkVolume* New();
56 
58 
62  vtkGetObjectMacro(Mapper, vtkAbstractVolumeMapper);
64 
66 
69  virtual void SetProperty(vtkVolumeProperty* property);
72 
78  void GetVolumes(vtkPropCollection* vc) override;
79 
83  void Update();
84 
86 
90  double* GetBounds() VTK_SIZEHINT(6) override;
91  void GetBounds(double bounds[6]) { this->vtkProp3D::GetBounds(bounds); }
92  double GetMinXBound();
93  double GetMaxXBound();
94  double GetMinYBound();
95  double GetMaxYBound();
96  double GetMinZBound();
97  double GetMaxZBound();
99 
103  vtkMTimeType GetMTime() override;
104 
112 
116  void ShallowCopy(vtkProp* prop) override;
117 
126  int RenderVolumetricGeometry(vtkViewport* viewport) override;
127 
135 
142 
148  float* GetScalarOpacityArray() { return this->GetScalarOpacityArray(0); }
149 
155  float* GetGradientOpacityArray() { return this->GetGradientOpacityArray(0); }
156 
161  float* GetGrayArray(int);
162  float* GetGrayArray() { return this->GetGrayArray(0); }
163 
168  float* GetRGBArray(int);
169  float* GetRGBArray() { return this->GetRGBArray(0); }
170 
177 
182  float GetArraySize() { return static_cast<float>(this->ArraySize); }
183 
189 
194  void UpdateScalarOpacityforSampleSize(vtkRenderer* ren, float sample_distance);
195 
203  bool GetSupportsSelection() override { return true; }
204 
205 protected:
207  ~vtkVolume() override;
208 
211 
212  // The rgb transfer function array - for unsigned char data this
213  // is 256 elements, for short or unsigned short it is 65536 elements
214  // This is a sample at each scalar value of the rgb transfer
215  // function. A time stamp is kept to know when it needs rebuilding
216  float* RGBArray[VTK_MAX_VRCOMP];
217  vtkTimeStamp RGBArrayMTime[VTK_MAX_VRCOMP];
218 
219  // The gray transfer function array - for unsigned char data this
220  // is 256 elements, for short or unsigned short it is 65536 elements
221  // This is a sample at each scalar value of the gray transfer
222  // function. A time stamp is kept to know when it needs rebuilding
223  float* GrayArray[VTK_MAX_VRCOMP];
224  vtkTimeStamp GrayArrayMTime[VTK_MAX_VRCOMP];
225 
226  // The scalar opacity transfer function array - for unsigned char data this
227  // is 256 elements, for short or unsigned short it is 65536 elements
228  // This is a sample at each scalar value of the opacity transfer
229  // function. A time stamp is kept to know when it needs rebuilding
230  float* ScalarOpacityArray[VTK_MAX_VRCOMP];
231  vtkTimeStamp ScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
232 
233  // The corrected scalar opacity transfer function array - this is identical
234  // to the opacity transfer function array when the step size is 1.
235  // In other cases, it is corrected to reflect the new material thickness
236  // modelled by a step size different than 1.
237  float* CorrectedScalarOpacityArray[VTK_MAX_VRCOMP];
238  vtkTimeStamp CorrectedScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
239 
240  // CorrectedStepSize is the step size currently modelled by
241  // CorrectedArray. It is used to determine when the
242  // CorrectedArray needs to be updated to match SampleDistance
243  // in the volume mapper.
245 
246  // Number of elements in the rgb, gray, and opacity transfer function arrays
248 
249  // The magnitude of gradient opacity transfer function array
250  float GradientOpacityArray[VTK_MAX_VRCOMP][256];
251  float GradientOpacityConstant[VTK_MAX_VRCOMP];
252  vtkTimeStamp GradientOpacityArrayMTime[VTK_MAX_VRCOMP];
253 
254  // Function to compute screen coverage of this volume
256 
257 private:
258  vtkVolume(const vtkVolume&) = delete;
259  void operator=(const vtkVolume&) = delete;
260 };
261 
262 #endif
vtkVolume::GetMaxZBound
double GetMaxZBound()
vtkVolumeCollection
an ordered list of volumes
Definition: vtkVolumeCollection.h:36
vtkVolume::ArraySize
int ArraySize
Definition: vtkVolume.h:247
vtkVolume
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:45
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:44
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:182
vtkVolume::GetMaxXBound
double GetMaxXBound()
vtkVolume::GetScalarOpacityArray
float * GetScalarOpacityArray()
Definition: vtkVolume.h:148
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:33
vtkVolume::GetRGBArray
float * GetRGBArray()
Definition: vtkVolume.h:169
vtkVolume::GetMinYBound
double GetMinYBound()
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()
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:210
vtkVolume::GetGrayArray
float * GetGrayArray()
Definition: vtkVolume.h:162
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
Get the bounds for this Prop as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
vtkVolume::GetProperty
virtual vtkVolumeProperty * GetProperty()
vtkVolume::CorrectedStepSize
float CorrectedStepSize
Definition: vtkVolume.h:244
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
vtkVolume::GetMaxYBound
double GetMaxYBound()
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:45
vtkVolume::GetGradientOpacityArray
float * GetGradientOpacityArray()
Definition: vtkVolume.h:155
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:34
vtkVolume::GetMinXBound
double GetMinXBound()
vtkVolume::SetMapper
void SetMapper(vtkAbstractVolumeMapper *mapper)
Set/Get the volume mapper.
vtkVolume::Mapper
vtkAbstractVolumeMapper * Mapper
Definition: vtkVolume.h:209
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:45
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:141
vtkVolume::ComputeScreenCoverage
double ComputeScreenCoverage(vtkViewport *vp)
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:48
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:59
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:203
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:36
vtkVolume::GetGradientOpacityConstant
float GetGradientOpacityConstant()
Definition: vtkVolume.h:176
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:75
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293
VTK_MAX_VRCOMP
#define VTK_MAX_VRCOMP
Definition: vtkSystemIncludes.h:105
vtkProp3D.h