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 =========================================================================*/
27 #ifndef vtkGPUVolumeRayCastMapper_h
28 #define vtkGPUVolumeRayCastMapper_h
29 
30 #include <vtkRenderingVolumeModule.h> // For export macro
31 
32 #include "vtkVolumeMapper.h"
33 
34 class vtkContourValues;
35 class vtkRenderWindow;
36 class vtkVolumeProperty;
37 
38 //class vtkKWAMRVolumeMapper; // friend class.
39 
40 class VTKRENDERINGVOLUME_EXPORT vtkGPUVolumeRayCastMapper : public vtkVolumeMapper
41 {
42 public:
45  void PrintSelf( ostream& os, vtkIndent indent );
46 
48 
54  vtkSetClampMacro( AutoAdjustSampleDistances, int, 0, 1 );
55  vtkGetMacro( AutoAdjustSampleDistances, int );
56  vtkBooleanMacro( AutoAdjustSampleDistances, int );
58 
60 
65  vtkSetClampMacro( LockSampleDistanceToInputSpacing, int, 0, 1 );
66  vtkGetMacro( LockSampleDistanceToInputSpacing, int );
67  vtkBooleanMacro( LockSampleDistanceToInputSpacing, int );
69 
71 
76  vtkSetClampMacro( UseJittering, int, 0, 1 );
77  vtkGetMacro( UseJittering, int );
78  vtkBooleanMacro( UseJittering, int );
80 
82 
90  vtkSetClampMacro( UseDepthPass, int, 0, 1 );
91  vtkGetMacro( UseDepthPass, int );
92  vtkBooleanMacro( UseDepthPass, int );
94 
100  vtkContourValues* GetDepthPassContourValues();
101 
103 
109  vtkSetMacro( SampleDistance, float );
110  vtkGetMacro( SampleDistance, float );
112 
114 
121  vtkSetClampMacro( ImageSampleDistance, float, 0.1f, 100.0f );
122  vtkGetMacro( ImageSampleDistance, float );
124 
126 
130  vtkSetClampMacro( MinimumImageSampleDistance, float, 0.1f, 100.0f );
131  vtkGetMacro( MinimumImageSampleDistance, float );
133 
135 
139  vtkSetClampMacro( MaximumImageSampleDistance, float, 0.1f, 100.0f );
140  vtkGetMacro( MaximumImageSampleDistance, float );
142 
143 
145 
158  vtkSetMacro( FinalColorWindow, float );
159  vtkGetMacro( FinalColorWindow, float );
160  vtkSetMacro( FinalColorLevel, float );
161  vtkGetMacro( FinalColorLevel, float );
163 
165 
170  vtkSetMacro( MaxMemoryInBytes, vtkIdType );
171  vtkGetMacro( MaxMemoryInBytes, vtkIdType );
173 
175 
180  vtkSetClampMacro( MaxMemoryFraction, float, 0.1f, 1.0f );
181  vtkGetMacro( MaxMemoryFraction, float );
183 
185 
193  vtkSetMacro(ReportProgress,bool);
194  vtkGetMacro(ReportProgress,bool);
196 
203  virtual int IsRenderSupported(vtkRenderWindow *vtkNotUsed(window),
204  vtkVolumeProperty *vtkNotUsed(property))
205  {
206  return 0;
207  }
208 
209  void CreateCanonicalView( vtkRenderer *ren,
210  vtkVolume *volume,
212  int blend_mode,
213  double viewDirection[3],
214  double viewUp[3] );
215 
217 
238  void SetMaskInput(vtkImageData *mask);
239  vtkGetObjectMacro(MaskInput, vtkImageData);
241 
242  enum { BinaryMaskType = 0, LabelMapMaskType };
243 
245 
249  vtkSetMacro( MaskType, int );
250  vtkGetMacro( MaskType, int );
251  void SetMaskTypeToBinary();
252  void SetMaskTypeToLabelMap();
254 
256 
264  vtkSetClampMacro(MaskBlendFactor,float,0.0f,1.0f);
265  vtkGetMacro(MaskBlendFactor,float);
267 
269 
283  vtkSetMacro(RenderToImage, int);
284  vtkGetMacro(RenderToImage, int);
285  vtkBooleanMacro(RenderToImage, int);
287 
289 
294  vtkSetMacro(DepthImageScalarType, int);
295  vtkGetMacro(DepthImageScalarType, int);
296  void SetDepthImageScalarTypeToUnsignedChar();
297  void SetDepthImageScalarTypeToUnsignedShort();
298  void SetDepthImageScalarTypeToFloat();
300 
302 
313  vtkSetMacro(ClampDepthToBackface, int);
314  vtkGetMacro(ClampDepthToBackface, int);
315  vtkBooleanMacro(ClampDepthToBackface, int);
317 
324  virtual void GetDepthImage(vtkImageData*) {};
325 
332  virtual void GetColorImage(vtkImageData*) {};
333 
338  void Render( vtkRenderer *, vtkVolume * );
339 
344  virtual void GPURender( vtkRenderer *, vtkVolume *) {}
345 
353 
366  virtual void GetReductionRatio(double ratio[3])=0;
367 
368 protected:
371 
372  // Check to see that the render will be OK
373  int ValidateRender( vtkRenderer *, vtkVolume * );
374 
375 
376  // Special version of render called during the creation
377  // of a canonical view.
378  void CanonicalViewRender( vtkRenderer *, vtkVolume * );
379 
380  // Methods called by the AMR Volume Mapper.
381  virtual void PreRender(vtkRenderer *ren,
382  vtkVolume *vol,
383  double datasetBounds[6],
384  double scalarRange[2],
385  int numberOfScalarComponents,
386  unsigned int numberOfLevels)=0;
387 
388  // \pre input is up-to-date
389  virtual void RenderBlock(vtkRenderer *ren,
390  vtkVolume *vol,
391  unsigned int level)=0;
392 
393  virtual void PostRender(vtkRenderer *ren,
394  int numberOfScalarComponents)=0;
395 
401  void SetCellFlag(int cellFlag);
402 
408 
409  // Render to texture mode flag
411 
412  // Depth image scalar type
414 
415  // Clamp depth values to the depth of the face at which the ray
416  // exits the volume
418 
419  // Enable / disable stochastic jittering
421 
422  // Enable / disable two pass rendering
425 
426  // The distance between sample points along the ray
428 
432 
435 
436  // 1 if we are generating the canonical image, 0 otherwise
439 
441 
445  vtkSetClampMacro(AMRMode,int,0,1);
446  vtkGetMacro(AMRMode,int);
447  vtkBooleanMacro(AMRMode,int);
449 
452  int MaskType;
453 
454  int AMRMode;
455 
456  // Point data or cell data (or field data, not handled) ?
457  int CellFlag;
458 
471  virtual void ClipCroppingRegionPlanes();
472 
473  double ClippedCroppingRegionPlanes[6];
474 
477 
479 
481 
482  vtkGetObjectMacro(TransformedInput, vtkImageData);
483  void SetTransformedInput(vtkImageData*);
484 
490 
491 private:
492  vtkGPUVolumeRayCastMapper(const vtkGPUVolumeRayCastMapper&) VTK_DELETE_FUNCTION;
493  void operator=(const vtkGPUVolumeRayCastMapper&) VTK_DELETE_FUNCTION;
494 };
495 
496 #endif
497 
virtual void GPURender(vtkRenderer *, vtkVolume *)
Handled in the subclass - the actual render method.
helper object to manage setting and generating contour values
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:50
Abstract class for a volume mapper.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
virtual void GetDepthImage(vtkImageData *)
Low level API to export the depth texture as vtkImageData in RenderToImage mode.
virtual void GetColorImage(vtkImageData *)
Low level API to export the color texture as vtkImageData in RenderToImage mode.
abstract specification for renderers
Definition: vtkRenderer.h:63
int vtkIdType
Definition: vtkType.h:287
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
a simple class to control print indentation
Definition: vtkIndent.h:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
virtual void Render(vtkRenderer *ren, vtkVolume *vol)=0
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
represents the common properties for rendering a volume.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
virtual int IsRenderSupported(vtkRenderWindow *vtkNotUsed(window), vtkVolumeProperty *vtkNotUsed(property))
Based on hardware and properties, we may or may not be able to render using 3D texture mapping...
create a window for renderers to draw into
void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
static vtkAlgorithm * New()
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
vtkImageData * LastInput
This is needed only to check if the input data has been changed since the last Render() call...
Ray casting performed on the GPU.