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 =========================================================================*/
108 #ifndef vtkSmartVolumeMapper_h
109 #define vtkSmartVolumeMapper_h
110 
111 #include "vtkRenderingVolumeOpenGLModule.h" // For export macro
112 #include "vtkVolumeMapper.h"
113 #include "vtkImageReslice.h" // for VTK_RESLICE_NEAREST, VTK_RESLICE_CUBIC
114 
117 class vtkImageResample;
118 class vtkRenderWindow;
119 class vtkVolume;
120 class vtkVolumeProperty;
122 
123 class VTKRENDERINGVOLUMEOPENGL_EXPORT vtkSmartVolumeMapper : public vtkVolumeMapper
124 {
125 public:
126  static vtkSmartVolumeMapper *New();
128  void PrintSelf( ostream& os, vtkIndent indent );
129 
131 
137  vtkSetMacro( FinalColorWindow, float );
139 
141 
142  vtkGetMacro( FinalColorWindow, float );
144 
146 
150  vtkSetMacro( FinalColorLevel, float );
152 
154 
155  vtkGetMacro( FinalColorLevel, float );
157 
158 //BTX
159 // The possible values for the default and current render mode ivars
160  enum
161  {
162  DefaultRenderMode=0,
168  InvalidRenderMode
169  };
170 //ETX
171 
174  void SetRequestedRenderMode(int mode);
175 
180  void SetRequestedRenderModeToDefault();
181 
185  void SetRequestedRenderModeToGPU();
186 
189  void SetRequestedRenderModeToTexture();
190 
196  void SetRequestedRenderModeToRayCastAndTexture();
197 
202  void SetRequestedRenderModeToRayCast();
203 
205 
206  vtkGetMacro( RequestedRenderMode, int );
208 
210 
215  vtkSetClampMacro( InteractiveUpdateRate, double, 1.0e-10, 1.0e10 );
217 
219 
221  vtkGetMacro( InteractiveUpdateRate, double );
223 
226  int GetLastUsedRenderMode();
227 
229 
233  vtkSetMacro( MaxMemoryInBytes, vtkIdType );
234  vtkGetMacro( MaxMemoryInBytes, vtkIdType );
236 
238 
241  vtkSetClampMacro( MaxMemoryFraction, float, 0.1f, 1.0f );
242  vtkGetMacro( MaxMemoryFraction, float );
244 
246 
248  vtkSetClampMacro(InterpolationMode, int,
250  vtkGetMacro(InterpolationMode, int);
251  void SetInterpolationModeToNearestNeighbor();
252  void SetInterpolationModeToLinear();
253  void SetInterpolationModeToCubic();
255 
257 
260  void CreateCanonicalView( vtkRenderer *ren,
261  vtkVolume *volume,
262  vtkVolume *volume2,
264  int blend_mode,
265  double viewDirection[3],
266  double viewUp[3] );
268 
269 
270 //BTX
273  void Render( vtkRenderer *, vtkVolume * );
274 
276 
281 //ETX
283 
284 protected:
287 
291  void ConnectMapperInput(vtkVolumeMapper *m);
292 
296  void ConnectFilterInput(vtkImageResample *f);
297 
298  // Window / level ivars
301 
302  // GPU mapper-specific memory ivars.
305 
306  // Used for downsampling.
308 
309  // The requested render mode is used to compute the current render mode. Note
310  // that the current render mode can be invalid if the requested mode is not
311  // supported.
314 
315  // Initialization variables.
322 
323  // This is the resample filter that may be used if we need to
324  // create a low resolution version of the volume for GPU rendering
326 
327  // If the DesiredUpdateRate of the vtkRenderWindow causing the Render is at
328  // or above this value, the render is considered interactive. Otherwise it is
329  // considered still.
331 
332  // The initialize method. Called from ComputeRenderMode whenever something
333  // relevant has changed.
334  void Initialize(vtkRenderer *ren,
335  vtkVolume *vol);
336 
337  // The method that computes the render mode from the requested render mode
338  // based on the support status for each render method.
339  void ComputeRenderMode(vtkRenderer *ren,
340  vtkVolume *vol);
341 
342  // The three potential mappers
347 
348 
349  // We need to keep track of the blend mode we had when we initialized
350  // because we need to reinitialize (and recheck hardware support) if
351  // it changes
353 
354 private:
355  vtkSmartVolumeMapper(const vtkSmartVolumeMapper&); // Not implemented.
356  void operator=(const vtkSmartVolumeMapper&); // Not implemented.
357 };
358 
359 #endif
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:49
#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:62
vtkGPUVolumeRayCastMapper * GPULowResMapper
int vtkIdType
Definition: vtkType.h:247
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