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 =========================================================================*/
30 #ifndef vtkGPUVolumeRayCastMapper_h
31 #define vtkGPUVolumeRayCastMapper_h
32 
33 #include <vtkRenderingVolumeModule.h> // For export macro
34 
35 #include "vtkVolumeMapper.h"
36 
37 class vtkContourValues;
38 class vtkRenderWindow;
39 class vtkVolumeProperty;
40 
41 //class vtkKWAMRVolumeMapper; // friend class.
42 
43 class VTKRENDERINGVOLUME_EXPORT vtkGPUVolumeRayCastMapper : public vtkVolumeMapper
44 {
45 public:
48  void PrintSelf( ostream& os, vtkIndent indent ) override;
49 
51 
57  vtkSetClampMacro( AutoAdjustSampleDistances, int, 0, 1 );
58  vtkGetMacro( AutoAdjustSampleDistances, int );
59  vtkBooleanMacro( AutoAdjustSampleDistances, int );
61 
63 
68  vtkSetClampMacro( LockSampleDistanceToInputSpacing, int, 0, 1 );
69  vtkGetMacro( LockSampleDistanceToInputSpacing, int );
70  vtkBooleanMacro( LockSampleDistanceToInputSpacing, int );
72 
74 
79  vtkSetClampMacro( UseJittering, int, 0, 1 );
80  vtkGetMacro( UseJittering, int );
81  vtkBooleanMacro( UseJittering, int );
83 
85 
93  vtkSetClampMacro( UseDepthPass, int, 0, 1 );
94  vtkGetMacro( UseDepthPass, int );
95  vtkBooleanMacro( UseDepthPass, int );
97 
103  vtkContourValues* GetDepthPassContourValues();
104 
106 
112  vtkSetMacro( SampleDistance, float );
113  vtkGetMacro( SampleDistance, float );
115 
117 
124  vtkSetClampMacro( ImageSampleDistance, float, 0.1f, 100.0f );
125  vtkGetMacro( ImageSampleDistance, float );
127 
129 
133  vtkSetClampMacro( MinimumImageSampleDistance, float, 0.1f, 100.0f );
134  vtkGetMacro( MinimumImageSampleDistance, float );
136 
138 
142  vtkSetClampMacro( MaximumImageSampleDistance, float, 0.1f, 100.0f );
143  vtkGetMacro( MaximumImageSampleDistance, float );
145 
146 
148 
161  vtkSetMacro( FinalColorWindow, float );
162  vtkGetMacro( FinalColorWindow, float );
163  vtkSetMacro( FinalColorLevel, float );
164  vtkGetMacro( FinalColorLevel, float );
166 
168 
173  vtkSetMacro( MaxMemoryInBytes, vtkIdType );
174  vtkGetMacro( MaxMemoryInBytes, vtkIdType );
176 
178 
183  vtkSetClampMacro( MaxMemoryFraction, float, 0.1f, 1.0f );
184  vtkGetMacro( MaxMemoryFraction, float );
186 
188 
196  vtkSetMacro(ReportProgress,bool);
197  vtkGetMacro(ReportProgress,bool);
199 
206  virtual int IsRenderSupported(vtkRenderWindow *vtkNotUsed(window),
207  vtkVolumeProperty *vtkNotUsed(property))
208  {
209  return 0;
210  }
211 
212  void CreateCanonicalView( vtkRenderer *ren,
213  vtkVolume *volume,
215  int blend_mode,
216  double viewDirection[3],
217  double viewUp[3] );
218 
220 
241  void SetMaskInput(vtkImageData *mask);
242  vtkGetObjectMacro(MaskInput, vtkImageData);
244 
245  enum { BinaryMaskType = 0, LabelMapMaskType };
246 
248 
252  vtkSetMacro( MaskType, int );
253  vtkGetMacro( MaskType, int );
254  void SetMaskTypeToBinary();
255  void SetMaskTypeToLabelMap();
257 
259 
267  vtkSetClampMacro(MaskBlendFactor,float,0.0f,1.0f);
268  vtkGetMacro(MaskBlendFactor,float);
270 
272 
286  vtkSetMacro(RenderToImage, int);
287  vtkGetMacro(RenderToImage, int);
288  vtkBooleanMacro(RenderToImage, int);
290 
292 
297  vtkSetMacro(DepthImageScalarType, int);
298  vtkGetMacro(DepthImageScalarType, int);
299  void SetDepthImageScalarTypeToUnsignedChar();
300  void SetDepthImageScalarTypeToUnsignedShort();
301  void SetDepthImageScalarTypeToFloat();
303 
305 
316  vtkSetMacro(ClampDepthToBackface, int);
317  vtkGetMacro(ClampDepthToBackface, int);
318  vtkBooleanMacro(ClampDepthToBackface, int);
320 
327  virtual void GetDepthImage(vtkImageData*) {};
328 
335  virtual void GetColorImage(vtkImageData*) {};
336 
341  void Render( vtkRenderer *, vtkVolume * ) override;
342 
347  virtual void GPURender( vtkRenderer *, vtkVolume *) {}
348 
356 
369  virtual void GetReductionRatio(double ratio[3])=0;
370 
372  {
373  SCALAR = 0, // default
374  NATIVE
375  };
376 
378 
394  vtkSetMacro(ColorRangeType, int);
395  vtkGetMacro(ColorRangeType, int);
396  vtkSetMacro(ScalarOpacityRangeType, int);
397  vtkGetMacro(ScalarOpacityRangeType, int);
398  vtkSetMacro(GradientOpacityRangeType, int);
399  vtkGetMacro(GradientOpacityRangeType, int);
401 
402 protected:
404  ~vtkGPUVolumeRayCastMapper() override;
405 
406  // Check to see that the render will be OK
407  int ValidateRender( vtkRenderer *, vtkVolume * );
408 
409 
410  // Special version of render called during the creation
411  // of a canonical view.
412  void CanonicalViewRender( vtkRenderer *, vtkVolume * );
413 
414  // Methods called by the AMR Volume Mapper.
415  virtual void PreRender(vtkRenderer *ren,
416  vtkVolume *vol,
417  double datasetBounds[6],
418  double scalarRange[2],
419  int numberOfScalarComponents,
420  unsigned int numberOfLevels)=0;
421 
422  // \pre input is up-to-date
423  virtual void RenderBlock(vtkRenderer *ren,
424  vtkVolume *vol,
425  unsigned int level)=0;
426 
427  virtual void PostRender(vtkRenderer *ren,
428  int numberOfScalarComponents)=0;
429 
435  void SetCellFlag(int cellFlag);
436 
442 
443  // Render to texture mode flag
445 
446  // Depth image scalar type
448 
449  // Clamp depth values to the depth of the face at which the ray
450  // exits the volume
452 
453  // Enable / disable stochastic jittering
455 
456  // Enable / disable two pass rendering
459 
460  // The distance between sample points along the ray
462 
466 
469 
470  // 1 if we are generating the canonical image, 0 otherwise
473 
475 
479  vtkSetClampMacro(AMRMode,int,0,1);
480  vtkGetMacro(AMRMode,int);
481  vtkBooleanMacro(AMRMode,int);
483 
486  int MaskType;
487 
488  int AMRMode;
489 
490  // Transfer function range type
494 
495  // Point data or cell data (or field data, not handled) ?
496  int CellFlag;
497 
510  virtual void ClipCroppingRegionPlanes();
511 
512  double ClippedCroppingRegionPlanes[6];
513 
516 
518 
520 
521  vtkGetObjectMacro(TransformedInput, vtkImageData);
522  void SetTransformedInput(vtkImageData*);
523 
529 
530 private:
532  void operator=(const vtkGPUVolumeRayCastMapper&) = delete;
533 };
534 
535 #endif
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:50
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:63
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:37
a simple class to control print indentation
Definition: vtkIndent.h:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
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.