VTK  9.3.20241006
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
114#ifndef vtkVolume_h
115#define vtkVolume_h
116
117#include "vtkProp3D.h"
118#include "vtkRenderingCoreModule.h" // For export macro
119#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
120
121VTK_ABI_NAMESPACE_BEGIN
122class vtkRenderer;
125class vtkWindow;
128
129class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkVolume : public vtkProp3D
130{
131public:
132 vtkTypeMacro(vtkVolume, vtkProp3D);
133 void PrintSelf(ostream& os, vtkIndent indent) override;
134
140 static vtkVolume* New();
141
143
147 vtkGetObjectMacro(Mapper, vtkAbstractVolumeMapper);
149
151
154 virtual void SetProperty(vtkVolumeProperty* property);
157
163 void GetVolumes(vtkPropCollection* vc) override;
164
168 void Update();
169
171
175 double* GetBounds() VTK_SIZEHINT(6) override;
176 void GetBounds(double bounds[6]) { this->vtkProp3D::GetBounds(bounds); }
177 double GetMinXBound();
178 double GetMaxXBound();
179 double GetMinYBound();
180 double GetMaxYBound();
181 double GetMinZBound();
182 double GetMaxZBound();
184
189
197
201 void ShallowCopy(vtkProp* prop) override;
202
211 int RenderVolumetricGeometry(vtkViewport* viewport) override;
212
220
227
233 float* GetScalarOpacityArray() { return this->GetScalarOpacityArray(0); }
234
241
246 float* GetGrayArray(int);
247 float* GetGrayArray() { return this->GetGrayArray(0); }
248
253 float* GetRGBArray(int);
254 float* GetRGBArray() { return this->GetRGBArray(0); }
255
262
267 float GetArraySize() { return static_cast<float>(this->ArraySize); }
268
274
279 void UpdateScalarOpacityforSampleSize(vtkRenderer* ren, float sample_distance);
280
288 bool GetSupportsSelection() override { return true; }
289
290protected:
292 ~vtkVolume() override;
293
296
297 // The rgb transfer function array - for unsigned char data this
298 // is 256 elements, for short or unsigned short it is 65536 elements
299 // This is a sample at each scalar value of the rgb transfer
300 // function. A time stamp is kept to know when it needs rebuilding
301 float* RGBArray[VTK_MAX_VRCOMP];
303
304 // The gray transfer function array - for unsigned char data this
305 // is 256 elements, for short or unsigned short it is 65536 elements
306 // This is a sample at each scalar value of the gray transfer
307 // function. A time stamp is kept to know when it needs rebuilding
308 float* GrayArray[VTK_MAX_VRCOMP];
310
311 // The scalar opacity transfer function array - for unsigned char data this
312 // is 256 elements, for short or unsigned short it is 65536 elements
313 // This is a sample at each scalar value of the opacity transfer
314 // function. A time stamp is kept to know when it needs rebuilding
315 float* ScalarOpacityArray[VTK_MAX_VRCOMP];
316 vtkTimeStamp ScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
317
318 // The corrected scalar opacity transfer function array - this is identical
319 // to the opacity transfer function array when the step size is 1.
320 // In other cases, it is corrected to reflect the new material thickness
321 // modelled by a step size different than 1.
322 float* CorrectedScalarOpacityArray[VTK_MAX_VRCOMP];
323 vtkTimeStamp CorrectedScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
324
325 // CorrectedStepSize is the step size currently modelled by
326 // CorrectedArray. It is used to determine when the
327 // CorrectedArray needs to be updated to match SampleDistance
328 // in the volume mapper.
330
331 // Number of elements in the rgb, gray, and opacity transfer function arrays
333
334 // The magnitude of gradient opacity transfer function array
335 float GradientOpacityArray[VTK_MAX_VRCOMP][256];
336 float GradientOpacityConstant[VTK_MAX_VRCOMP];
337 vtkTimeStamp GradientOpacityArrayMTime[VTK_MAX_VRCOMP];
338
339 // Function to compute screen coverage of this volume
341
342private:
343 vtkVolume(const vtkVolume&) = delete;
344 void operator=(const vtkVolume&) = delete;
345};
346
347VTK_ABI_NAMESPACE_END
348#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
record modification and/or execution time
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:130
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.
double ComputeScreenCoverage(vtkViewport *vp)
bool GetSupportsSelection() override
Used by vtkHardwareSelector to determine if the prop supports hardware selection.
Definition vtkVolume.h:288
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 GetGradientOpacityConstant()
Definition vtkVolume.h:261
~vtkVolume() override
float * GetGrayArray(int)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
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:294
static vtkVolume * New()
Creates a Volume with the following defaults: origin(0,0,0) position=(0,0,0) scale=1 visibility=1 pic...
float CorrectedStepSize
Definition vtkVolume.h:329
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.
float * GetScalarOpacityArray()
Definition vtkVolume.h:233
float * GetRGBArray()
Definition vtkVolume.h:254
float * GetCorrectedScalarOpacityArray()
Definition vtkVolume.h:226
double GetMinYBound()
Get the bounds - either all six at once (xmin, xmax, ymin, ymax, zmin, zmax) or one at a time.
float * GetGradientOpacityArray()
Definition vtkVolume.h:240
int ArraySize
Definition vtkVolume.h:332
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
float * GetGradientOpacityArray(int)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
double GetMinXBound()
Get the bounds - either all six at once (xmin, xmax, ymin, ymax, zmin, zmax) or one at a time.
float * GetCorrectedScalarOpacityArray(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...
float * GetScalarOpacityArray(int)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
vtkVolumeProperty * Property
Definition vtkVolume.h:295
virtual vtkVolumeProperty * GetProperty()
Set/Get the volume property.
float * GetGrayArray()
Definition vtkVolume.h:247
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 * GetRGBArray(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.
float GetArraySize()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
Definition vtkVolume.h:267
double GetMaxYBound()
Get the bounds - either all six at once (xmin, xmax, ymin, ymax, zmin, zmax) or one at a time.
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
#define VTK_MAX_VRCOMP
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO