VTK  9.1.0
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=========================================================================*/
130#ifndef vtkVolume_h
131#define vtkVolume_h
132
133#include "vtkProp3D.h"
134#include "vtkRenderingCoreModule.h" // For export macro
135
136class vtkRenderer;
139class vtkWindow;
142
143class VTKRENDERINGCORE_EXPORT vtkVolume : public vtkProp3D
144{
145public:
146 vtkTypeMacro(vtkVolume, vtkProp3D);
147 void PrintSelf(ostream& os, vtkIndent indent) override;
148
154 static vtkVolume* New();
155
157
161 vtkGetObjectMacro(Mapper, vtkAbstractVolumeMapper);
163
165
168 virtual void SetProperty(vtkVolumeProperty* property);
171
177 void GetVolumes(vtkPropCollection* vc) override;
178
182 void Update();
183
185
189 double* GetBounds() VTK_SIZEHINT(6) override;
190 void GetBounds(double bounds[6]) { this->vtkProp3D::GetBounds(bounds); }
191 double GetMinXBound();
192 double GetMaxXBound();
193 double GetMinYBound();
194 double GetMaxYBound();
195 double GetMinZBound();
196 double GetMaxZBound();
198
203
211
215 void ShallowCopy(vtkProp* prop) override;
216
225 int RenderVolumetricGeometry(vtkViewport* viewport) override;
226
234
241
247 float* GetScalarOpacityArray() { return this->GetScalarOpacityArray(0); }
248
255
260 float* GetGrayArray(int);
261 float* GetGrayArray() { return this->GetGrayArray(0); }
262
267 float* GetRGBArray(int);
268 float* GetRGBArray() { return this->GetRGBArray(0); }
269
276
281 float GetArraySize() { return static_cast<float>(this->ArraySize); }
282
288
293 void UpdateScalarOpacityforSampleSize(vtkRenderer* ren, float sample_distance);
294
302 bool GetSupportsSelection() override { return true; }
303
304protected:
306 ~vtkVolume() override;
307
310
311 // The rgb 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 rgb transfer
314 // function. A time stamp is kept to know when it needs rebuilding
315 float* RGBArray[VTK_MAX_VRCOMP];
317
318 // The gray transfer function array - for unsigned char data this
319 // is 256 elements, for short or unsigned short it is 65536 elements
320 // This is a sample at each scalar value of the gray transfer
321 // function. A time stamp is kept to know when it needs rebuilding
322 float* GrayArray[VTK_MAX_VRCOMP];
324
325 // The scalar opacity transfer function array - for unsigned char data this
326 // is 256 elements, for short or unsigned short it is 65536 elements
327 // This is a sample at each scalar value of the opacity transfer
328 // function. A time stamp is kept to know when it needs rebuilding
329 float* ScalarOpacityArray[VTK_MAX_VRCOMP];
330 vtkTimeStamp ScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
331
332 // The corrected scalar opacity transfer function array - this is identical
333 // to the opacity transfer function array when the step size is 1.
334 // In other cases, it is corrected to reflect the new material thickness
335 // modelled by a step size different than 1.
336 float* CorrectedScalarOpacityArray[VTK_MAX_VRCOMP];
337 vtkTimeStamp CorrectedScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
338
339 // CorrectedStepSize is the step size currently modelled by
340 // CorrectedArray. It is used to determine when the
341 // CorrectedArray needs to be updated to match SampleDistance
342 // in the volume mapper.
344
345 // Number of elements in the rgb, gray, and opacity transfer function arrays
347
348 // The magnitude of gradient opacity transfer function array
349 float GradientOpacityArray[VTK_MAX_VRCOMP][256];
350 float GradientOpacityConstant[VTK_MAX_VRCOMP];
351 vtkTimeStamp GradientOpacityArrayMTime[VTK_MAX_VRCOMP];
352
353 // Function to compute screen coverage of this volume
355
356private:
357 vtkVolume(const vtkVolume&) = delete;
358 void operator=(const vtkVolume&) = delete;
359};
360
361#endif
Abstract class for a volume mapper.
a simple class to control print indentation
Definition: vtkIndent.h:113
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:93
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:76
abstract specification for renderers
Definition: vtkRenderer.h:182
record modification and/or execution time
Definition: vtkTimeStamp.h:52
abstract specification for Viewports
Definition: vtkViewport.h:47
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:144
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:302
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:275
~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:308
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:343
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:247
float * GetRGBArray()
Definition: vtkVolume.h:268
float * GetCorrectedScalarOpacityArray()
Definition: vtkVolume.h:240
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:254
int ArraySize
Definition: vtkVolume.h:346
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:309
virtual vtkVolumeProperty * GetProperty()
Set/Get the volume property.
float * GetGrayArray()
Definition: vtkVolume.h:261
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:281
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:39
#define VTK_MAX_VRCOMP
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define VTK_SIZEHINT(...)