VTK  9.3.20240329
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 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
110 
111 VTK_ABI_NAMESPACE_BEGIN
112 class vtkRenderer;
113 class vtkPropCollection;
114 class vtkVolumeCollection;
115 class vtkWindow;
116 class vtkVolumeProperty;
118 
119 class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkVolume : public vtkProp3D
120 {
121 public:
122  vtkTypeMacro(vtkVolume, vtkProp3D);
123  void PrintSelf(ostream& os, vtkIndent indent) override;
124 
130  static vtkVolume* New();
131 
133 
137  vtkGetObjectMacro(Mapper, vtkAbstractVolumeMapper);
139 
141 
144  virtual void SetProperty(vtkVolumeProperty* property);
147 
153  void GetVolumes(vtkPropCollection* vc) override;
154 
158  void Update();
159 
161 
165  double* GetBounds() VTK_SIZEHINT(6) override;
166  void GetBounds(double bounds[6]) { this->vtkProp3D::GetBounds(bounds); }
167  double GetMinXBound();
168  double GetMaxXBound();
169  double GetMinYBound();
170  double GetMaxYBound();
171  double GetMinZBound();
172  double GetMaxZBound();
174 
178  vtkMTimeType GetMTime() override;
179 
187 
191  void ShallowCopy(vtkProp* prop) override;
192 
201  int RenderVolumetricGeometry(vtkViewport* viewport) override;
202 
210 
217 
223  float* GetScalarOpacityArray() { return this->GetScalarOpacityArray(0); }
224 
230  float* GetGradientOpacityArray() { return this->GetGradientOpacityArray(0); }
231 
236  float* GetGrayArray(int);
237  float* GetGrayArray() { return this->GetGrayArray(0); }
238 
243  float* GetRGBArray(int);
244  float* GetRGBArray() { return this->GetRGBArray(0); }
245 
252 
257  float GetArraySize() { return static_cast<float>(this->ArraySize); }
258 
264 
269  void UpdateScalarOpacityforSampleSize(vtkRenderer* ren, float sample_distance);
270 
278  bool GetSupportsSelection() override { return true; }
279 
280 protected:
282  ~vtkVolume() override;
283 
286 
287  // The rgb transfer function array - for unsigned char data this
288  // is 256 elements, for short or unsigned short it is 65536 elements
289  // This is a sample at each scalar value of the rgb transfer
290  // function. A time stamp is kept to know when it needs rebuilding
291  float* RGBArray[VTK_MAX_VRCOMP];
292  vtkTimeStamp RGBArrayMTime[VTK_MAX_VRCOMP];
293 
294  // The gray transfer function array - for unsigned char data this
295  // is 256 elements, for short or unsigned short it is 65536 elements
296  // This is a sample at each scalar value of the gray transfer
297  // function. A time stamp is kept to know when it needs rebuilding
298  float* GrayArray[VTK_MAX_VRCOMP];
299  vtkTimeStamp GrayArrayMTime[VTK_MAX_VRCOMP];
300 
301  // The scalar opacity 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 opacity transfer
304  // function. A time stamp is kept to know when it needs rebuilding
305  float* ScalarOpacityArray[VTK_MAX_VRCOMP];
306  vtkTimeStamp ScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
307 
308  // The corrected scalar opacity transfer function array - this is identical
309  // to the opacity transfer function array when the step size is 1.
310  // In other cases, it is corrected to reflect the new material thickness
311  // modelled by a step size different than 1.
312  float* CorrectedScalarOpacityArray[VTK_MAX_VRCOMP];
313  vtkTimeStamp CorrectedScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
314 
315  // CorrectedStepSize is the step size currently modelled by
316  // CorrectedArray. It is used to determine when the
317  // CorrectedArray needs to be updated to match SampleDistance
318  // in the volume mapper.
320 
321  // Number of elements in the rgb, gray, and opacity transfer function arrays
323 
324  // The magnitude of gradient opacity transfer function array
325  float GradientOpacityArray[VTK_MAX_VRCOMP][256];
326  float GradientOpacityConstant[VTK_MAX_VRCOMP];
327  vtkTimeStamp GradientOpacityArrayMTime[VTK_MAX_VRCOMP];
328 
329  // Function to compute screen coverage of this volume
331 
332 private:
333  vtkVolume(const vtkVolume&) = delete;
334  void operator=(const vtkVolume&) = delete;
335 };
336 
337 VTK_ABI_NAMESPACE_END
338 #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:89
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:66
abstract specification for renderers
Definition: vtkRenderer.h:172
record modification and/or execution time
Definition: vtkTimeStamp.h:44
abstract specification for Viewports
Definition: vtkViewport.h:65
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:120
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:278
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:237
float GetGradientOpacityConstant()
Definition: vtkVolume.h:251
~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:284
float CorrectedStepSize
Definition: vtkVolume.h:319
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:322
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:244
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:285
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:230
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:223
float GetArraySize()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
Definition: vtkVolume.h:257
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:216
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:48
void GetBounds(T a, double bds[6])
#define VTK_MAX_VRCOMP
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO