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 
67  void SetMapper(vtkAbstractVolumeMapper *mapper);
68  vtkGetObjectMacro(Mapper, vtkAbstractVolumeMapper);
70 
72 
75  void SetProperty(vtkVolumeProperty *property);
76  vtkVolumeProperty *GetProperty();
78 
84  void GetVolumes(vtkPropCollection *vc);
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 
133  int RenderVolumetricGeometry(vtkViewport *viewport);
134 
142 
147  float *GetCorrectedScalarOpacityArray(int);
149  { return this->GetCorrectedScalarOpacityArray(0); }
150 
155  float *GetScalarOpacityArray(int);
157  { return this->GetScalarOpacityArray(0); }
158 
163  float *GetGradientOpacityArray(int);
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 
187  float GetGradientOpacityConstant(int);
189  { return this->GetGradientOpacityConstant(0); }
190 
195  float GetArraySize()
196  { return static_cast<float>(this->ArraySize); }
197 
202  void UpdateTransferFunctions(vtkRenderer *ren);
203 
208  void UpdateScalarOpacityforSampleSize(vtkRenderer *ren,
209  float sample_distance);
210 
215  virtual bool GetSupportsSelection()
216  { return true; }
217 
218 protected:
219  vtkVolume();
220  ~vtkVolume();
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
268  double ComputeScreenCoverage(vtkViewport *vp);
269 
270 private:
271  vtkVolume(const vtkVolume&) VTK_DELETE_FUNCTION;
272  void operator=(const vtkVolume&) VTK_DELETE_FUNCTION;
273 };
274 
275 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:50
float GetArraySize()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
Definition: vtkVolume.h:195
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:50
float CorrectedStepSize
Definition: vtkVolume.h:257
void GetBounds(double bounds[6])
Get the bounds - either all six at once (xmin, xmax, ymin, ymax, zmin, zmax) or one at a time...
Definition: vtkVolume.h:97
abstract specification for Viewports
Definition: vtkViewport.h:47
int ArraySize
Definition: vtkVolume.h:260
vtkVolumeProperty * Property
Definition: vtkVolume.h:223
record modification and/or execution time
Definition: vtkTimeStamp.h:35
Abstract class for a volume mapper.
abstract specification for renderers
Definition: vtkRenderer.h:63
virtual void Update()
Updates the extensions string.
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:46
#define VTK_MAX_VRCOMP
float * GetGradientOpacityArray()
Definition: vtkVolume.h:164
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248
a list of Props
virtual void ReleaseGraphicsResources(vtkWindow *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
Definition: vtkProp.h:303
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
virtual vtkMTimeType GetRedrawMTime()
Return the mtime of anything that would cause the rendered image to appear differently.
Definition: vtkProp.h:111
virtual int RenderVolumetricGeometry(vtkViewport *)
Definition: vtkProp.h:226
void ShallowCopy(vtkProp *prop)
Shallow copy of this vtkProp3D.
a simple class to control print indentation
Definition: vtkIndent.h:39
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
float * GetRGBArray()
Definition: vtkVolume.h:180
virtual void GetVolumes(vtkPropCollection *)
Definition: vtkProp.h:63
a list of volumes
float GetGradientOpacityConstant()
Definition: vtkVolume.h:188
float * GetGrayArray()
Definition: vtkVolume.h:172
represents the common properties for rendering a volume.
vtkMTimeType GetMTime()
Get the vtkProp3D's mtime.
virtual double * GetBounds()=0
Return a reference to the Prop3D's composite transform.
float * GetScalarOpacityArray()
Definition: vtkVolume.h:156
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
vtkAbstractVolumeMapper * Mapper
Definition: vtkVolume.h:222
float * GetCorrectedScalarOpacityArray()
Definition: vtkVolume.h:148
virtual bool GetSupportsSelection()
Used by vtkHardwareSelector to determine if the prop supports hardware selection. ...
Definition: vtkVolume.h:215