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) override;
49 
55  static vtkVolume *New();
56 
58 
61  void SetMapper(vtkAbstractVolumeMapper *mapper);
62  vtkGetObjectMacro(Mapper, vtkAbstractVolumeMapper);
64 
66 
69  virtual void SetProperty(vtkVolumeProperty *property);
70  virtual vtkVolumeProperty *GetProperty();
72 
78  void GetVolumes(vtkPropCollection *vc) override;
79 
83  void Update();
84 
86 
90  double *GetBounds() VTK_SIZEHINT(6) 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() override;
105 
112  vtkMTimeType GetRedrawMTime() override;
113 
117  void ShallowCopy(vtkProp *prop) override;
118 
127  int RenderVolumetricGeometry(vtkViewport *viewport) override;
128 
135  void ReleaseGraphicsResources(vtkWindow *) 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 
212  bool GetSupportsSelection() override
213  { return true; }
214 
215 protected:
216  vtkVolume();
217  ~vtkVolume() override;
218 
221 
222  // The rgb transfer function array - for unsigned char data this
223  // is 256 elements, for short or unsigned short it is 65536 elements
224  // This is a sample at each scalar value of the rgb transfer
225  // function. A time stamp is kept to know when it needs rebuilding
226  float *RGBArray[VTK_MAX_VRCOMP];
227  vtkTimeStamp RGBArrayMTime[VTK_MAX_VRCOMP];
228 
229  // The gray transfer function array - for unsigned char data this
230  // is 256 elements, for short or unsigned short it is 65536 elements
231  // This is a sample at each scalar value of the gray transfer
232  // function. A time stamp is kept to know when it needs rebuilding
233  float *GrayArray[VTK_MAX_VRCOMP];
234  vtkTimeStamp GrayArrayMTime[VTK_MAX_VRCOMP];
235 
236  // The scalar opacity transfer function array - for unsigned char data this
237  // is 256 elements, for short or unsigned short it is 65536 elements
238  // This is a sample at each scalar value of the opacity transfer
239  // function. A time stamp is kept to know when it needs rebuilding
240  float *ScalarOpacityArray[VTK_MAX_VRCOMP];
241  vtkTimeStamp ScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
242 
243  // The corrected scalar opacity transfer function array - this is identical
244  // to the opacity transfer function array when the step size is 1.
245  // In other cases, it is corrected to reflect the new material thickness
246  // modelled by a step size different than 1.
247  float *CorrectedScalarOpacityArray[VTK_MAX_VRCOMP];
248  vtkTimeStamp CorrectedScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
249 
250  // CorrectedStepSize is the step size currently modelled by
251  // CorrectedArray. It is used to determine when the
252  // CorrectedArray needs to be updated to match SampleDistance
253  // in the volume mapper.
255 
256  // Number of elements in the rgb, gray, and opacity transfer function arrays
258 
259  // The magnitude of gradient opacity transfer function array
260  float GradientOpacityArray[VTK_MAX_VRCOMP][256];
261  float GradientOpacityConstant[VTK_MAX_VRCOMP];
262  vtkTimeStamp GradientOpacityArrayMTime[VTK_MAX_VRCOMP];
263 
264  // Function to compute screen coverage of this volume
265  double ComputeScreenCoverage(vtkViewport *vp);
266 
267 private:
268  vtkVolume(const vtkVolume&) = delete;
269  void operator=(const vtkVolume&) = delete;
270 };
271 
272 #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:254
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:257
vtkVolumeProperty * Property
Definition: vtkVolume.h:220
record modification and/or execution time
Definition: vtkTimeStamp.h:32
Abstract class for a volume mapper.
abstract specification for renderers
Definition: vtkRenderer.h:57
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:212
virtual void GetVolumes(vtkPropCollection *)
Definition: vtkProp.h:57
an ordered list of volumes
float GetGradientOpacityConstant()
Definition: vtkVolume.h:182
#define VTK_SIZEHINT(...)
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:219
vtkMTimeType GetMTime() override
Get the vtkProp3D&#39;s mtime.
float * GetCorrectedScalarOpacityArray()
Definition: vtkVolume.h:142