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 
181  void SetRequestedRenderModeToRayCastAndTexture();
182 
187  void SetRequestedRenderModeToRayCast();
188 
190 
191  vtkGetMacro( RequestedRenderMode, int );
193 
195 
200  vtkSetClampMacro( InteractiveUpdateRate, double, 1.0e-10, 1.0e10 );
202 
204 
206  vtkGetMacro( InteractiveUpdateRate, double );
208 
211  int GetLastUsedRenderMode();
212 
214 
218  vtkSetMacro( MaxMemoryInBytes, vtkIdType );
219  vtkGetMacro( MaxMemoryInBytes, vtkIdType );
221 
223 
226  vtkSetClampMacro( MaxMemoryFraction, float, 0.1f, 1.0f );
227  vtkGetMacro( MaxMemoryFraction, float );
229 
231 
233  vtkSetClampMacro(InterpolationMode, int,
235  vtkGetMacro(InterpolationMode, int);
236  void SetInterpolationModeToNearestNeighbor();
237  void SetInterpolationModeToLinear();
238  void SetInterpolationModeToCubic();
240 
242 
245  void CreateCanonicalView( vtkRenderer *ren,
246  vtkVolume *volume,
247  vtkVolume *volume2,
249  int blend_mode,
250  double viewDirection[3],
251  double viewUp[3] );
253 
254 
255 //BTX
258  void Render( vtkRenderer *, vtkVolume * );
259 
261 
266 //ETX
268 
269 protected:
272 
276  void ConnectMapperInput(vtkVolumeMapper *m);
277 
281  void ConnectFilterInput(vtkImageResample *f);
282 
283  // Window / level ivars
286 
287  // GPU mapper-specific memory ivars.
290 
291  // Used for downsampling.
293 
294  // The requested render mode is used to compute the current render mode. Note
295  // that the current render mode can be invalid if the requested mode is not
296  // supported.
299 
300  // Initialization variables.
307 
308  // This is the resample filter that may be used if we need to
309  // create a low resolution version of the volume for GPU rendering
311 
312  // If the DesiredUpdateRate of the vtkRenderWindow causing the Render is at
313  // or above this value, the render is considered interactive. Otherwise it is
314  // considered still.
316 
317  // The initialize method. Called from ComputeRenderMode whenever something
318  // relevant has changed.
319  void Initialize(vtkRenderer *ren,
320  vtkVolume *vol);
321 
322  // The method that computes the render mode from the requested render mode
323  // based on the support status for each render method.
324  void ComputeRenderMode(vtkRenderer *ren,
325  vtkVolume *vol);
326 
327  // The three potential mappers
332 
333 
334  // We need to keep track of the blend mode we had when we initialized
335  // because we need to reinitialize (and recheck hardware support) if
336  // it changes
338 
339 private:
340  vtkSmartVolumeMapper(const vtkSmartVolumeMapper&); // Not implemented.
341  void operator=(const vtkSmartVolumeMapper&); // Not implemented.
342 };
343 
344 #endif
GLclampf f
Definition: vtkgl.h:14181
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
GLenum GLsizei GLenum GLenum const GLvoid * image
Definition: vtkgl.h:11341
#define VTK_RESLICE_CUBIC
Adaptive volume mapper.
void PrintSelf(ostream &os, vtkIndent indent)
vtkImageResample * GPUResampleFilter
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
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
#define vtkSetClampMacro(name, type, min, max)
Definition: vtkSetGet.h:133
int vtkIdType
Definition: vtkType.h:281
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:632
window superclass for vtkRenderWindow
Definition: vtkWindow.h:33
vtkFixedPointVolumeRayCastMapper * RayCastMapper
a simple class to control print indentation
Definition: vtkIndent.h:38
const GLfloat * m
Definition: vtkgl.h:18169
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
GLenum mode
Definition: vtkgl.h:12325
#define vtkSetMacro(name, type)
Definition: vtkSetGet.h:69