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 
118 class VTKRENDERINGVOLUMEOPENGL_EXPORT vtkSmartVolumeMapper : public vtkVolumeMapper
119 {
120 public:
121  static vtkSmartVolumeMapper *New();
123  void PrintSelf( ostream& os, vtkIndent indent ) override;
124 
126 
136  vtkSetMacro( FinalColorWindow, float );
138 
140 
143  vtkGetMacro( FinalColorWindow, float );
145 
147 
154  vtkSetMacro( FinalColorLevel, float );
156 
158 
161  vtkGetMacro( FinalColorLevel, float );
163 
164 // The possible values for the default and current render mode ivars
165  enum
166  {
167  DefaultRenderMode=0,
174  InvalidRenderMode
175  };
176 
181  void SetRequestedRenderMode(int mode);
182 
188  void SetRequestedRenderModeToDefault();
189 
195  void SetRequestedRenderModeToGPU();
196 
202  void SetRequestedRenderModeToRayCast();
203 
208  void SetRequestedRenderModeToOSPRay();
209 
211 
214  vtkGetMacro( RequestedRenderMode, int );
216 
218 
225  vtkSetClampMacro( InteractiveUpdateRate, double, 1.0e-10, 1.0e10 );
227 
229 
234  vtkGetMacro( InteractiveUpdateRate, double );
236 
241  int GetLastUsedRenderMode();
242 
244 
251  vtkSetMacro( MaxMemoryInBytes, vtkIdType );
252  vtkGetMacro( MaxMemoryInBytes, vtkIdType );
254 
256 
262  vtkSetClampMacro( MaxMemoryFraction, float, 0.1f, 1.0f );
263  vtkGetMacro( MaxMemoryFraction, float );
265 
267 
271  vtkSetClampMacro(InterpolationMode, int,
273  vtkGetMacro(InterpolationMode, int);
274  void SetInterpolationModeToNearestNeighbor();
275  void SetInterpolationModeToLinear();
276  void SetInterpolationModeToCubic();
278 
284  void CreateCanonicalView( vtkRenderer *ren,
285  vtkVolume *volume,
286  vtkVolume *volume2,
288  int blend_mode,
289  double viewDirection[3],
290  double viewUp[3] );
291 
296  void Render( vtkRenderer *, vtkVolume * ) override;
297 
304  void ReleaseGraphicsResources(vtkWindow *) override;
305 
306 protected:
308  ~vtkSmartVolumeMapper() override;
309 
315  void ConnectMapperInput(vtkVolumeMapper *m);
316 
322  void ConnectFilterInput(vtkImageResample *f);
323 
324  // Window / level ivars
327 
328  // GPU mapper-specific memory ivars.
331 
332  // Used for downsampling.
334 
335  // The requested render mode is used to compute the current render mode. Note
336  // that the current render mode can be invalid if the requested mode is not
337  // supported.
340 
341  // Initialization variables.
348 
349  // This is the resample filter that may be used if we need to
350  // create a low resolution version of the volume for GPU rendering
352 
353  // If the DesiredUpdateRate of the vtkRenderWindow causing the Render is at
354  // or above this value, the render is considered interactive. Otherwise it is
355  // considered still.
357 
358  // The initialize method. Called from ComputeRenderMode whenever something
359  // relevant has changed.
360  void Initialize(vtkRenderer *ren,
361  vtkVolume *vol);
362 
363  // The method that computes the render mode from the requested render mode
364  // based on the support status for each render method.
365  void ComputeRenderMode(vtkRenderer *ren,
366  vtkVolume *vol);
367 
368  // The three potential mappers
372 
373  // We need to keep track of the blend mode we had when we initialized
374  // because we need to reinitialize (and recheck hardware support) if
375  // it changes
377 
378 private:
380  void operator=(const vtkSmartVolumeMapper&) = delete;
381 
382  vtkOSPRayVolumeInterface *OSPRayMapper;
383 };
384 
385 #endif
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:50
#define VTK_RESLICE_NEAREST
Abstract class for a volume mapper.
#define VTK_RESLICE_CUBIC
Adaptive volume mapper.
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:345
vtkIdType MaxMemoryInBytes
GPU mapper-specific memory ivars.
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
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
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.
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
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.
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.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
float FinalColorWindow
Window / level ivars.