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 
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 
210  vtkVolume *volume,
212  int blend_mode,
213  double viewDirection[3],
214  double viewUp[3] );
215 
217 
239  vtkGetObjectMacro(MaskInput, vtkImageData);
241 
242  enum { BinaryMaskType = 0, LabelMapMaskType };
243 
245 
249  vtkSetMacro( MaskType, int );
250  vtkGetMacro( MaskType, int );
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);
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 
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
374 
375 
376  // Special version of render called during the creation
377  // of a canonical view.
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);
484 
490 
491 private:
492  vtkGPUVolumeRayCastMapper(const vtkGPUVolumeRayCastMapper&) VTK_DELETE_FUNCTION;
493  void operator=(const vtkGPUVolumeRayCastMapper&) VTK_DELETE_FUNCTION;
494 };
495 
496 #endif
497 
vtkGPUVolumeRayCastMapper::New
static vtkGPUVolumeRayCastMapper * New()
vtkGPUVolumeRayCastMapper::GeneratingCanonicalView
int GeneratingCanonicalView
Definition: vtkGPUVolumeRayCastMapper.h:437
vtkVolumeMapper
Abstract class for a volume mapper.
Definition: vtkVolumeMapper.h:50
vtkGPUVolumeRayCastMapper::GetDepthImage
virtual void GetDepthImage(vtkImageData *)
Low level API to export the depth texture as vtkImageData in RenderToImage mode.
Definition: vtkGPUVolumeRayCastMapper.h:324
vtkGPUVolumeRayCastMapper::PreRender
virtual void PreRender(vtkRenderer *ren, vtkVolume *vol, double datasetBounds[6], double scalarRange[2], int numberOfScalarComponents, unsigned int numberOfLevels)=0
vtkGPUVolumeRayCastMapper::SetMaskInput
void SetMaskInput(vtkImageData *mask)
Optionally, set a mask input.
vtkGPUVolumeRayCastMapper::SetMaskTypeToBinary
void SetMaskTypeToBinary()
vtkGPUVolumeRayCastMapper::LockSampleDistanceToInputSpacing
int LockSampleDistanceToInputSpacing
Definition: vtkGPUVolumeRayCastMapper.h:403
vtkGPUVolumeRayCastMapper::Render
void Render(vtkRenderer *, vtkVolume *)
Initialize rendering for this volume.
vtkVolume
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:51
vtkGPUVolumeRayCastMapper::BigTimeToDraw
double BigTimeToDraw
Definition: vtkGPUVolumeRayCastMapper.h:430
vtkGPUVolumeRayCastMapper::DepthImageScalarType
int DepthImageScalarType
Definition: vtkGPUVolumeRayCastMapper.h:413
vtkIdType
int vtkIdType
Definition: vtkType.h:287
vtkGPUVolumeRayCastMapper::MaxMemoryFraction
float MaxMemoryFraction
Definition: vtkGPUVolumeRayCastMapper.h:476
vtkGPUVolumeRayCastMapper::SetCellFlag
void SetCellFlag(int cellFlag)
Called by the AMR Volume Mapper.
vtkGPUVolumeRayCastMapper::TransformedInput
vtkImageData * TransformedInput
Definition: vtkGPUVolumeRayCastMapper.h:480
vtkX3D::image
@ image
Definition: vtkX3D.h:374
vtkGPUVolumeRayCastMapper::SetDepthImageScalarTypeToUnsignedChar
void SetDepthImageScalarTypeToUnsignedChar()
vtkGPUVolumeRayCastMapper::ValidateRender
int ValidateRender(vtkRenderer *, vtkVolume *)
vtkGPUVolumeRayCastMapper::RenderBlock
virtual void RenderBlock(vtkRenderer *ren, vtkVolume *vol, unsigned int level)=0
vtkGPUVolumeRayCastMapper::FinalColorLevel
float FinalColorLevel
Definition: vtkGPUVolumeRayCastMapper.h:434
vtkGPUVolumeRayCastMapper::SampleDistance
float SampleDistance
Definition: vtkGPUVolumeRayCastMapper.h:427
vtkGPUVolumeRayCastMapper::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkGPUVolumeRayCastMapper::PostRender
virtual void PostRender(vtkRenderer *ren, int numberOfScalarComponents)=0
vtkGPUVolumeRayCastMapper::MaximumImageSampleDistance
float MaximumImageSampleDistance
Definition: vtkGPUVolumeRayCastMapper.h:407
vtkGPUVolumeRayCastMapper::vtkGPUVolumeRayCastMapper
vtkGPUVolumeRayCastMapper()
vtkGPUVolumeRayCastMapper::FinalColorWindow
float FinalColorWindow
Definition: vtkGPUVolumeRayCastMapper.h:433
vtkGPUVolumeRayCastMapper::MinimumImageSampleDistance
float MinimumImageSampleDistance
Definition: vtkGPUVolumeRayCastMapper.h:406
vtkGPUVolumeRayCastMapper::CanonicalViewImageData
vtkImageData * CanonicalViewImageData
Definition: vtkGPUVolumeRayCastMapper.h:438
vtkGPUVolumeRayCastMapper::CellFlag
int CellFlag
Definition: vtkGPUVolumeRayCastMapper.h:457
vtkGPUVolumeRayCastMapper::MaskBlendFactor
float MaskBlendFactor
Definition: vtkGPUVolumeRayCastMapper.h:451
vtkGPUVolumeRayCastMapper::SetDepthImageScalarTypeToFloat
void SetDepthImageScalarTypeToFloat()
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
vtkGPUVolumeRayCastMapper::SetTransformedInput
void SetTransformedInput(vtkImageData *)
vtkGPUVolumeRayCastMapper::UseDepthPass
int UseDepthPass
Definition: vtkGPUVolumeRayCastMapper.h:423
vtkGPUVolumeRayCastMapper::ClipCroppingRegionPlanes
virtual void ClipCroppingRegionPlanes()
Compute the cropping planes clipped by the bounds of the volume.
vtkX3D::level
@ level
Definition: vtkX3D.h:395
vtkContourValues
helper object to manage setting and generating contour values
Definition: vtkContourValues.h:36
vtkVolumeMapper.h
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkGPUVolumeRayCastMapper::UseJittering
int UseJittering
Definition: vtkGPUVolumeRayCastMapper.h:420
vtkGPUVolumeRayCastMapper
Ray casting performed on the GPU.
Definition: vtkGPUVolumeRayCastMapper.h:41
vtkGPUVolumeRayCastMapper::SetDepthImageScalarTypeToUnsignedShort
void SetDepthImageScalarTypeToUnsignedShort()
vtkGPUVolumeRayCastMapper::ImageSampleDistance
float ImageSampleDistance
Definition: vtkGPUVolumeRayCastMapper.h:405
vtkGPUVolumeRayCastMapper::GetColorImage
virtual void GetColorImage(vtkImageData *)
Low level API to export the color texture as vtkImageData in RenderToImage mode.
Definition: vtkGPUVolumeRayCastMapper.h:332
vtkGPUVolumeRayCastMapper::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
Definition: vtkGPUVolumeRayCastMapper.h:352
vtkGPUVolumeRayCastMapper::IsRenderSupported
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.
Definition: vtkGPUVolumeRayCastMapper.h:203
vtkGPUVolumeRayCastMapper::RenderToImage
int RenderToImage
Definition: vtkGPUVolumeRayCastMapper.h:410
vtkGPUVolumeRayCastMapper::AMRMode
int AMRMode
Definition: vtkGPUVolumeRayCastMapper.h:454
vtkGPUVolumeRayCastMapper::CreateCanonicalView
void CreateCanonicalView(vtkRenderer *ren, vtkVolume *volume, vtkImageData *image, int blend_mode, double viewDirection[3], double viewUp[3])
vtkGPUVolumeRayCastMapper::~vtkGPUVolumeRayCastMapper
~vtkGPUVolumeRayCastMapper()
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkGPUVolumeRayCastMapper::CanonicalViewRender
void CanonicalViewRender(vtkRenderer *, vtkVolume *)
vtkGPUVolumeRayCastMapper::MaskType
int MaskType
Definition: vtkGPUVolumeRayCastMapper.h:452
vtkGPUVolumeRayCastMapper::SmallVolumeRender
int SmallVolumeRender
Definition: vtkGPUVolumeRayCastMapper.h:429
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:64
vtkGPUVolumeRayCastMapper::GPURender
virtual void GPURender(vtkRenderer *, vtkVolume *)
Handled in the subclass - the actual render method.
Definition: vtkGPUVolumeRayCastMapper.h:344
vtkGPUVolumeRayCastMapper::SetMaskTypeToLabelMap
void SetMaskTypeToLabelMap()
vtkGPUVolumeRayCastMapper::AutoAdjustSampleDistances
int AutoAdjustSampleDistances
Definition: vtkGPUVolumeRayCastMapper.h:404
vtkGPUVolumeRayCastMapper::ReportProgress
bool ReportProgress
Definition: vtkGPUVolumeRayCastMapper.h:478
vtkGPUVolumeRayCastMapper::ClampDepthToBackface
int ClampDepthToBackface
Definition: vtkGPUVolumeRayCastMapper.h:417
vtkRenderWindow
create a window for renderers to draw into
Definition: vtkRenderWindow.h:87
vtkGPUVolumeRayCastMapper::LastInput
vtkImageData * LastInput
This is needed only to check if the input data has been changed since the last Render() call.
Definition: vtkGPUVolumeRayCastMapper.h:489
vtkGPUVolumeRayCastMapper::SmallTimeToDraw
double SmallTimeToDraw
Definition: vtkGPUVolumeRayCastMapper.h:431
vtkGPUVolumeRayCastMapper::MaskInput
vtkImageData * MaskInput
Definition: vtkGPUVolumeRayCastMapper.h:447
vtkGPUVolumeRayCastMapper::GetDepthPassContourValues
vtkContourValues * GetDepthPassContourValues()
Return handle to contour values container so that values can be set by the application.
vtkGPUVolumeRayCastMapper::MaxMemoryInBytes
vtkIdType MaxMemoryInBytes
Definition: vtkGPUVolumeRayCastMapper.h:475
vtkGPUVolumeRayCastMapper::DepthPassContourValues
vtkContourValues * DepthPassContourValues
Definition: vtkGPUVolumeRayCastMapper.h:424
vtkVolumeProperty
represents the common properties for rendering a volume.
Definition: vtkVolumeProperty.h:61
vtkGPUVolumeRayCastMapper::GetReductionRatio
virtual void GetReductionRatio(double ratio[3])=0
Return how much the dataset has to be reduced in each dimension to fit on the GPU.