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;
91 class vtkRenderWindow;
92 class vtkVolume;
93 class vtkVolumeProperty;
94 class vtkImageMagnitude;
95 
96 class VTKRENDERINGVOLUMEOPENGL2_EXPORT vtkSmartVolumeMapper : public vtkVolumeMapper
97 {
98 public:
99  static vtkSmartVolumeMapper *New();
101  void PrintSelf( ostream& os, vtkIndent indent ) override;
102 
104 
114  vtkSetMacro( FinalColorWindow, float );
116 
118 
121  vtkGetMacro( FinalColorWindow, float );
123 
125 
132  vtkSetMacro( FinalColorLevel, float );
134 
136 
139  vtkGetMacro( FinalColorLevel, float );
141 
142 // The possible values for the default and current render mode ivars
143  enum
144  {
145  DefaultRenderMode=0,
146 #if !defined(VTK_LEGACY_REMOVE)
147  RayCastAndTextureRenderMode=1,
148 #endif // !VTK_LEGACY_REMOVE
149  RayCastRenderMode=2,
150 #if !defined(VTK_LEGACY_REMOVE)
151  TextureRenderMode=3,
152 #endif // !VTK_LEGACY_REMOVE
153  GPURenderMode=4,
154  OSPRayRenderMode=5,
155  UndefinedRenderMode=6,
156  InvalidRenderMode=7
157  };
158 
163  void SetRequestedRenderMode(int mode);
164 
170  void SetRequestedRenderModeToDefault();
171 
177  void SetRequestedRenderModeToRayCast();
178 
184  void SetRequestedRenderModeToGPU();
185 
190  void SetRequestedRenderModeToOSPRay();
191 
193 
196  vtkGetMacro( RequestedRenderMode, int );
198 
203  int GetLastUsedRenderMode();
204 
206 
213  vtkSetMacro( MaxMemoryInBytes, vtkIdType );
214  vtkGetMacro( MaxMemoryInBytes, vtkIdType );
216 
218 
224  vtkSetClampMacro( MaxMemoryFraction, float, 0.1f, 1.0f );
225  vtkGetMacro( MaxMemoryFraction, float );
227 
229 
233  vtkSetClampMacro(InterpolationMode, int,
235  vtkGetMacro(InterpolationMode, int);
236  void SetInterpolationModeToNearestNeighbor();
237  void SetInterpolationModeToLinear();
238  void SetInterpolationModeToCubic();
240 
246  void CreateCanonicalView( vtkRenderer *ren,
247  vtkVolume *volume,
248  vtkVolume *volume2,
250  int blend_mode,
251  double viewDirection[3],
252  double viewUp[3] );
253 
255 
261  vtkSetClampMacro( InteractiveUpdateRate, double, 1.0e-10, 1.0e10 );
263 
265 
270  vtkGetMacro( InteractiveUpdateRate, double );
272 
274 
282  vtkSetClampMacro( InteractiveAdjustSampleDistances, int, 0, 1);
283  vtkGetMacro( InteractiveAdjustSampleDistances, int);
284  vtkBooleanMacro( InteractiveAdjustSampleDistances, int);
286 
288 
297  vtkSetClampMacro( AutoAdjustSampleDistances, int, 0, 1 );
298  vtkGetMacro( AutoAdjustSampleDistances, int );
299  vtkBooleanMacro( AutoAdjustSampleDistances, int );
301 
303 
310  vtkSetMacro( SampleDistance, float );
311  vtkGetMacro( SampleDistance, float );
313 
318  void Render( vtkRenderer *, vtkVolume * ) override;
319 
326  void ReleaseGraphicsResources(vtkWindow *) override;
327 
329 
337  {
338  DISABLED = -1,
339  MAGNITUDE = 0,
340  COMPONENT = 1,
341  };
342 
343  void SetVectorMode(int mode);
344  vtkGetMacro(VectorMode, int);
345 
346  vtkSetClampMacro(VectorComponent, int, 0, 3);
347  vtkGetMacro(VectorComponent, int);
349 
350 protected:
352  ~vtkSmartVolumeMapper() override;
353 
359  void ConnectMapperInput(vtkVolumeMapper *m);
360 
366  void ConnectFilterInput(vtkImageResample *f);
367 
369 
372  float FinalColorWindow;
373  float FinalColorLevel;
375 
377 
380  vtkIdType MaxMemoryInBytes;
381  float MaxMemoryFraction;
383 
387  int InterpolationMode;
388 
390 
395  int RequestedRenderMode;
396  int CurrentRenderMode;
398 
400 
403  int Initialized;
404  vtkTimeStamp SupportStatusCheckTime;
405  int GPUSupported;
406  int RayCastSupported;
407  int LowResGPUNecessary;
409 
414  vtkImageResample* GPUResampleFilter;
415 
417 
429 
434  void Initialize(vtkRenderer *ren,
435  vtkVolume *vol);
436 
441  void ComputeRenderMode(vtkRenderer *ren,
442  vtkVolume *vol);
443 
448  vtkGetObjectMacro(GPUMapper, vtkGPUVolumeRayCastMapper);
449 
451 
454  vtkGPUVolumeRayCastMapper *GPULowResMapper;
455  vtkGPUVolumeRayCastMapper *GPUMapper;
456  vtkFixedPointVolumeRayCastMapper *RayCastMapper;
458 
459 
465  int InitializedBlendMode;
466 
471 
477 
483  double InteractiveUpdateRate;
484 
493 
495 
506 
507 private:
512  void SetupVectorMode(vtkVolume* vol);
513 
515  void operator=(const vtkSmartVolumeMapper&) = delete;
516 
517  vtkOSPRayVolumeInterface *OSPRayMapper;
518 };
519 
520 #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.
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:345
float SampleDistance
The distance between sample points along the ray.
Mapper to render volumes defined as vtkMultiBlockDataSet.
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.
void Render(vtkRenderer *ren, vtkVolume *vol) override=0
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
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.
represents the common properties for rendering a volume.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
create a window for renderers to draw into
Removes link dependence on optional ospray module.
vtkTimeStamp MagnitudeUploadTime
VectorMode is a special rendering mode for 3-component vectors which makes use of GPURayCastMapper's ...
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 ...
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.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.