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 =========================================================================*/
36 #ifndef vtkVolume_h
37 #define vtkVolume_h
38 
39 #include "vtkRenderingCoreModule.h" // For export macro
40 #include "vtkProp3D.h"
41 
42 class vtkRenderer;
43 class vtkPropCollection;
45 class vtkWindow;
46 class vtkVolumeProperty;
48 
50 {
51 public:
52  vtkTypeMacro(vtkVolume, vtkProp3D);
53  void PrintSelf(ostream& os, vtkIndent indent);
54 
58  static vtkVolume *New();
59 
61 
62  void SetMapper(vtkAbstractVolumeMapper *mapper);
63  vtkGetObjectMacro(Mapper, vtkAbstractVolumeMapper);
65 
67 
68  void SetProperty(vtkVolumeProperty *property);
69  vtkVolumeProperty *GetProperty();
71 
75  void GetVolumes(vtkPropCollection *vc);
76 
78  void Update();
79 
81 
83  double *GetBounds();
84  void GetBounds(double bounds[6])
85  { this->vtkProp3D::GetBounds(bounds); }
86  double GetMinXBound();
87  double GetMaxXBound();
88  double GetMinYBound();
89  double GetMaxYBound();
90  double GetMinZBound();
91  double GetMaxZBound();
93 
95  unsigned long int GetMTime();
96 
101  unsigned long GetRedrawMTime();
102 
104  void ShallowCopy(vtkProp *prop);
105 
106 //BTX
112  int RenderVolumetricGeometry(vtkViewport *viewport);
113 
119 
121 
123  float *GetCorrectedScalarOpacityArray(int);
125  { return this->GetCorrectedScalarOpacityArray(0); }
127 
129 
131  float *GetScalarOpacityArray(int);
133  { return this->GetScalarOpacityArray(0); }
135 
137 
139  float *GetGradientOpacityArray(int);
141  { return this->GetGradientOpacityArray(0); }
143 
145 
147  float *GetGrayArray(int);
148  float *GetGrayArray()
149  { return this->GetGrayArray(0); }
151 
153 
155  float *GetRGBArray(int);
156  float *GetRGBArray()
157  { return this->GetRGBArray(0); }
159 
161 
163  float GetGradientOpacityConstant(int);
165  { return this->GetGradientOpacityConstant(0); }
167 
169 
171  float GetArraySize()
172  { return static_cast<float>(this->ArraySize); }
174 
177  void UpdateTransferFunctions(vtkRenderer *ren);
178 
180 
182  void UpdateScalarOpacityforSampleSize(vtkRenderer *ren,
183  float sample_distance);
185 
186 //ETX
187 
188 protected:
189  vtkVolume();
190  ~vtkVolume();
191 
194 
195  // The rgb transfer function array - for unsigned char data this
196  // is 256 elements, for short or unsigned short it is 65536 elements
197  // This is a sample at each scalar value of the rgb transfer
198  // function. A time stamp is kept to know when it needs rebuilding
199  float *RGBArray[VTK_MAX_VRCOMP];
200  vtkTimeStamp RGBArrayMTime[VTK_MAX_VRCOMP];
201 
202  // The gray transfer function array - for unsigned char data this
203  // is 256 elements, for short or unsigned short it is 65536 elements
204  // This is a sample at each scalar value of the gray transfer
205  // function. A time stamp is kept to know when it needs rebuilding
206  float *GrayArray[VTK_MAX_VRCOMP];
207  vtkTimeStamp GrayArrayMTime[VTK_MAX_VRCOMP];
208 
209  // The scalar opacity transfer function array - for unsigned char data this
210  // is 256 elements, for short or unsigned short it is 65536 elements
211  // This is a sample at each scalar value of the opacity transfer
212  // function. A time stamp is kept to know when it needs rebuilding
213  float *ScalarOpacityArray[VTK_MAX_VRCOMP];
214  vtkTimeStamp ScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
215 
216  // The corrected scalar opacity transfer function array - this is identical
217  // to the opacity transfer function array when the step size is 1.
218  // In other cases, it is corrected to reflect the new material thickness
219  // modelled by a step size different than 1.
220  float *CorrectedScalarOpacityArray[VTK_MAX_VRCOMP];
221  vtkTimeStamp CorrectedScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
222 
223  // CorrectedStepSize is the step size currently modelled by
224  // CorrectedArray. It is used to determine when the
225  // CorrectedArray needs to be updated to match SampleDistance
226  // in the volume mapper.
228 
229  // Number of elements in the rgb, gray, and opacity transfer function arrays
231 
232  // The magnitude of gradient opacity transfer function array
233  float GradientOpacityArray[VTK_MAX_VRCOMP][256];
234  float GradientOpacityConstant[VTK_MAX_VRCOMP];
235  vtkTimeStamp GradientOpacityArrayMTime[VTK_MAX_VRCOMP];
236 
237  // Function to compute screen coverage of this volume
238  double ComputeScreenCoverage(vtkViewport *vp);
239 
240 private:
241  vtkVolume(const vtkVolume&); // Not implemented.
242  void operator=(const vtkVolume&); // Not implemented.
243 };
244 
245 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
float GetArraySize()
Definition: vtkVolume.h:171
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:49
float CorrectedStepSize
Definition: vtkVolume.h:227
void GetBounds(double bounds[6])
Definition: vtkVolume.h:84
abstract specification for Viewports
Definition: vtkViewport.h:46
int ArraySize
Definition: vtkVolume.h:230
vtkVolumeProperty * Property
Definition: vtkVolume.h:193
record modification and/or execution time
Definition: vtkTimeStamp.h:34
Abstract class for a volume mapper.
abstract specification for renderers
Definition: vtkRenderer.h:63
virtual void Update()
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:42
#define VTK_MAX_VRCOMP
float * GetGradientOpacityArray()
Definition: vtkVolume.h:140
a list of Props
virtual void ReleaseGraphicsResources(vtkWindow *)
Definition: vtkProp.h:270
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
virtual int RenderVolumetricGeometry(vtkViewport *)
Definition: vtkProp.h:202
void ShallowCopy(vtkProp *prop)
a simple class to control print indentation
Definition: vtkIndent.h:38
void PrintSelf(ostream &os, vtkIndent indent)
float * GetRGBArray()
Definition: vtkVolume.h:156
virtual void GetVolumes(vtkPropCollection *)
Definition: vtkProp.h:64
a list of volumes
virtual unsigned long GetRedrawMTime()
Definition: vtkProp.h:103
float GetGradientOpacityConstant()
Definition: vtkVolume.h:164
float * GetGrayArray()
Definition: vtkVolume.h:148
represents the common properties for rendering a volume.
#define VTKRENDERINGCORE_EXPORT
virtual double * GetBounds()=0
float * GetScalarOpacityArray()
Definition: vtkVolume.h:132
static vtkObject * New()
vtkAbstractVolumeMapper * Mapper
Definition: vtkVolume.h:192
unsigned long int GetMTime()
float * GetCorrectedScalarOpacityArray()
Definition: vtkVolume.h:124