VTK
vtkGPUVolumeRayCastMapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGPUVolumeRayCastMapper.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 =========================================================================*/
29 #ifndef vtkGPUVolumeRayCastMapper_h
30 #define vtkGPUVolumeRayCastMapper_h
31 
32 #include "vtkRenderingVolumeModule.h" // For export macro
33 #include "vtkVolumeMapper.h"
34 
35 class vtkVolumeProperty;
36 class vtkRenderWindow;
37 
38 //class vtkKWAMRVolumeMapper; // friend class.
39 
41 {
42 public:
45  void PrintSelf( ostream& os, vtkIndent indent );
46 
48 
51  vtkSetClampMacro( AutoAdjustSampleDistances, int, 0, 1 );
52  vtkGetMacro( AutoAdjustSampleDistances, int );
53  vtkBooleanMacro( AutoAdjustSampleDistances, int );
55 
57 
60  vtkSetMacro( SampleDistance, float );
61  vtkGetMacro( SampleDistance, float );
63 
65 
70  vtkSetClampMacro( ImageSampleDistance, float, 0.1f, 100.0f );
71  vtkGetMacro( ImageSampleDistance, float );
73 
75 
77  vtkSetClampMacro( MinimumImageSampleDistance, float, 0.1f, 100.0f );
78  vtkGetMacro( MinimumImageSampleDistance, float );
80 
82 
84  vtkSetClampMacro( MaximumImageSampleDistance, float, 0.1f, 100.0f );
85  vtkGetMacro( MaximumImageSampleDistance, float );
87 
88 
90 
96  vtkSetMacro( FinalColorWindow, float );
97  vtkGetMacro( FinalColorWindow, float );
98  vtkSetMacro( FinalColorLevel, float );
99  vtkGetMacro( FinalColorLevel, float );
101 
103 
105  vtkSetMacro( MaxMemoryInBytes, vtkIdType );
106  vtkGetMacro( MaxMemoryInBytes, vtkIdType );
108 
110 
112  vtkSetClampMacro( MaxMemoryFraction, float, 0.1f, 1.0f );
113  vtkGetMacro( MaxMemoryFraction, float );
115 
117 
122  vtkSetMacro(ReportProgress,bool);
123  vtkGetMacro(ReportProgress,bool);
125 
127 
131  virtual int IsRenderSupported(vtkRenderWindow *vtkNotUsed(window),
132  vtkVolumeProperty *vtkNotUsed(property))
133  {
134  return 0;
135  }
137 
138  void CreateCanonicalView( vtkRenderer *ren,
139  vtkVolume *volume,
141  int blend_mode,
142  double viewDirection[3],
143  double viewUp[3] );
144 
146 
161  void SetMaskInput(vtkImageData *mask);
162  vtkGetObjectMacro(MaskInput, vtkImageData);
164 
165  //BTX
166  enum { BinaryMaskType = 0, LabelMapMaskType };
167  //ETX
168 
170 
172  vtkSetMacro( MaskType, int );
173  vtkGetMacro( MaskType, int );
174  void SetMaskTypeToBinary();
175  void SetMaskTypeToLabelMap();
177 
179 
184  vtkSetClampMacro(MaskBlendFactor,float,0.0f,1.0f);
185  vtkGetMacro(MaskBlendFactor,float);
187 
188 //BTX
191  void Render( vtkRenderer *, vtkVolume * );
192 
195  virtual void GPURender( vtkRenderer *, vtkVolume *) {}
196 
202 
211  virtual void GetReductionRatio(double ratio[3])=0;
212 
213 //ETX
214 
215 protected:
218 
219  // Check to see that the render will be OK
220  int ValidateRender( vtkRenderer *, vtkVolume * );
221 
222 
223  // Special version of render called during the creation
224  // of a canonical view.
225  void CanonicalViewRender( vtkRenderer *, vtkVolume * );
226 
227  // Methods called by the AMR Volume Mapper.
228  virtual void PreRender(vtkRenderer *ren,
229  vtkVolume *vol,
230  double datasetBounds[6],
231  double scalarRange[2],
232  int numberOfScalarComponents,
233  unsigned int numberOfLevels)=0;
234 
235  // \pre input is up-to-date
236  virtual void RenderBlock(vtkRenderer *ren,
237  vtkVolume *vol,
238  unsigned int level)=0;
239 
240  virtual void PostRender(vtkRenderer *ren,
241  int numberOfScalarComponents)=0;
242 
245  void SetCellFlag(int cellFlag);
246 
247  // The distance between sample points along the ray
249 
250 
255 
259 
262 
265 
266 
267  // 1 if we are generating the canonical image, 0 otherwise
270 
272 
274  vtkSetClampMacro(AMRMode,int,0,1);
275  vtkGetMacro(AMRMode,int);
276  vtkBooleanMacro(AMRMode,int);
278 
279  int AMRMode;
280  int CellFlag; // point data or cell data (or field data, not handled) ?
281 
291  virtual void ClipCroppingRegionPlanes();
292 
293  double ClippedCroppingRegionPlanes[6];
297  int MaskType;
299 
300  vtkGetObjectMacro(TransformedInput, vtkImageData);
301  void SetTransformedInput(vtkImageData*);
302 
306 
307 private:
308  vtkGPUVolumeRayCastMapper(const vtkGPUVolumeRayCastMapper&); // Not implemented.
309  void operator=(const vtkGPUVolumeRayCastMapper&); // Not implemented.
310 };
311 
312 #endif
313 
virtual void GPURender(vtkRenderer *, vtkVolume *)
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:49
Abstract class for a volume mapper.
void PrintSelf(ostream &os, vtkIndent indent)
#define VTKRENDERINGVOLUME_EXPORT
abstract specification for renderers
Definition: vtkRenderer.h:63
int vtkIdType
Definition: vtkType.h:275
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
a simple class to control print indentation
Definition: vtkIndent.h:38
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
virtual void Render(vtkRenderer *ren, vtkVolume *vol)=0
represents the common properties for rendering a volume.
virtual int IsRenderSupported(vtkRenderWindow *vtkNotUsed(window), vtkVolumeProperty *vtkNotUsed(property))
create a window for renderers to draw into
static vtkAlgorithm * New()
Ray casting performed on the GPU.