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 =========================================================================*/
24 #ifndef vtkGPUVolumeRayCastMapper_h
25 #define vtkGPUVolumeRayCastMapper_h
26 
27 #include <vtkRenderingVolumeModule.h> // For export macro
28 
29 #include "vtkVolumeMapper.h"
30 
31 class vtkContourValues;
32 class vtkRenderWindow;
33 class vtkVolumeProperty;
34 
35 //class vtkKWAMRVolumeMapper; // friend class.
36 
37 class VTKRENDERINGVOLUME_EXPORT vtkGPUVolumeRayCastMapper : public vtkVolumeMapper
38 {
39 public:
42  void PrintSelf( ostream& os, vtkIndent indent ) VTK_OVERRIDE;
43 
45 
51  vtkSetClampMacro( AutoAdjustSampleDistances, int, 0, 1 );
52  vtkGetMacro( AutoAdjustSampleDistances, int );
53  vtkBooleanMacro( AutoAdjustSampleDistances, int );
55 
57 
62  vtkSetClampMacro( LockSampleDistanceToInputSpacing, int, 0, 1 );
63  vtkGetMacro( LockSampleDistanceToInputSpacing, int );
64  vtkBooleanMacro( LockSampleDistanceToInputSpacing, int );
66 
68 
73  vtkSetClampMacro( UseJittering, int, 0, 1 );
74  vtkGetMacro( UseJittering, int );
75  vtkBooleanMacro( UseJittering, int );
77 
79 
87  vtkSetClampMacro( UseDepthPass, int, 0, 1 );
88  vtkGetMacro( UseDepthPass, int );
89  vtkBooleanMacro( UseDepthPass, int );
91 
97  vtkContourValues* GetDepthPassContourValues();
98 
100 
106  vtkSetMacro( SampleDistance, float );
107  vtkGetMacro( SampleDistance, float );
109 
111 
118  vtkSetClampMacro( ImageSampleDistance, float, 0.1f, 100.0f );
119  vtkGetMacro( ImageSampleDistance, float );
121 
123 
127  vtkSetClampMacro( MinimumImageSampleDistance, float, 0.1f, 100.0f );
128  vtkGetMacro( MinimumImageSampleDistance, float );
130 
132 
136  vtkSetClampMacro( MaximumImageSampleDistance, float, 0.1f, 100.0f );
137  vtkGetMacro( MaximumImageSampleDistance, float );
139 
140 
142 
155  vtkSetMacro( FinalColorWindow, float );
156  vtkGetMacro( FinalColorWindow, float );
157  vtkSetMacro( FinalColorLevel, float );
158  vtkGetMacro( FinalColorLevel, float );
160 
162 
167  vtkSetMacro( MaxMemoryInBytes, vtkIdType );
168  vtkGetMacro( MaxMemoryInBytes, vtkIdType );
170 
172 
177  vtkSetClampMacro( MaxMemoryFraction, float, 0.1f, 1.0f );
178  vtkGetMacro( MaxMemoryFraction, float );
180 
182 
190  vtkSetMacro(ReportProgress,bool);
191  vtkGetMacro(ReportProgress,bool);
193 
200  virtual int IsRenderSupported(vtkRenderWindow *vtkNotUsed(window),
201  vtkVolumeProperty *vtkNotUsed(property))
202  {
203  return 0;
204  }
205 
206  void CreateCanonicalView( vtkRenderer *ren,
207  vtkVolume *volume,
209  int blend_mode,
210  double viewDirection[3],
211  double viewUp[3] );
212 
214 
235  void SetMaskInput(vtkImageData *mask);
236  vtkGetObjectMacro(MaskInput, vtkImageData);
238 
239  enum { BinaryMaskType = 0, LabelMapMaskType };
240 
242 
246  vtkSetMacro( MaskType, int );
247  vtkGetMacro( MaskType, int );
248  void SetMaskTypeToBinary();
249  void SetMaskTypeToLabelMap();
251 
253 
261  vtkSetClampMacro(MaskBlendFactor,float,0.0f,1.0f);
262  vtkGetMacro(MaskBlendFactor,float);
264 
266 
280  vtkSetMacro(RenderToImage, int);
281  vtkGetMacro(RenderToImage, int);
282  vtkBooleanMacro(RenderToImage, int);
284 
286 
291  vtkSetMacro(DepthImageScalarType, int);
292  vtkGetMacro(DepthImageScalarType, int);
293  void SetDepthImageScalarTypeToUnsignedChar();
294  void SetDepthImageScalarTypeToUnsignedShort();
295  void SetDepthImageScalarTypeToFloat();
297 
299 
310  vtkSetMacro(ClampDepthToBackface, int);
311  vtkGetMacro(ClampDepthToBackface, int);
312  vtkBooleanMacro(ClampDepthToBackface, int);
314 
321  virtual void GetDepthImage(vtkImageData*) {};
322 
329  virtual void GetColorImage(vtkImageData*) {};
330 
335  void Render( vtkRenderer *, vtkVolume * ) VTK_OVERRIDE;
336 
341  virtual void GPURender( vtkRenderer *, vtkVolume *) {}
342 
349  void ReleaseGraphicsResources(vtkWindow *) VTK_OVERRIDE {}
350 
363  virtual void GetReductionRatio(double ratio[3])=0;
364 
365 protected:
367  ~vtkGPUVolumeRayCastMapper() VTK_OVERRIDE;
368 
369  // Check to see that the render will be OK
370  int ValidateRender( vtkRenderer *, vtkVolume * );
371 
372 
373  // Special version of render called during the creation
374  // of a canonical view.
375  void CanonicalViewRender( vtkRenderer *, vtkVolume * );
376 
377  // Methods called by the AMR Volume Mapper.
378  virtual void PreRender(vtkRenderer *ren,
379  vtkVolume *vol,
380  double datasetBounds[6],
381  double scalarRange[2],
382  int numberOfScalarComponents,
383  unsigned int numberOfLevels)=0;
384 
385  // \pre input is up-to-date
386  virtual void RenderBlock(vtkRenderer *ren,
387  vtkVolume *vol,
388  unsigned int level)=0;
389 
390  virtual void PostRender(vtkRenderer *ren,
391  int numberOfScalarComponents)=0;
392 
398  void SetCellFlag(int cellFlag);
399 
405 
406  // Render to texture mode flag
408 
409  // Depth image scalar type
411 
412  // Clamp depth values to the depth of the face at which the ray
413  // exits the volume
415 
416  // Enable / disable stochastic jittering
418 
419  // Enable / disable two pass rendering
422 
423  // The distance between sample points along the ray
425 
429 
432 
433  // 1 if we are generating the canonical image, 0 otherwise
436 
438 
442  vtkSetClampMacro(AMRMode,int,0,1);
443  vtkGetMacro(AMRMode,int);
444  vtkBooleanMacro(AMRMode,int);
446 
449  int MaskType;
450 
451  int AMRMode;
452 
453  // Point data or cell data (or field data, not handled) ?
454  int CellFlag;
455 
468  virtual void ClipCroppingRegionPlanes();
469 
470  double ClippedCroppingRegionPlanes[6];
471 
474 
476 
478 
479  vtkGetObjectMacro(TransformedInput, vtkImageData);
480  void SetTransformedInput(vtkImageData*);
481 
487 
488 private:
489  vtkGPUVolumeRayCastMapper(const vtkGPUVolumeRayCastMapper&) VTK_DELETE_FUNCTION;
490  void operator=(const vtkGPUVolumeRayCastMapper&) VTK_DELETE_FUNCTION;
491 };
492 
493 #endif
494 
virtual void GPURender(vtkRenderer *, vtkVolume *)
Handled in the subclass - the actual render method.
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this mapper.
helper object to manage setting and generating contour values
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:44
Abstract class for a volume mapper.
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:57
int vtkIdType
Definition: vtkType.h:345
void Render(vtkRenderer *ren, vtkVolume *vol) override=0
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
a simple class to control print indentation
Definition: vtkIndent.h:33
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
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
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.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.