VTK
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 =========================================================================*/
37 #ifndef vtkVolume_h
38 #define vtkVolume_h
39 
40 #include "vtkRenderingCoreModule.h" // For export macro
41 #include "vtkProp3D.h"
42 
43 class vtkRenderer;
44 class vtkPropCollection;
46 class vtkWindow;
47 class vtkVolumeProperty;
49 
50 class VTKRENDERINGCORE_EXPORT vtkVolume : public vtkProp3D
51 {
52 public:
53  vtkTypeMacro(vtkVolume, vtkProp3D);
54  void PrintSelf(ostream& os, vtkIndent indent);
55 
61  static vtkVolume *New();
62 
64 
68  vtkGetObjectMacro(Mapper, vtkAbstractVolumeMapper);
70 
72 
75  void SetProperty(vtkVolumeProperty *property);
78 
85 
89  void Update();
90 
92 
96  double *GetBounds();
97  void GetBounds(double bounds[6])
98  { this->vtkProp3D::GetBounds(bounds); }
99  double GetMinXBound();
100  double GetMaxXBound();
101  double GetMinYBound();
102  double GetMaxYBound();
103  double GetMinZBound();
104  double GetMaxZBound();
106 
111 
119 
123  void ShallowCopy(vtkProp *prop);
124 
134 
142 
149  { return this->GetCorrectedScalarOpacityArray(0); }
150 
157  { return this->GetScalarOpacityArray(0); }
158 
165  { return this->GetGradientOpacityArray(0); }
166 
171  float *GetGrayArray(int);
172  float *GetGrayArray()
173  { return this->GetGrayArray(0); }
174 
179  float *GetRGBArray(int);
180  float *GetRGBArray()
181  { return this->GetRGBArray(0); }
182 
189  { return this->GetGradientOpacityConstant(0); }
190 
195  float GetArraySize()
196  { return static_cast<float>(this->ArraySize); }
197 
203 
209  float sample_distance);
210 
215  virtual bool GetSupportsSelection()
216  { return true; }
217 
218 protected:
221 
224 
225  // The rgb transfer function array - for unsigned char data this
226  // is 256 elements, for short or unsigned short it is 65536 elements
227  // This is a sample at each scalar value of the rgb transfer
228  // function. A time stamp is kept to know when it needs rebuilding
229  float *RGBArray[VTK_MAX_VRCOMP];
230  vtkTimeStamp RGBArrayMTime[VTK_MAX_VRCOMP];
231 
232  // The gray transfer function array - for unsigned char data this
233  // is 256 elements, for short or unsigned short it is 65536 elements
234  // This is a sample at each scalar value of the gray transfer
235  // function. A time stamp is kept to know when it needs rebuilding
236  float *GrayArray[VTK_MAX_VRCOMP];
237  vtkTimeStamp GrayArrayMTime[VTK_MAX_VRCOMP];
238 
239  // The scalar opacity transfer function array - for unsigned char data this
240  // is 256 elements, for short or unsigned short it is 65536 elements
241  // This is a sample at each scalar value of the opacity transfer
242  // function. A time stamp is kept to know when it needs rebuilding
243  float *ScalarOpacityArray[VTK_MAX_VRCOMP];
244  vtkTimeStamp ScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
245 
246  // The corrected scalar opacity transfer function array - this is identical
247  // to the opacity transfer function array when the step size is 1.
248  // In other cases, it is corrected to reflect the new material thickness
249  // modelled by a step size different than 1.
250  float *CorrectedScalarOpacityArray[VTK_MAX_VRCOMP];
251  vtkTimeStamp CorrectedScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
252 
253  // CorrectedStepSize is the step size currently modelled by
254  // CorrectedArray. It is used to determine when the
255  // CorrectedArray needs to be updated to match SampleDistance
256  // in the volume mapper.
258 
259  // Number of elements in the rgb, gray, and opacity transfer function arrays
261 
262  // The magnitude of gradient opacity transfer function array
263  float GradientOpacityArray[VTK_MAX_VRCOMP][256];
264  float GradientOpacityConstant[VTK_MAX_VRCOMP];
265  vtkTimeStamp GradientOpacityArrayMTime[VTK_MAX_VRCOMP];
266 
267  // Function to compute screen coverage of this volume
269 
270 private:
271  vtkVolume(const vtkVolume&) VTK_DELETE_FUNCTION;
272  void operator=(const vtkVolume&) VTK_DELETE_FUNCTION;
273 };
274 
275 #endif
Abstract class for a volume mapper.
a simple class to control print indentation
Definition: vtkIndent.h:40
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:47
virtual double * GetBounds()=0
Get the bounds for this Prop as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
a list of Props
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:48
abstract specification for renderers
Definition: vtkRenderer.h:64
record modification and/or execution time
Definition: vtkTimeStamp.h:36
abstract specification for Viewports
Definition: vtkViewport.h:48
a list of volumes
represents the common properties for rendering a volume.
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:51
vtkMTimeType GetMTime()
Return the MTime also considering the property etc.
void UpdateTransferFunctions(vtkRenderer *ren)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
double GetMaxZBound()
vtkVolumeProperty * GetProperty()
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)
double GetMaxXBound()
float * GetGrayArray()
Definition: vtkVolume.h:172
float GetGradientOpacityConstant()
Definition: vtkVolume.h:188
vtkAbstractVolumeMapper * Mapper
Definition: vtkVolume.h:222
void ReleaseGraphicsResources(vtkWindow *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
float CorrectedStepSize
Definition: vtkVolume.h:257
float * GetCorrectedScalarOpacityArray(int)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
int RenderVolumetricGeometry(vtkViewport *viewport)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
double * GetBounds()
Get the bounds - either all six at once (xmin, xmax, ymin, ymax, zmin, zmax) or one at a time.
void GetBounds(double bounds[6])
Definition: vtkVolume.h:97
void SetProperty(vtkVolumeProperty *property)
Set/Get the volume property.
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...
void SetMapper(vtkAbstractVolumeMapper *mapper)
Set/Get the volume mapper.
double GetMinYBound()
int ArraySize
Definition: vtkVolume.h:260
float * GetRGBArray(int)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
void GetVolumes(vtkPropCollection *vc)
For some exporters and other other operations we must be able to collect all the actors or volumes.
vtkMTimeType GetRedrawMTime()
Return the mtime of anything that would cause the rendered image to appear differently.
virtual bool GetSupportsSelection()
Used by vtkHardwareSelector to determine if the prop supports hardware selection.
Definition: vtkVolume.h:215
float * GetRGBArray()
Definition: vtkVolume.h:180
double GetMinXBound()
float * GetGradientOpacityArray(int)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
vtkVolumeProperty * Property
Definition: vtkVolume.h:223
void Update()
Update the volume rendering pipeline by updating the volume mapper.
double GetMinZBound()
float * GetGradientOpacityArray()
Definition: vtkVolume.h:164
float * GetScalarOpacityArray(int)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
float * GetScalarOpacityArray()
Definition: vtkVolume.h:156
float GetArraySize()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
Definition: vtkVolume.h:195
float * GetGrayArray(int)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
double GetMaxYBound()
float * GetCorrectedScalarOpacityArray()
Definition: vtkVolume.h:148
void ShallowCopy(vtkProp *prop)
Shallow copy of this vtkVolume.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
#define VTK_MAX_VRCOMP
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248