VTK  9.3.20231204
vtkVolume.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
104 #ifndef vtkVolume_h
105 #define vtkVolume_h
106 
107 #include "vtkProp3D.h"
108 #include "vtkRenderingCoreModule.h" // For export macro
109 
110 VTK_ABI_NAMESPACE_BEGIN
111 class vtkRenderer;
112 class vtkPropCollection;
113 class vtkVolumeCollection;
114 class vtkWindow;
115 class vtkVolumeProperty;
117 
118 class VTKRENDERINGCORE_EXPORT vtkVolume : public vtkProp3D
119 {
120 public:
121  vtkTypeMacro(vtkVolume, vtkProp3D);
122  void PrintSelf(ostream& os, vtkIndent indent) override;
123 
129  static vtkVolume* New();
130 
132 
136  vtkGetObjectMacro(Mapper, vtkAbstractVolumeMapper);
138 
140 
143  virtual void SetProperty(vtkVolumeProperty* property);
146 
152  void GetVolumes(vtkPropCollection* vc) override;
153 
157  void Update();
158 
160 
164  double* GetBounds() VTK_SIZEHINT(6) override;
165  void GetBounds(double bounds[6]) { this->vtkProp3D::GetBounds(bounds); }
166  double GetMinXBound();
167  double GetMaxXBound();
168  double GetMinYBound();
169  double GetMaxYBound();
170  double GetMinZBound();
171  double GetMaxZBound();
173 
177  vtkMTimeType GetMTime() override;
178 
186 
190  void ShallowCopy(vtkProp* prop) override;
191 
200  int RenderVolumetricGeometry(vtkViewport* viewport) override;
201 
209 
216 
222  float* GetScalarOpacityArray() { return this->GetScalarOpacityArray(0); }
223 
229  float* GetGradientOpacityArray() { return this->GetGradientOpacityArray(0); }
230 
235  float* GetGrayArray(int);
236  float* GetGrayArray() { return this->GetGrayArray(0); }
237 
242  float* GetRGBArray(int);
243  float* GetRGBArray() { return this->GetRGBArray(0); }
244 
251 
256  float GetArraySize() { return static_cast<float>(this->ArraySize); }
257 
263 
268  void UpdateScalarOpacityforSampleSize(vtkRenderer* ren, float sample_distance);
269 
277  bool GetSupportsSelection() override { return true; }
278 
279 protected:
281  ~vtkVolume() override;
282 
285 
286  // The rgb transfer function array - for unsigned char data this
287  // is 256 elements, for short or unsigned short it is 65536 elements
288  // This is a sample at each scalar value of the rgb transfer
289  // function. A time stamp is kept to know when it needs rebuilding
290  float* RGBArray[VTK_MAX_VRCOMP];
291  vtkTimeStamp RGBArrayMTime[VTK_MAX_VRCOMP];
292 
293  // The gray transfer function array - for unsigned char data this
294  // is 256 elements, for short or unsigned short it is 65536 elements
295  // This is a sample at each scalar value of the gray transfer
296  // function. A time stamp is kept to know when it needs rebuilding
297  float* GrayArray[VTK_MAX_VRCOMP];
298  vtkTimeStamp GrayArrayMTime[VTK_MAX_VRCOMP];
299 
300  // The scalar opacity transfer function array - for unsigned char data this
301  // is 256 elements, for short or unsigned short it is 65536 elements
302  // This is a sample at each scalar value of the opacity transfer
303  // function. A time stamp is kept to know when it needs rebuilding
304  float* ScalarOpacityArray[VTK_MAX_VRCOMP];
305  vtkTimeStamp ScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
306 
307  // The corrected scalar opacity transfer function array - this is identical
308  // to the opacity transfer function array when the step size is 1.
309  // In other cases, it is corrected to reflect the new material thickness
310  // modelled by a step size different than 1.
311  float* CorrectedScalarOpacityArray[VTK_MAX_VRCOMP];
312  vtkTimeStamp CorrectedScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
313 
314  // CorrectedStepSize is the step size currently modelled by
315  // CorrectedArray. It is used to determine when the
316  // CorrectedArray needs to be updated to match SampleDistance
317  // in the volume mapper.
319 
320  // Number of elements in the rgb, gray, and opacity transfer function arrays
322 
323  // The magnitude of gradient opacity transfer function array
324  float GradientOpacityArray[VTK_MAX_VRCOMP][256];
325  float GradientOpacityConstant[VTK_MAX_VRCOMP];
326  vtkTimeStamp GradientOpacityArrayMTime[VTK_MAX_VRCOMP];
327 
328  // Function to compute screen coverage of this volume
330 
331 private:
332  vtkVolume(const vtkVolume&) = delete;
333  void operator=(const vtkVolume&) = delete;
334 };
335 
336 VTK_ABI_NAMESPACE_END
337 #endif
Abstract class for a volume mapper.
a simple class to control print indentation
Definition: vtkIndent.h:108
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:88
double * GetBounds() override=0
Return a reference to the Prop3D's composite transform.
an ordered list of Props
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:65
abstract specification for renderers
Definition: vtkRenderer.h:171
record modification and/or execution time
Definition: vtkTimeStamp.h:44
abstract specification for Viewports
Definition: vtkViewport.h:64
an ordered list of volumes
represents the common properties for rendering a volume.
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:119
void UpdateTransferFunctions(vtkRenderer *ren)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
vtkMTimeType GetRedrawMTime() override
Return the mtime of anything that would cause the rendered image to appear differently.
double GetMaxZBound()
Get the bounds - either all six at once (xmin, xmax, ymin, ymax, zmin, zmax) or one at a time.
static vtkVolume * New()
Creates a Volume with the following defaults: origin(0,0,0) position=(0,0,0) scale=1 visibility=1 pic...
double ComputeScreenCoverage(vtkViewport *vp)
bool GetSupportsSelection() override
Used by vtkHardwareSelector to determine if the prop supports hardware selection.
Definition: vtkVolume.h:277
double GetMaxXBound()
Get the bounds - either all six at once (xmin, xmax, ymin, ymax, zmin, zmax) or one at a time.
virtual void SetProperty(vtkVolumeProperty *property)
Set/Get the volume property.
float * GetGrayArray()
Definition: vtkVolume.h:236
float GetGradientOpacityConstant()
Definition: vtkVolume.h:250
~vtkVolume() override
void GetVolumes(vtkPropCollection *vc) override
For some exporters and other other operations we must be able to collect all the actors or volumes.
vtkAbstractVolumeMapper * Mapper
Definition: vtkVolume.h:283
float CorrectedStepSize
Definition: vtkVolume.h:318
float * GetCorrectedScalarOpacityArray(int)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
void UpdateScalarOpacityforSampleSize(vtkRenderer *ren, float sample_distance)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
float GetGradientOpacityConstant(int)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
vtkMTimeType GetMTime() override
Return the MTime also considering the property etc.
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkVolume.
void SetMapper(vtkAbstractVolumeMapper *mapper)
Set/Get the volume mapper.
double GetMinYBound()
Get the bounds - either all six at once (xmin, xmax, ymin, ymax, zmin, zmax) or one at a time.
int ArraySize
Definition: vtkVolume.h:321
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
float * GetRGBArray(int)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
float * GetRGBArray()
Definition: vtkVolume.h:243
double GetMinXBound()
Get the bounds - either all six at once (xmin, xmax, ymin, ymax, zmin, zmax) or one at a time.
float * GetGradientOpacityArray(int)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
int RenderVolumetricGeometry(vtkViewport *viewport) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
vtkVolumeProperty * Property
Definition: vtkVolume.h:284
void Update()
Update the volume rendering pipeline by updating the volume mapper.
double GetMinZBound()
Get the bounds - either all six at once (xmin, xmax, ymin, ymax, zmin, zmax) or one at a time.
float * GetGradientOpacityArray()
Definition: vtkVolume.h:229
float * GetScalarOpacityArray(int)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
virtual vtkVolumeProperty * GetProperty()
Set/Get the volume property.
float * GetScalarOpacityArray()
Definition: vtkVolume.h:222
float GetArraySize()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
Definition: vtkVolume.h:256
float * GetGrayArray(int)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
double * GetBounds() override
Get the bounds - either all six at once (xmin, xmax, ymin, ymax, zmin, zmax) or one at a time.
double GetMaxYBound()
Get the bounds - either all six at once (xmin, xmax, ymin, ymax, zmin, zmax) or one at a time.
float * GetCorrectedScalarOpacityArray()
Definition: vtkVolume.h:215
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:47
void GetBounds(T a, double bds[6])
#define VTK_MAX_VRCOMP
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
#define VTK_SIZEHINT(...)