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
35class vtkRenderWindow;
37
38//class vtkKWAMRVolumeMapper; // friend class.
39
40class VTKRENDERINGVOLUME_EXPORT vtkGPUVolumeRayCastMapper : public vtkVolumeMapper
41{
42public:
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
368protected:
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
453
455
456 // Point data or cell data (or field data, not handled) ?
458
472
473 double ClippedCroppingRegionPlanes[6];
474
477
479
481
482 vtkGetObjectMacro(TransformedInput, vtkImageData);
484
490
491private:
492 vtkGPUVolumeRayCastMapper(const vtkGPUVolumeRayCastMapper&) VTK_DELETE_FUNCTION;
493 void operator=(const vtkGPUVolumeRayCastMapper&) VTK_DELETE_FUNCTION;
494};
495
496#endif
497
helper object to manage setting and generating contour values
Ray casting performed on the GPU.
virtual void GetDepthImage(vtkImageData *)
Low level API to export the depth texture as vtkImageData in RenderToImage mode.
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.
virtual void GPURender(vtkRenderer *, vtkVolume *)
Handled in the subclass - the actual render method.
int ValidateRender(vtkRenderer *, vtkVolume *)
void Render(vtkRenderer *, vtkVolume *)
Initialize rendering for this volume.
virtual void GetColorImage(vtkImageData *)
Low level API to export the color texture as vtkImageData in RenderToImage mode.
vtkContourValues * GetDepthPassContourValues()
Return handle to contour values container so that values can be set by the application.
void SetDepthImageScalarTypeToUnsignedShort()
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
void SetMaskInput(vtkImageData *mask)
Optionally, set a mask input.
virtual void GetReductionRatio(double ratio[3])=0
Return how much the dataset has to be reduced in each dimension to fit on the GPU.
void CreateCanonicalView(vtkRenderer *ren, vtkVolume *volume, vtkImageData *image, int blend_mode, double viewDirection[3], double viewUp[3])
void SetDepthImageScalarTypeToUnsignedChar()
void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
void SetTransformedInput(vtkImageData *)
vtkImageData * LastInput
This is needed only to check if the input data has been changed since the last Render() call.
virtual void PreRender(vtkRenderer *ren, vtkVolume *vol, double datasetBounds[6], double scalarRange[2], int numberOfScalarComponents, unsigned int numberOfLevels)=0
virtual void RenderBlock(vtkRenderer *ren, vtkVolume *vol, unsigned int level)=0
static vtkGPUVolumeRayCastMapper * New()
virtual void ClipCroppingRegionPlanes()
Compute the cropping planes clipped by the bounds of the volume.
virtual void PostRender(vtkRenderer *ren, int numberOfScalarComponents)=0
void SetCellFlag(int cellFlag)
Called by the AMR Volume Mapper.
void CanonicalViewRender(vtkRenderer *, vtkVolume *)
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
a simple class to control print indentation
Definition: vtkIndent.h:40
create a window for renderers to draw into
abstract specification for renderers
Definition: vtkRenderer.h:64
Abstract class for a volume mapper.
represents the common properties for rendering a volume.
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:51
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
@ level
Definition: vtkX3D.h:395
@ image
Definition: vtkX3D.h:374
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
int vtkIdType
Definition: vtkType.h:287