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 =========================================================================*/
31 #ifndef vtkVolume_h
32 #define vtkVolume_h
33 
34 #include "vtkRenderingCoreModule.h" // For export macro
35 #include "vtkProp3D.h"
36 
37 class vtkRenderer;
38 class vtkPropCollection;
40 class vtkWindow;
41 class vtkVolumeProperty;
43 
44 class VTKRENDERINGCORE_EXPORT vtkVolume : public vtkProp3D
45 {
46 public:
47  vtkTypeMacro(vtkVolume, vtkProp3D);
48  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
49 
55  static vtkVolume *New();
56 
58 
61  void SetMapper(vtkAbstractVolumeMapper *mapper);
62  vtkGetObjectMacro(Mapper, vtkAbstractVolumeMapper);
64 
66 
69  void SetProperty(vtkVolumeProperty *property);
70  vtkVolumeProperty *GetProperty();
72 
78  void GetVolumes(vtkPropCollection *vc) VTK_OVERRIDE;
79 
83  void Update();
84 
86 
90  double *GetBounds() VTK_OVERRIDE;
91  void GetBounds(double bounds[6])
92  { this->vtkProp3D::GetBounds(bounds); }
93  double GetMinXBound();
94  double GetMaxXBound();
95  double GetMinYBound();
96  double GetMaxYBound();
97  double GetMinZBound();
98  double GetMaxZBound();
100 
104  vtkMTimeType GetMTime() VTK_OVERRIDE;
105 
112  vtkMTimeType GetRedrawMTime() VTK_OVERRIDE;
113 
117  void ShallowCopy(vtkProp *prop) VTK_OVERRIDE;
118 
127  int RenderVolumetricGeometry(vtkViewport *viewport) VTK_OVERRIDE;
128 
135  void ReleaseGraphicsResources(vtkWindow *) VTK_OVERRIDE;
136 
141  float *GetCorrectedScalarOpacityArray(int);
143  { return this->GetCorrectedScalarOpacityArray(0); }
144 
149  float *GetScalarOpacityArray(int);
151  { return this->GetScalarOpacityArray(0); }
152 
157  float *GetGradientOpacityArray(int);
159  { return this->GetGradientOpacityArray(0); }
160 
165  float *GetGrayArray(int);
166  float *GetGrayArray()
167  { return this->GetGrayArray(0); }
168 
173  float *GetRGBArray(int);
174  float *GetRGBArray()
175  { return this->GetRGBArray(0); }
176 
181  float GetGradientOpacityConstant(int);
183  { return this->GetGradientOpacityConstant(0); }
184 
189  float GetArraySize()
190  { return static_cast<float>(this->ArraySize); }
191 
196  void UpdateTransferFunctions(vtkRenderer *ren);
197 
202  void UpdateScalarOpacityforSampleSize(vtkRenderer *ren,
203  float sample_distance);
204 
209  bool GetSupportsSelection() VTK_OVERRIDE
210  { return true; }
211 
212 protected:
213  vtkVolume();
214  ~vtkVolume() VTK_OVERRIDE;
215 
218 
219  // The rgb transfer function array - for unsigned char data this
220  // is 256 elements, for short or unsigned short it is 65536 elements
221  // This is a sample at each scalar value of the rgb transfer
222  // function. A time stamp is kept to know when it needs rebuilding
223  float *RGBArray[VTK_MAX_VRCOMP];
224  vtkTimeStamp RGBArrayMTime[VTK_MAX_VRCOMP];
225 
226  // The gray transfer function array - for unsigned char data this
227  // is 256 elements, for short or unsigned short it is 65536 elements
228  // This is a sample at each scalar value of the gray transfer
229  // function. A time stamp is kept to know when it needs rebuilding
230  float *GrayArray[VTK_MAX_VRCOMP];
231  vtkTimeStamp GrayArrayMTime[VTK_MAX_VRCOMP];
232 
233  // The scalar opacity transfer function array - for unsigned char data this
234  // is 256 elements, for short or unsigned short it is 65536 elements
235  // This is a sample at each scalar value of the opacity transfer
236  // function. A time stamp is kept to know when it needs rebuilding
237  float *ScalarOpacityArray[VTK_MAX_VRCOMP];
238  vtkTimeStamp ScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
239 
240  // The corrected scalar opacity transfer function array - this is identical
241  // to the opacity transfer function array when the step size is 1.
242  // In other cases, it is corrected to reflect the new material thickness
243  // modelled by a step size different than 1.
244  float *CorrectedScalarOpacityArray[VTK_MAX_VRCOMP];
245  vtkTimeStamp CorrectedScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
246 
247  // CorrectedStepSize is the step size currently modelled by
248  // CorrectedArray. It is used to determine when the
249  // CorrectedArray needs to be updated to match SampleDistance
250  // in the volume mapper.
252 
253  // Number of elements in the rgb, gray, and opacity transfer function arrays
255 
256  // The magnitude of gradient opacity transfer function array
257  float GradientOpacityArray[VTK_MAX_VRCOMP][256];
258  float GradientOpacityConstant[VTK_MAX_VRCOMP];
259  vtkTimeStamp GradientOpacityArrayMTime[VTK_MAX_VRCOMP];
260 
261  // Function to compute screen coverage of this volume
262  double ComputeScreenCoverage(vtkViewport *vp);
263 
264 private:
265  vtkVolume(const vtkVolume&) VTK_DELETE_FUNCTION;
266  void operator=(const vtkVolume&) VTK_DELETE_FUNCTION;
267 };
268 
269 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:44
float GetArraySize()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
Definition: vtkVolume.h:189
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:44
float CorrectedStepSize
Definition: vtkVolume.h:251
double * GetBounds() override=0
Return a reference to the Prop3D&#39;s composite transform.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:300
abstract specification for Viewports
Definition: vtkViewport.h:44
int ArraySize
Definition: vtkVolume.h:254
vtkVolumeProperty * Property
Definition: vtkVolume.h:217
record modification and/or execution time
Definition: vtkTimeStamp.h:32
Abstract class for a volume mapper.
abstract specification for renderers
Definition: vtkRenderer.h:57
virtual void Update()
Updates the extensions string.
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:43
#define VTK_MAX_VRCOMP
float * GetGradientOpacityArray()
Definition: vtkVolume.h:158
an ordered 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:297
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
virtual vtkMTimeType GetRedrawMTime()
Return the mtime of anything that would cause the rendered image to appear differently.
Definition: vtkProp.h:105
virtual int RenderVolumetricGeometry(vtkViewport *)
Definition: vtkProp.h:220
a simple class to control print indentation
Definition: vtkIndent.h:33
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkProp3D.
float * GetRGBArray()
Definition: vtkVolume.h:174
bool GetSupportsSelection() override
Used by vtkHardwareSelector to determine if the prop supports hardware selection. ...
Definition: vtkVolume.h:209
virtual void GetVolumes(vtkPropCollection *)
Definition: vtkProp.h:57
an ordered list of volumes
float GetGradientOpacityConstant()
Definition: vtkVolume.h:182
float * GetGrayArray()
Definition: vtkVolume.h:166
represents the common properties for rendering a volume.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
float * GetScalarOpacityArray()
Definition: vtkVolume.h:150
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
vtkAbstractVolumeMapper * Mapper
Definition: vtkVolume.h:216
vtkMTimeType GetMTime() override
Get the vtkProp3D&#39;s mtime.
float * GetCorrectedScalarOpacityArray()
Definition: vtkVolume.h:142