VTK
vtkSmartVolumeMapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSmartVolumeMapper.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 =========================================================================*/
103 #ifndef vtkSmartVolumeMapper_h
104 #define vtkSmartVolumeMapper_h
105 
106 #include "vtkRenderingVolumeOpenGLModule.h" // For export macro
107 #include "vtkVolumeMapper.h"
108 #include "vtkImageReslice.h" // for VTK_RESLICE_NEAREST, VTK_RESLICE_CUBIC
109 
112 class vtkImageResample;
114 class vtkRenderWindow;
115 class vtkVolume;
116 class vtkVolumeProperty;
117 #if !defined(VTK_LEGACY_REMOVE)
119 #endif // VTK_LEGACY_REMOVE
120 
121 class VTKRENDERINGVOLUMEOPENGL_EXPORT vtkSmartVolumeMapper : public vtkVolumeMapper
122 {
123 public:
124  static vtkSmartVolumeMapper *New();
126  void PrintSelf( ostream& os, vtkIndent indent );
127 
129 
139  vtkSetMacro( FinalColorWindow, float );
141 
143 
146  vtkGetMacro( FinalColorWindow, float );
148 
150 
157  vtkSetMacro( FinalColorLevel, float );
159 
161 
164  vtkGetMacro( FinalColorLevel, float );
166 
167 // The possible values for the default and current render mode ivars
168  enum
169  {
170  DefaultRenderMode=0,
177  InvalidRenderMode
178  };
179 
184  void SetRequestedRenderMode(int mode);
185 
191  void SetRequestedRenderModeToDefault();
192 
198  void SetRequestedRenderModeToGPU();
199 
204 #if !defined(VTK_LEGACY_REMOVE)
205  void SetRequestedRenderModeToTexture();
206 #endif // VTK_LEGACY_REMOVE
207 
215 #if !defined(VTK_LEGACY_REMOVE)
216  void SetRequestedRenderModeToRayCastAndTexture();
217 #endif // VTK_LEGACY_REMOVE
218 
224  void SetRequestedRenderModeToRayCast();
225 
230  void SetRequestedRenderModeToOSPRay();
231 
233 
236  vtkGetMacro( RequestedRenderMode, int );
238 
240 
247  vtkSetClampMacro( InteractiveUpdateRate, double, 1.0e-10, 1.0e10 );
249 
251 
256  vtkGetMacro( InteractiveUpdateRate, double );
258 
263  int GetLastUsedRenderMode();
264 
266 
273  vtkSetMacro( MaxMemoryInBytes, vtkIdType );
274  vtkGetMacro( MaxMemoryInBytes, vtkIdType );
276 
278 
284  vtkSetClampMacro( MaxMemoryFraction, float, 0.1f, 1.0f );
285  vtkGetMacro( MaxMemoryFraction, float );
287 
289 
293  vtkSetClampMacro(InterpolationMode, int,
295  vtkGetMacro(InterpolationMode, int);
296  void SetInterpolationModeToNearestNeighbor();
297  void SetInterpolationModeToLinear();
298  void SetInterpolationModeToCubic();
300 
306  void CreateCanonicalView( vtkRenderer *ren,
307  vtkVolume *volume,
308  vtkVolume *volume2,
310  int blend_mode,
311  double viewDirection[3],
312  double viewUp[3] );
313 
318  void Render( vtkRenderer *, vtkVolume * );
319 
327 
328 protected:
331 
337  void ConnectMapperInput(vtkVolumeMapper *m);
338 
344  void ConnectFilterInput(vtkImageResample *f);
345 
346  // Window / level ivars
349 
350  // GPU mapper-specific memory ivars.
353 
354  // Used for downsampling.
356 
357  // The requested render mode is used to compute the current render mode. Note
358  // that the current render mode can be invalid if the requested mode is not
359  // supported.
362 
363  // Initialization variables.
370 
371  // This is the resample filter that may be used if we need to
372  // create a low resolution version of the volume for GPU rendering
374 
375  // If the DesiredUpdateRate of the vtkRenderWindow causing the Render is at
376  // or above this value, the render is considered interactive. Otherwise it is
377  // considered still.
379 
380  // The initialize method. Called from ComputeRenderMode whenever something
381  // relevant has changed.
382  void Initialize(vtkRenderer *ren,
383  vtkVolume *vol);
384 
385  // The method that computes the render mode from the requested render mode
386  // based on the support status for each render method.
387  void ComputeRenderMode(vtkRenderer *ren,
388  vtkVolume *vol);
389 
390  // The three potential mappers
394 #if !defined(VTK_LEGACY_REMOVE)
396 #endif // VTK_LEGACY_REMOVE
397 
398  // We need to keep track of the blend mode we had when we initialized
399  // because we need to reinitialize (and recheck hardware support) if
400  // it changes
402 
403 private:
404  vtkSmartVolumeMapper(const vtkSmartVolumeMapper&) VTK_DELETE_FUNCTION;
405  void operator=(const vtkSmartVolumeMapper&) VTK_DELETE_FUNCTION;
406 
407  vtkOSPRayVolumeInterface *OSPRayMapper;
408 };
409 
410 #endif
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:50
#define VTK_RESLICE_NEAREST
Abstract class for a volume mapper.
volume render with 3D texture mapping
#define VTK_RESLICE_CUBIC
Adaptive volume mapper.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkImageResample * GPUResampleFilter
This is the resample filter that may be used if we need to create a low resolution version of the vol...
int RayCastSupported
Initialization variables.
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkTimeStamp SupportStatusCheckTime
Initialization variables.
Resamples an image to be larger or smaller.
int LowResGPUNecessary
Initialization variables.
vtkGPUVolumeRayCastMapper * GPUMapper
The three potential mappers.
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkGPUVolumeRayCastMapper * GPULowResMapper
The three potential mappers.
int RequestedRenderMode
The requested render mode is used to compute the current render mode.
int vtkIdType
Definition: vtkType.h:287
vtkIdType MaxMemoryInBytes
GPU mapper-specific memory ivars.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
float FinalColorLevel
Window / level ivars.
vtkFixedPointVolumeRayCastMapper * RayCastMapper
The three potential mappers.
a simple class to control print indentation
Definition: vtkIndent.h:39
double InteractiveUpdateRate
If the DesiredUpdateRate of the vtkRenderWindow causing the Render is at or above this value...
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...
int CurrentRenderMode
The requested render mode is used to compute the current render mode.
represents the common properties for rendering a volume.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
create a window for renderers to draw into
Removes link dependence on optional ospray module.
int InitializedBlendMode
We need to keep track of the blend mode we had when we initialized because we need to reinitialize (a...
int Initialized
Initialization variables.
virtual void ReleaseGraphicsResources(vtkWindow *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
int GPUSupported
Initialization variables.
static vtkAlgorithm * New()
float MaxMemoryFraction
GPU mapper-specific memory ivars.
int InterpolationMode
Used for downsampling.
Ray casting performed on the GPU.
vtkVolumeTextureMapper3D * TextureMapper
float FinalColorWindow
Window / level ivars.