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 =========================================================================*/
79 #ifndef vtkSmartVolumeMapper_h
80 #define vtkSmartVolumeMapper_h
81 
82 #include "vtkRenderingVolumeOpenGL2Module.h" // For export macro
83 #include "vtkVolumeMapper.h"
84 #include "vtkImageReslice.h" // for VTK_RESLICE_NEAREST, VTK_RESLICE_CUBIC
85 
88 class vtkImageResample;
90 class vtkRenderWindow;
91 class vtkVolume;
92 class vtkVolumeProperty;
93 class vtkImageMagnitude;
94 
95 class VTKRENDERINGVOLUMEOPENGL2_EXPORT vtkSmartVolumeMapper : public vtkVolumeMapper
96 {
97 public:
98  static vtkSmartVolumeMapper *New();
100  void PrintSelf( ostream& os, vtkIndent indent );
101 
103 
113  vtkSetMacro( FinalColorWindow, float );
115 
117 
120  vtkGetMacro( FinalColorWindow, float );
122 
124 
131  vtkSetMacro( FinalColorLevel, float );
133 
135 
138  vtkGetMacro( FinalColorLevel, float );
140 
141 // The possible values for the default and current render mode ivars
142  enum
143  {
144  DefaultRenderMode=0,
145 #if !defined(VTK_LEGACY_REMOVE)
146  RayCastAndTextureRenderMode=1,
147 #endif // !VTK_LEGACY_REMOVE
148  RayCastRenderMode=2,
149 #if !defined(VTK_LEGACY_REMOVE)
150  TextureRenderMode=3,
151 #endif // !VTK_LEGACY_REMOVE
152  GPURenderMode=4,
153  UndefinedRenderMode=5,
154  OSPRayRenderMode=6,
155  InvalidRenderMode=7
156  };
157 
162  void SetRequestedRenderMode(int mode);
163 
169  void SetRequestedRenderModeToDefault();
170 
176  void SetRequestedRenderModeToRayCast();
177 
183  void SetRequestedRenderModeToGPU();
184 
189  void SetRequestedRenderModeToOSPRay();
190 
192 
195  vtkGetMacro( RequestedRenderMode, int );
197 
202  int GetLastUsedRenderMode();
203 
205 
212  vtkSetMacro( MaxMemoryInBytes, vtkIdType );
213  vtkGetMacro( MaxMemoryInBytes, vtkIdType );
215 
217 
223  vtkSetClampMacro( MaxMemoryFraction, float, 0.1f, 1.0f );
224  vtkGetMacro( MaxMemoryFraction, float );
226 
228 
232  vtkSetClampMacro(InterpolationMode, int,
234  vtkGetMacro(InterpolationMode, int);
235  void SetInterpolationModeToNearestNeighbor();
236  void SetInterpolationModeToLinear();
237  void SetInterpolationModeToCubic();
239 
245  void CreateCanonicalView( vtkRenderer *ren,
246  vtkVolume *volume,
247  vtkVolume *volume2,
249  int blend_mode,
250  double viewDirection[3],
251  double viewUp[3] );
252 
254 
260  vtkSetClampMacro( InteractiveUpdateRate, double, 1.0e-10, 1.0e10 );
262 
264 
269  vtkGetMacro( InteractiveUpdateRate, double );
271 
273 
281  vtkSetClampMacro( InteractiveAdjustSampleDistances, int, 0, 1);
282  vtkGetMacro( InteractiveAdjustSampleDistances, int);
283  vtkBooleanMacro( InteractiveAdjustSampleDistances, int);
285 
287 
296  vtkSetClampMacro( AutoAdjustSampleDistances, int, 0, 1 );
297  vtkGetMacro( AutoAdjustSampleDistances, int );
298  vtkBooleanMacro( AutoAdjustSampleDistances, int );
300 
302 
309  vtkSetMacro( SampleDistance, float );
310  vtkGetMacro( SampleDistance, float );
312 
317  void Render( vtkRenderer *, vtkVolume * );
318 
326 
328 
336  {
337  DISABLED = -1,
338  MAGNITUDE = 0,
339  COMPONENT = 1,
340  };
341 
342  vtkSetClampMacro(VectorMode, int, -1, 1);
343  vtkGetMacro(VectorMode, int);
344 
345  vtkSetClampMacro(VectorComponent, int, 0, 3);
346  vtkGetMacro(VectorComponent, int);
348 
349 protected:
352 
358  void ConnectMapperInput(vtkVolumeMapper *m);
359 
365  void ConnectFilterInput(vtkImageResample *f);
366 
368 
371  float FinalColorWindow;
372  float FinalColorLevel;
374 
376 
379  vtkIdType MaxMemoryInBytes;
380  float MaxMemoryFraction;
382 
386  int InterpolationMode;
387 
389 
394  int RequestedRenderMode;
395  int CurrentRenderMode;
397 
399 
402  int Initialized;
403  vtkTimeStamp SupportStatusCheckTime;
404  int GPUSupported;
405  int RayCastSupported;
406  int LowResGPUNecessary;
408 
413  vtkImageResample* GPUResampleFilter;
414 
416 
428 
433  void Initialize(vtkRenderer *ren,
434  vtkVolume *vol);
435 
440  void ComputeRenderMode(vtkRenderer *ren,
441  vtkVolume *vol);
442 
444 
447  vtkGPUVolumeRayCastMapper *GPULowResMapper;
448  vtkGPUVolumeRayCastMapper *GPUMapper;
449  vtkFixedPointVolumeRayCastMapper *RayCastMapper;
451 
452 
458  int InitializedBlendMode;
459 
464 
470 
476  double InteractiveUpdateRate;
477 
486 
488 
498 
499 private:
504  void SetupVectorMode(vtkVolume* vol);
505 
506  vtkSmartVolumeMapper(const vtkSmartVolumeMapper&) VTK_DELETE_FUNCTION;
507  void operator=(const vtkSmartVolumeMapper&) VTK_DELETE_FUNCTION;
508 
509  vtkOSPRayVolumeInterface *OSPRayMapper;
510 };
511 
512 #endif
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:50
#define VTK_RESLICE_NEAREST
Abstract class for a volume mapper.
int VectorComponent
VectorMode is a special rendering mode for 3-component vectors which makes use of GPURayCastMapper's ...
#define VTK_RESLICE_CUBIC
Adaptive volume mapper.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
record modification and/or execution time
Definition: vtkTimeStamp.h:35
Resamples an image to be larger or smaller.
abstract specification for renderers
Definition: vtkRenderer.h:63
int vtkIdType
Definition: vtkType.h:287
float SampleDistance
The distance between sample points along the ray.
int VectorMode
VectorMode is a special rendering mode for 3-component vectors which makes use of GPURayCastMapper's ...
vtkImageMagnitude * ImageMagnitude
This filter is used to compute the magnitude of 3-component data.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
VectorModeType
VectorMode is a special rendering mode for 3-component vectors which makes use of GPURayCastMapper's ...
a simple class to control print indentation
Definition: vtkIndent.h:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
Colapses components with magnitude function.
virtual void Render(vtkRenderer *ren, vtkVolume *vol)=0
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
represents the common properties for rendering a volume.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
create a window for renderers to draw into
Removes link dependence on optional ospray module.
int InteractiveAdjustSampleDistances
If the InteractiveAdjustSampleDistances flag is enabled, vtkSmartVolumeMapper interactively sets and ...
int AutoAdjustSampleDistances
Set whether or not the sample distance should be automatically calculated within the internal volume ...
virtual void ReleaseGraphicsResources(vtkWindow *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
static vtkAlgorithm * New()
vtkImageData * InputDataMagnitude
This filter is used to compute the magnitude of 3-component data.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
Ray casting performed on the GPU.