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 =========================================================================*/
102 #ifndef vtkSmartVolumeMapper_h
103 #define vtkSmartVolumeMapper_h
104 
105 #include "vtkRenderingVolumeOpenGLModule.h" // For export macro
106 #include "vtkVolumeMapper.h"
107 #include "vtkImageReslice.h" // for VTK_RESLICE_NEAREST, VTK_RESLICE_CUBIC
108 
111 class vtkImageResample;
112 class vtkRenderWindow;
113 class vtkVolume;
114 class vtkVolumeProperty;
116 
118 {
119 public:
120  static vtkSmartVolumeMapper *New();
122  void PrintSelf( ostream& os, vtkIndent indent );
123 
125 
131  vtkSetMacro( FinalColorWindow, float );
133 
135 
136  vtkGetMacro( FinalColorWindow, float );
138 
140 
144  vtkSetMacro( FinalColorLevel, float );
146 
148 
149  vtkGetMacro( FinalColorLevel, float );
151 
152 //BTX
153 // The possible values for the default and current render mode ivars
154  enum
155  {
156  DefaultRenderMode=0,
162  InvalidRenderMode
163  };
164 //ETX
165 
168  void SetRequestedRenderMode(int mode);
169 
174  void SetRequestedRenderModeToDefault();
175 
179  void SetRequestedRenderModeToGPU();
180 
183  void SetRequestedRenderModeToTexture();
184 
190  void SetRequestedRenderModeToRayCastAndTexture();
191 
196  void SetRequestedRenderModeToRayCast();
197 
199 
200  vtkGetMacro( RequestedRenderMode, int );
202 
204 
209  vtkSetClampMacro( InteractiveUpdateRate, double, 1.0e-10, 1.0e10 );
211 
213 
215  vtkGetMacro( InteractiveUpdateRate, double );
217 
220  int GetLastUsedRenderMode();
221 
223 
227  vtkSetMacro( MaxMemoryInBytes, vtkIdType );
228  vtkGetMacro( MaxMemoryInBytes, vtkIdType );
230 
232 
235  vtkSetClampMacro( MaxMemoryFraction, float, 0.1f, 1.0f );
236  vtkGetMacro( MaxMemoryFraction, float );
238 
240 
242  vtkSetClampMacro(InterpolationMode, int,
244  vtkGetMacro(InterpolationMode, int);
245  void SetInterpolationModeToNearestNeighbor();
246  void SetInterpolationModeToLinear();
247  void SetInterpolationModeToCubic();
249 
251 
254  void CreateCanonicalView( vtkRenderer *ren,
255  vtkVolume *volume,
256  vtkVolume *volume2,
258  int blend_mode,
259  double viewDirection[3],
260  double viewUp[3] );
262 
263 
264 //BTX
267  void Render( vtkRenderer *, vtkVolume * );
268 
270 
275 //ETX
277 
278 protected:
281 
285  void ConnectMapperInput(vtkVolumeMapper *m);
286 
290  void ConnectFilterInput(vtkImageResample *f);
291 
292  // Window / level ivars
295 
296  // GPU mapper-specific memory ivars.
299 
300  // Used for downsampling.
302 
303  // The requested render mode is used to compute the current render mode. Note
304  // that the current render mode can be invalid if the requested mode is not
305  // supported.
308 
309  // Initialization variables.
316 
317  // This is the resample filter that may be used if we need to
318  // create a low resolution version of the volume for GPU rendering
320 
321  // If the DesiredUpdateRate of the vtkRenderWindow causing the Render is at
322  // or above this value, the render is considered interactive. Otherwise it is
323  // considered still.
325 
326  // The initialize method. Called from ComputeRenderMode whenever something
327  // relevant has changed.
328  void Initialize(vtkRenderer *ren,
329  vtkVolume *vol);
330 
331  // The method that computes the render mode from the requested render mode
332  // based on the support status for each render method.
333  void ComputeRenderMode(vtkRenderer *ren,
334  vtkVolume *vol);
335 
336  // The three potential mappers
341 
342 
343  // We need to keep track of the blend mode we had when we initialized
344  // because we need to reinitialize (and recheck hardware support) if
345  // it changes
347 
348 private:
349  vtkSmartVolumeMapper(const vtkSmartVolumeMapper&); // Not implemented.
350  void operator=(const vtkSmartVolumeMapper&); // Not implemented.
351 };
352 
353 #endif
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:49
#define VTKRENDERINGVOLUMEOPENGL_EXPORT
#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)
vtkImageResample * GPUResampleFilter
record modification and/or execution time
Definition: vtkTimeStamp.h:34
vtkTimeStamp SupportStatusCheckTime
Resamples an image to be larger or smaller.
vtkGPUVolumeRayCastMapper * GPUMapper
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkGPUVolumeRayCastMapper * GPULowResMapper
int vtkIdType
Definition: vtkType.h:275
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
vtkFixedPointVolumeRayCastMapper * RayCastMapper
a simple class to control print indentation
Definition: vtkIndent.h:38
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
virtual void Render(vtkRenderer *ren, vtkVolume *vol)=0
represents the common properties for rendering a volume.
create a window for renderers to draw into
virtual void ReleaseGraphicsResources(vtkWindow *)
static vtkAlgorithm * New()
Ray casting performed on the GPU.
vtkVolumeTextureMapper3D * TextureMapper