VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vtkSmartVolumeMapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkFixedPointRayCastImage.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 "vtkRenderingVolumeModule.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 
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 
187  void SetRequestedRenderModeToRayCastAndTexture();
188 
193  void SetRequestedRenderModeToRayCast();
194 
196 
197  vtkGetMacro( RequestedRenderMode, int );
199 
201 
206  vtkSetClampMacro( InteractiveUpdateRate, double, 1.0e-10, 1.0e10 );
208 
210 
212  vtkGetMacro( InteractiveUpdateRate, double );
214 
217  int GetLastUsedRenderMode();
218 
220 
224  vtkSetMacro( MaxMemoryInBytes, vtkIdType );
225  vtkGetMacro( MaxMemoryInBytes, vtkIdType );
227 
229 
232  vtkSetClampMacro( MaxMemoryFraction, float, 0.1f, 1.0f );
233  vtkGetMacro( MaxMemoryFraction, float );
235 
237 
239  vtkSetClampMacro(InterpolationMode, int,
241  vtkGetMacro(InterpolationMode, int);
242  void SetInterpolationModeToNearestNeighbor();
243  void SetInterpolationModeToLinear();
244  void SetInterpolationModeToCubic();
246 
248 
251  void CreateCanonicalView( vtkRenderer *ren,
252  vtkVolume *volume,
253  vtkVolume *volume2,
255  int blend_mode,
256  double viewDirection[3],
257  double viewUp[3] );
259 
260 
261 //BTX
264  void Render( vtkRenderer *, vtkVolume * );
265 
267 
272 //ETX
274 
275 protected:
278 
282  void ConnectMapperInput(vtkVolumeMapper *m);
283 
287  void ConnectFilterInput(vtkImageResample *f);
288 
289  // Window / level ivars
292 
293  // GPU mapper-specific memory ivars.
296 
297  // Used for downsampling.
299 
300  // The requested render mode is used to compute the current render mode. Note
301  // that the current render mode can be invalid if the requested mode is not
302  // supported.
305 
306  // Initialization variables.
313 
314  // This is the resample filter that may be used if we need to
315  // create a low resolution version of the volume for GPU rendering
317 
318  // If the DesiredUpdateRate of the vtkRenderWindow causing the Render is at
319  // or above this value, the render is considered interactive. Otherwise it is
320  // considered still.
322 
323  // The initialize method. Called from ComputeRenderMode whenever something
324  // relevant has changed.
325  void Initialize(vtkRenderer *ren,
326  vtkVolume *vol);
327 
328  // The method that computes the render mode from the requested render mode
329  // based on the support status for each render method.
330  void ComputeRenderMode(vtkRenderer *ren,
331  vtkVolume *vol);
332 
333  // The three potential mappers
338 
339 
340  // We need to keep track of the blend mode we had when we initialized
341  // because we need to reinitialize (and recheck hardware support) if
342  // it changes
344 
345 private:
346  vtkSmartVolumeMapper(const vtkSmartVolumeMapper&); // Not implemented.
347  void operator=(const vtkSmartVolumeMapper&); // Not implemented.
348 };
349 
350 #endif
GLclampf f
Definition: vtkgl.h:14181
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
GLenum GLsizei GLenum GLenum const GLvoid * image
Definition: vtkgl.h:11341
#define VTK_RESLICE_CUBIC
Adaptive volume mapper.
void PrintSelf(ostream &os, vtkIndent indent)
#define VTKRENDERINGVOLUME_EXPORT
#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.
vtkFixedPointVolumeRayCastMapper * RayCastMapper
vtkGPUVolumeRayCastMapper * GPULowResMapper
abstract specification for renderers
Definition: vtkRenderer.h:63
#define vtkSetClampMacro(name, type, min, max)
Definition: vtkSetGet.h:133
int vtkIdType
Definition: vtkType.h:268
vtkImageResample * GPUResampleFilter
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
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
vtkGPUVolumeRayCastMapper * GPUMapper
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