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 "vtkProp3D.h"
40 
41 class vtkRenderer;
42 class vtkPropCollection;
44 class vtkWindow;
45 class vtkVolumeProperty;
47 
49 {
50 public:
51  vtkTypeMacro(vtkVolume,vtkProp3D);
52  void PrintSelf(ostream& os, vtkIndent indent);
53 
57  static vtkVolume *New();
58 
60 
61  void SetMapper(vtkAbstractVolumeMapper *mapper);
62  vtkGetObjectMacro(Mapper, vtkAbstractVolumeMapper);
64 
66 
67  void SetProperty(vtkVolumeProperty *property);
68  vtkVolumeProperty *GetProperty();
70 
74  void GetVolumes(vtkPropCollection *vc);
75 
77  void Update();
78 
80 
82  double *GetBounds();
83  void GetBounds(double bounds[6]) { this->vtkProp3D::GetBounds( bounds ); };
84  double GetMinXBound();
85  double GetMaxXBound();
86  double GetMinYBound();
87  double GetMaxYBound();
88  double GetMinZBound();
89  double GetMaxZBound();
91 
93  unsigned long int GetMTime();
94 
99  unsigned long GetRedrawMTime();
100 
102  void ShallowCopy(vtkProp *prop);
103 
104 //BTX
110  int RenderVolumetricGeometry(vtkViewport *viewport);
111 
117 
119 
121  float *GetCorrectedScalarOpacityArray(int);
123  {return this->GetCorrectedScalarOpacityArray(0);};
125 
127 
129  float *GetScalarOpacityArray(int);
130  float *GetScalarOpacityArray(){return this->GetScalarOpacityArray(0);};
132 
134 
136  float *GetGradientOpacityArray(int);
139 
141 
143  float *GetGrayArray(int);
144  float *GetGrayArray(){return this->GetGrayArray(0);};
146 
148 
150  float *GetRGBArray(int);
151  float *GetRGBArray(){return this->GetRGBArray(0);};
153 
155 
157  float GetGradientOpacityConstant(int);
159  {return this->GetGradientOpacityConstant(0);};
161 
164  float GetArraySize () { return static_cast<float>(this->ArraySize); };
165 
168  void UpdateTransferFunctions( vtkRenderer *ren );
169 
171 
173  void UpdateScalarOpacityforSampleSize( vtkRenderer *ren,
174  float sample_distance );
176 
177 //ETX
178 
179 protected:
180  vtkVolume();
181  ~vtkVolume();
182 
185 
186  // The rgb transfer function array - for unsigned char data this
187  // is 256 elements, for short or unsigned short it is 65536 elements
188  // This is a sample at each scalar value of the rgb transfer
189  // function. A time stamp is kept to know when it needs rebuilding
190  float *RGBArray[VTK_MAX_VRCOMP];
191  vtkTimeStamp RGBArrayMTime[VTK_MAX_VRCOMP];
192 
193  // The gray transfer function array - for unsigned char data this
194  // is 256 elements, for short or unsigned short it is 65536 elements
195  // This is a sample at each scalar value of the gray transfer
196  // function. A time stamp is kept to know when it needs rebuilding
197  float *GrayArray[VTK_MAX_VRCOMP];
198  vtkTimeStamp GrayArrayMTime[VTK_MAX_VRCOMP];
199 
200  // The scalar opacity transfer function array - for unsigned char data this
201  // is 256 elements, for short or unsigned short it is 65536 elements
202  // This is a sample at each scalar value of the opacity transfer
203  // function. A time stamp is kept to know when it needs rebuilding
204  float *ScalarOpacityArray[VTK_MAX_VRCOMP];
205  vtkTimeStamp ScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
206 
207  // The corrected scalar opacity transfer function array - this is identical
208  // to the opacity transfer function array when the step size is 1.
209  // In other cases, it is corrected to reflect the new material thickness
210  // modeled by a step size different than 1.
211  float *CorrectedScalarOpacityArray[VTK_MAX_VRCOMP];
212  vtkTimeStamp CorrectedScalarOpacityArrayMTime[VTK_MAX_VRCOMP];
213 
214  // CorrectedStepSize is the step size currently modeled by
215  // CorrectedArray. It is used to determine when the
216  // CorrectedArray needs to be updated to match SampleDistance
217  // in the volume mapper.
219 
220  // Number of elements in the rgb, gray, and opacity transfer function arrays
222 
223  // The magnitude of gradient opacity transfer function array
224  float GradientOpacityArray[VTK_MAX_VRCOMP][256];
225  float GradientOpacityConstant[VTK_MAX_VRCOMP];
226  vtkTimeStamp GradientOpacityArrayMTime[VTK_MAX_VRCOMP];
227 
228  // Function to compute screen coverage of this volume
229  double ComputeScreenCoverage( vtkViewport *vp );
230 
231 private:
232  vtkVolume(const vtkVolume&); // Not implemented.
233  void operator=(const vtkVolume&); // Not implemented.
234 };
235 
236 #endif
237 
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:49
float GetArraySize()
Definition: vtkVolume.h:164
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:48
float CorrectedStepSize
Definition: vtkVolume.h:218
void GetBounds(double bounds[6])
Definition: vtkVolume.h:83
abstract specification for Viewports
Definition: vtkViewport.h:45
int ArraySize
Definition: vtkVolume.h:221
vtkVolumeProperty * Property
Definition: vtkVolume.h:184
record modification and/or execution time
Definition: vtkTimeStamp.h:33
Abstract class for a volume mapper.
abstract specification for renderers
Definition: vtkRenderer.h:69
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:41
#define VTK_MAX_VRCOMP
float * GetGradientOpacityArray()
Definition: vtkVolume.h:137
a list of Props
virtual void ReleaseGraphicsResources(vtkWindow *)
Definition: vtkProp.h:236
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
virtual int RenderVolumetricGeometry(vtkViewport *)
Definition: vtkProp.h:173
void ShallowCopy(vtkProp *prop)
a simple class to control print indentation
Definition: vtkIndent.h:37
void PrintSelf(ostream &os, vtkIndent indent)
float * GetRGBArray()
Definition: vtkVolume.h:151
virtual void GetVolumes(vtkPropCollection *)
Definition: vtkProp.h:61
a list of volumes
virtual unsigned long GetRedrawMTime()
Definition: vtkProp.h:99
float GetGradientOpacityConstant()
Definition: vtkVolume.h:158
float * GetGrayArray()
Definition: vtkVolume.h:144
represents the common properties for rendering a volume.
#define VTK_RENDERING_EXPORT
virtual double * GetBounds()=0
float * GetScalarOpacityArray()
Definition: vtkVolume.h:130
static vtkObject * New()
vtkAbstractVolumeMapper * Mapper
Definition: vtkVolume.h:183
unsigned long int GetMTime()
float * GetCorrectedScalarOpacityArray()
Definition: vtkVolume.h:122