VTK  9.2.6
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 =========================================================================*/
46 #ifndef vtkVolume_h
47 #define vtkVolume_h
48 
49 #include "vtkProp3D.h"
50 #include "vtkRenderingCoreModule.h" // For export macro
51 
52 class vtkRenderer;
53 class vtkPropCollection;
55 class vtkWindow;
56 class vtkVolumeProperty;
58 
59 class VTKRENDERINGCORE_EXPORT vtkVolume : public vtkProp3D
60 {
61 public:
62  vtkTypeMacro(vtkVolume, vtkProp3D);
63  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
70  static vtkVolume* New();
71 
73 
77  vtkGetObjectMacro(Mapper, vtkAbstractVolumeMapper);
79 
81 
84  virtual void SetProperty(vtkVolumeProperty* property);
87 
93  void GetVolumes(vtkPropCollection* vc) override;
94 
98  void Update();
99 
101 
105  double* GetBounds() VTK_SIZEHINT(6) override;
106  void GetBounds(double bounds[6]) { this->vtkProp3D::GetBounds(bounds); }
107  double GetMinXBound();
108  double GetMaxXBound();
109  double GetMinYBound();
110  double GetMaxYBound();
111  double GetMinZBound();
112  double GetMaxZBound();
114 
118  vtkMTimeType GetMTime() override;
119 
127 
131  void ShallowCopy(vtkProp* prop) override;
132 
141  int RenderVolumetricGeometry(vtkViewport* viewport) override;
142 
150 
157 
163  float* GetScalarOpacityArray() { return this->GetScalarOpacityArray(0); }
164 
170  float* GetGradientOpacityArray() { return this->GetGradientOpacityArray(0); }
171 
176  float* GetGrayArray(int);
177  float* GetGrayArray() { return this->GetGrayArray(0); }
178 
183  float* GetRGBArray(int);
184  float* GetRGBArray() { return this->GetRGBArray(0); }
185 
192 
197  float GetArraySize() { return static_cast<float>(this->ArraySize); }
198 
204 
209  void UpdateScalarOpacityforSampleSize(vtkRenderer* ren, float sample_distance);
210 
218  bool GetSupportsSelection() override { return true; }
219 
220 protected:
222  ~vtkVolume() override;
223 
226 
227  // The rgb transfer function array - for unsigned char data this
228  // is 256 elements, for short or unsigned short it is 65536 elements
229  // This is a sample at each scalar value of the rgb transfer
230  // function. A time stamp is kept to know when it needs rebuilding
231  float* RGBArray[VTK_MAX_VRCOMP];
232  vtkTimeStamp RGBArrayMTime[VTK_MAX_VRCOMP];
233 
234  // The gray transfer function array - for unsigned char data this
235  // is 256 elements, for short or unsigned short it is 65536 elements
236  // This is a sample at each scalar value of the gray transfer
237  // function. A time stamp is kept to know when it needs rebuilding
238  float* GrayArray[VTK_MAX_VRCOMP];
239  vtkTimeStamp GrayArrayMTime[VTK_MAX_VRCOMP];
240 
241  // The scalar opacity transfer function array - for unsigned char data this
242  // is 256 elements, for short or unsigned short it is 65536 elements
243  // This is a sample at each scalar value of the opacity transfer
244  // function. A time stamp is kept to know when it needs rebuilding
245  float* ScalarOpacityArray[VTK_MAX_VRCOMP];
246  vtkTimeStamp ScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
247 
248  // The corrected scalar opacity transfer function array - this is identical
249  // to the opacity transfer function array when the step size is 1.
250  // In other cases, it is corrected to reflect the new material thickness
251  // modelled by a step size different than 1.
252  float* CorrectedScalarOpacityArray[VTK_MAX_VRCOMP];
253  vtkTimeStamp CorrectedScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
254 
255  // CorrectedStepSize is the step size currently modelled by
256  // CorrectedArray. It is used to determine when the
257  // CorrectedArray needs to be updated to match SampleDistance
258  // in the volume mapper.
260 
261  // Number of elements in the rgb, gray, and opacity transfer function arrays
263 
264  // The magnitude of gradient opacity transfer function array
265  float GradientOpacityArray[VTK_MAX_VRCOMP][256];
266  float GradientOpacityConstant[VTK_MAX_VRCOMP];
267  vtkTimeStamp GradientOpacityArrayMTime[VTK_MAX_VRCOMP];
268 
269  // Function to compute screen coverage of this volume
271 
272 private:
273  vtkVolume(const vtkVolume&) = delete;
274  void operator=(const vtkVolume&) = delete;
275 };
276 
277 #endif
Abstract class for a volume mapper.
a simple class to control print indentation
Definition: vtkIndent.h:49
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:59
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:82
record modification and/or execution time
Definition: vtkTimeStamp.h:45
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:60
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:218
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:177
float GetGradientOpacityConstant()
Definition: vtkVolume.h:191
~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:224
float CorrectedStepSize
Definition: vtkVolume.h:259
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:262
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:184
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:225
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:170
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:163
float GetArraySize()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
Definition: vtkVolume.h:197
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:156
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:287
#define VTK_SIZEHINT(...)