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 =========================================================================*/
73 #ifndef vtkSmartVolumeMapper_h
74 #define vtkSmartVolumeMapper_h
75 
76 #include "vtkRenderingVolumeOpenGL2Module.h" // For export macro
77 #include "vtkVolumeMapper.h"
78 #include "vtkImageReslice.h" // for VTK_RESLICE_NEAREST, VTK_RESLICE_CUBIC
79 
82 class vtkImageResample;
85 class vtkRenderWindow;
86 class vtkVolume;
87 class vtkVolumeProperty;
88 class vtkImageMagnitude;
89 
90 class VTKRENDERINGVOLUMEOPENGL2_EXPORT vtkSmartVolumeMapper : public vtkVolumeMapper
91 {
92 public:
93  static vtkSmartVolumeMapper *New();
95  void PrintSelf( ostream& os, vtkIndent indent ) override;
96 
98 
108  vtkSetMacro( FinalColorWindow, float );
110 
112 
115  vtkGetMacro( FinalColorWindow, float );
117 
119 
126  vtkSetMacro( FinalColorLevel, float );
128 
130 
133  vtkGetMacro( FinalColorLevel, float );
135 
136 // The possible values for the default and current render mode ivars
137  enum
138  {
139  DefaultRenderMode=0,
140 #if !defined(VTK_LEGACY_REMOVE)
141  RayCastAndTextureRenderMode=1,
142 #endif // !VTK_LEGACY_REMOVE
143  RayCastRenderMode=2,
144 #if !defined(VTK_LEGACY_REMOVE)
145  TextureRenderMode=3,
146 #endif // !VTK_LEGACY_REMOVE
147  GPURenderMode=4,
148  OSPRayRenderMode=5,
149  UndefinedRenderMode=6,
150  InvalidRenderMode=7
151  };
152 
157  void SetRequestedRenderMode(int mode);
158 
164  void SetRequestedRenderModeToDefault();
165 
171  void SetRequestedRenderModeToRayCast();
172 
178  void SetRequestedRenderModeToGPU();
179 
184  void SetRequestedRenderModeToOSPRay();
185 
187 
190  vtkGetMacro( RequestedRenderMode, int );
192 
197  int GetLastUsedRenderMode();
198 
200 
207  vtkSetMacro( MaxMemoryInBytes, vtkIdType );
208  vtkGetMacro( MaxMemoryInBytes, vtkIdType );
210 
212 
218  vtkSetClampMacro( MaxMemoryFraction, float, 0.1f, 1.0f );
219  vtkGetMacro( MaxMemoryFraction, float );
221 
223 
227  vtkSetClampMacro(InterpolationMode, int,
229  vtkGetMacro(InterpolationMode, int);
230  void SetInterpolationModeToNearestNeighbor();
231  void SetInterpolationModeToLinear();
232  void SetInterpolationModeToCubic();
234 
240  void CreateCanonicalView( vtkRenderer *ren,
241  vtkVolume *volume,
242  vtkVolume *volume2,
244  int blend_mode,
245  double viewDirection[3],
246  double viewUp[3] );
247 
249 
255  vtkSetClampMacro( InteractiveUpdateRate, double, 1.0e-10, 1.0e10 );
257 
259 
264  vtkGetMacro( InteractiveUpdateRate, double );
266 
268 
276  vtkSetClampMacro( InteractiveAdjustSampleDistances, int, 0, 1);
277  vtkGetMacro( InteractiveAdjustSampleDistances, int);
278  vtkBooleanMacro( InteractiveAdjustSampleDistances, int);
280 
282 
291  vtkSetClampMacro( AutoAdjustSampleDistances, int, 0, 1 );
292  vtkGetMacro( AutoAdjustSampleDistances, int );
293  vtkBooleanMacro( AutoAdjustSampleDistances, int );
295 
297 
304  vtkSetMacro( SampleDistance, float );
305  vtkGetMacro( SampleDistance, float );
307 
312  void Render( vtkRenderer *, vtkVolume * ) override;
313 
320  void ReleaseGraphicsResources(vtkWindow *) override;
321 
323 
331  {
332  DISABLED = -1,
333  MAGNITUDE = 0,
334  COMPONENT = 1,
335  };
336 
337  void SetVectorMode(int mode);
338  vtkGetMacro(VectorMode, int);
339 
340  vtkSetClampMacro(VectorComponent, int, 0, 3);
341  vtkGetMacro(VectorComponent, int);
343 
344 protected:
346  ~vtkSmartVolumeMapper() override;
347 
353  void ConnectMapperInput(vtkVolumeMapper *m);
354 
360  void ConnectFilterInput(vtkImageResample *f);
361 
363 
366  float FinalColorWindow;
367  float FinalColorLevel;
369 
371 
374  vtkIdType MaxMemoryInBytes;
375  float MaxMemoryFraction;
377 
381  int InterpolationMode;
382 
384 
389  int RequestedRenderMode;
390  int CurrentRenderMode;
392 
394 
397  int Initialized;
398  vtkTimeStamp SupportStatusCheckTime;
399  int GPUSupported;
400  int RayCastSupported;
401  int LowResGPUNecessary;
403 
408  vtkImageResample* GPUResampleFilter;
409 
411 
423 
428  void Initialize(vtkRenderer *ren,
429  vtkVolume *vol);
430 
435  void ComputeRenderMode(vtkRenderer *ren,
436  vtkVolume *vol);
437 
442  vtkGetObjectMacro(GPUMapper, vtkGPUVolumeRayCastMapper);
443 
445 
448  vtkGPUVolumeRayCastMapper *GPULowResMapper;
449  vtkGPUVolumeRayCastMapper *GPUMapper;
450  vtkFixedPointVolumeRayCastMapper *RayCastMapper;
452 
453 
459  int InitializedBlendMode;
460 
465 
471 
477  double InteractiveUpdateRate;
478 
487 
489 
500 
501 private:
506  void SetupVectorMode(vtkVolume* vol);
507 
509  void operator=(const vtkSmartVolumeMapper&) = delete;
510 
511  vtkOSPRayVolumeInterface *OSPRayMapper;
512 };
513 
514 #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.