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 =========================================================================*/
109 #ifndef vtkSmartVolumeMapper_h
110 #define vtkSmartVolumeMapper_h
111 
112 #include "vtkRenderingVolumeOpenGLModule.h" // For export macro
113 #include "vtkVolumeMapper.h"
114 #include "vtkImageReslice.h" // for VTK_RESLICE_NEAREST, VTK_RESLICE_CUBIC
115 
118 class vtkImageResample;
120 class vtkRenderWindow;
121 class vtkVolume;
122 class vtkVolumeProperty;
123 
124 class VTKRENDERINGVOLUMEOPENGL_EXPORT vtkSmartVolumeMapper : public vtkVolumeMapper
125 {
126 public:
127  static vtkSmartVolumeMapper *New();
129  void PrintSelf( ostream& os, vtkIndent indent ) override;
130 
132 
142  vtkSetMacro( FinalColorWindow, float );
144 
146 
149  vtkGetMacro( FinalColorWindow, float );
151 
153 
160  vtkSetMacro( FinalColorLevel, float );
162 
164 
167  vtkGetMacro( FinalColorLevel, float );
169 
170 // The possible values for the default and current render mode ivars
171  enum
172  {
173  DefaultRenderMode=0,
180  InvalidRenderMode
181  };
182 
187  void SetRequestedRenderMode(int mode);
188 
194  void SetRequestedRenderModeToDefault();
195 
201  void SetRequestedRenderModeToGPU();
202 
208  void SetRequestedRenderModeToRayCast();
209 
214  void SetRequestedRenderModeToOSPRay();
215 
217 
220  vtkGetMacro( RequestedRenderMode, int );
222 
224 
231  vtkSetClampMacro( InteractiveUpdateRate, double, 1.0e-10, 1.0e10 );
233 
235 
240  vtkGetMacro( InteractiveUpdateRate, double );
242 
247  int GetLastUsedRenderMode();
248 
250 
257  vtkSetMacro( MaxMemoryInBytes, vtkIdType );
258  vtkGetMacro( MaxMemoryInBytes, vtkIdType );
260 
262 
268  vtkSetClampMacro( MaxMemoryFraction, float, 0.1f, 1.0f );
269  vtkGetMacro( MaxMemoryFraction, float );
271 
273 
277  vtkSetClampMacro(InterpolationMode, int,
279  vtkGetMacro(InterpolationMode, int);
280  void SetInterpolationModeToNearestNeighbor();
281  void SetInterpolationModeToLinear();
282  void SetInterpolationModeToCubic();
284 
290  void CreateCanonicalView( vtkRenderer *ren,
291  vtkVolume *volume,
292  vtkVolume *volume2,
294  int blend_mode,
295  double viewDirection[3],
296  double viewUp[3] );
297 
302  void Render( vtkRenderer *, vtkVolume * ) override;
303 
310  void ReleaseGraphicsResources(vtkWindow *) override;
311 
312 protected:
314  ~vtkSmartVolumeMapper() override;
315 
321  void ConnectMapperInput(vtkVolumeMapper *m);
322 
328  void ConnectFilterInput(vtkImageResample *f);
329 
330  // Window / level ivars
333 
334  // GPU mapper-specific memory ivars.
337 
338  // Used for downsampling.
340 
341  // The requested render mode is used to compute the current render mode. Note
342  // that the current render mode can be invalid if the requested mode is not
343  // supported.
346 
347  // Initialization variables.
354 
355  // This is the resample filter that may be used if we need to
356  // create a low resolution version of the volume for GPU rendering
358 
359  // If the DesiredUpdateRate of the vtkRenderWindow causing the Render is at
360  // or above this value, the render is considered interactive. Otherwise it is
361  // considered still.
363 
364  // The initialize method. Called from ComputeRenderMode whenever something
365  // relevant has changed.
366  void Initialize(vtkRenderer *ren,
367  vtkVolume *vol);
368 
369  // The method that computes the render mode from the requested render mode
370  // based on the support status for each render method.
371  void ComputeRenderMode(vtkRenderer *ren,
372  vtkVolume *vol);
373 
374  // The three potential mappers
378 
379  // We need to keep track of the blend mode we had when we initialized
380  // because we need to reinitialize (and recheck hardware support) if
381  // it changes
383 
384 private:
386  void operator=(const vtkSmartVolumeMapper&) = delete;
387 
388  vtkOSPRayVolumeInterface *OSPRayMapper;
389 };
390 
391 #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.