VTK
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 "vtkVolumeMapper.h"
112 #include "vtkImageReslice.h" // for VTK_RESLICE_NEAREST, VTK_RESLICE_CUBIC
113 
116 class vtkImageResample;
117 class vtkRenderWindow;
118 class vtkVolume;
119 class vtkVolumeProperty;
121 
123 {
124 public:
125  static vtkSmartVolumeMapper *New();
127  void PrintSelf( ostream& os, vtkIndent indent );
128 
130 
136  vtkSetMacro( FinalColorWindow, float );
138 
140 
141  vtkGetMacro( FinalColorWindow, float );
143 
145 
149  vtkSetMacro( FinalColorLevel, float );
151 
153 
154  vtkGetMacro( FinalColorLevel, float );
156 
157 //BTX
158 // The possible values for the default and current render mode ivars
159  enum
160  {
161  DefaultRenderMode=0,
167  InvalidRenderMode
168  };
169 //ETX
170 
173  void SetRequestedRenderMode(int mode);
174 
179  void SetRequestedRenderModeToDefault();
180 
186  void SetRequestedRenderModeToRayCastAndTexture();
187 
192  void SetRequestedRenderModeToRayCast();
193 
195 
196  vtkGetMacro( RequestedRenderMode, int );
198 
200 
205  vtkSetClampMacro( InteractiveUpdateRate, double, 1.0e-10, 1.0e10 );
207 
209 
211  vtkGetMacro( InteractiveUpdateRate, double );
213 
216  int GetLastUsedRenderMode();
217 
219 
223  vtkSetMacro( MaxMemoryInBytes, vtkIdType );
224  vtkGetMacro( MaxMemoryInBytes, vtkIdType );
226 
228 
231  vtkSetClampMacro( MaxMemoryFraction, float, 0.1f, 1.0f );
232  vtkGetMacro( MaxMemoryFraction, float );
234 
236 
238  vtkSetClampMacro(InterpolationMode, int,
240  vtkGetMacro(InterpolationMode, int);
241  void SetInterpolationModeToNearestNeighbor();
242  void SetInterpolationModeToLinear();
243  void SetInterpolationModeToCubic();
245 
247 
250  void CreateCanonicalView( vtkRenderer *ren,
251  vtkVolume *volume,
252  vtkVolume *volume2,
254  int blend_mode,
255  double viewDirection[3],
256  double viewUp[3] );
258 
259 
260 //BTX
263  void Render( vtkRenderer *, vtkVolume * );
264 
266 
271 //ETX
273 
274 protected:
277 
281  void ConnectMapperInput(vtkVolumeMapper *m);
282 
286  void ConnectFilterInput(vtkImageResample *f);
287 
288  // Window / level ivars
291 
292  // GPU mapper-specific memory ivars.
295 
296  // Used for downsampling.
298 
299  // The requested render mode is used to compute the current render mode. Note
300  // that the current render mode can be invalid if the requested mode is not
301  // supported.
304 
305  // Initialization variables.
312 
313  // This is the resample filter that may be used if we need to
314  // create a low resolution version of the volume for GPU rendering
316 
317  // If the DesiredUpdateRate of the vtkRenderWindow causing the Render is at
318  // or above this value, the render is considered interactive. Otherwise it is
319  // considered still.
321 
322  // The initialize method. Called from ComputeRenderMode whenever something
323  // relevant has changed.
324  void Initialize(vtkRenderer *ren,
325  vtkVolume *vol);
326 
327  // The method that computes the render mode from the requested render mode
328  // based on the support status for each render method.
329  void ComputeRenderMode(vtkRenderer *ren,
330  vtkVolume *vol);
331 
332  // The three potential mappers
337 
338 
339  // We need to keep track of the blend mode we had when we initialized
340  // because we need to reinitialize (and recheck hardware support) if
341  // it changes
343 
344 private:
345  vtkSmartVolumeMapper(const vtkSmartVolumeMapper&); // Not implemented.
346  void operator=(const vtkSmartVolumeMapper&); // Not implemented.
347 };
348 
349 #endif