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  RayCastRenderMode=1,
141  GPURenderMode=2,
142  OSPRayRenderMode=3,
143  UndefinedRenderMode=4,
144  InvalidRenderMode=5
145  };
146 
151  void SetRequestedRenderMode(int mode);
152 
158  void SetRequestedRenderModeToDefault();
159 
165  void SetRequestedRenderModeToRayCast();
166 
172  void SetRequestedRenderModeToGPU();
173 
178  void SetRequestedRenderModeToOSPRay();
179 
181 
184  vtkGetMacro( RequestedRenderMode, int );
186 
191  int GetLastUsedRenderMode();
192 
194 
201  vtkSetMacro( MaxMemoryInBytes, vtkIdType );
202  vtkGetMacro( MaxMemoryInBytes, vtkIdType );
204 
206 
212  vtkSetClampMacro( MaxMemoryFraction, float, 0.1f, 1.0f );
213  vtkGetMacro( MaxMemoryFraction, float );
215 
217 
221  vtkSetClampMacro(InterpolationMode, int,
223  vtkGetMacro(InterpolationMode, int);
224  void SetInterpolationModeToNearestNeighbor();
225  void SetInterpolationModeToLinear();
226  void SetInterpolationModeToCubic();
228 
234  void CreateCanonicalView( vtkRenderer *ren,
235  vtkVolume *volume,
236  vtkVolume *volume2,
238  int blend_mode,
239  double viewDirection[3],
240  double viewUp[3] );
241 
243 
249  vtkSetClampMacro( InteractiveUpdateRate, double, 1.0e-10, 1.0e10 );
251 
253 
258  vtkGetMacro( InteractiveUpdateRate, double );
260 
262 
270  vtkSetClampMacro( InteractiveAdjustSampleDistances, vtkTypeBool, 0, 1);
271  vtkGetMacro( InteractiveAdjustSampleDistances, vtkTypeBool);
272  vtkBooleanMacro( InteractiveAdjustSampleDistances, vtkTypeBool);
274 
276 
285  vtkSetClampMacro( AutoAdjustSampleDistances, vtkTypeBool, 0, 1 );
286  vtkGetMacro( AutoAdjustSampleDistances, vtkTypeBool );
287  vtkBooleanMacro( AutoAdjustSampleDistances, vtkTypeBool );
289 
291 
298  vtkSetMacro( SampleDistance, float );
299  vtkGetMacro( SampleDistance, float );
301 
306  void Render( vtkRenderer *, vtkVolume * ) override;
307 
314  void ReleaseGraphicsResources(vtkWindow *) override;
315 
317 
325  {
326  DISABLED = -1,
327  MAGNITUDE = 0,
328  COMPONENT = 1,
329  };
330 
331  void SetVectorMode(int mode);
332  vtkGetMacro(VectorMode, int);
333 
334  vtkSetClampMacro(VectorComponent, int, 0, 3);
335  vtkGetMacro(VectorComponent, int);
337 
338 protected:
340  ~vtkSmartVolumeMapper() override;
341 
347  void ConnectMapperInput(vtkVolumeMapper *m);
348 
354  void ConnectFilterInput(vtkImageResample *f);
355 
357 
363 
365 
371 
376 
378 
386 
388 
397 
403 
405 
417 
422  void Initialize(vtkRenderer *ren,
423  vtkVolume *vol);
424 
429  void ComputeRenderMode(vtkRenderer *ren,
430  vtkVolume *vol);
431 
436  vtkGetObjectMacro(GPUMapper, vtkGPUVolumeRayCastMapper);
437 
439 
446 
447 
454 
459 
465 
472 
481 
483 
494 
495 private:
497 
501  void SetupVectorMode(vtkVolume* vol);
507  void ComputeMagnitudeCellData(vtkImageData* input, vtkDataArray* arr);
508  void ComputeMagnitudePointData(vtkImageData* input, vtkDataArray* arr);
510 
512  void operator=(const vtkSmartVolumeMapper&) = delete;
513 
514  vtkOSPRayVolumeInterface *OSPRayMapper;
515 };
516 
517 #endif
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:44
#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.
int RayCastSupported
Initialization variables.
record modification and/or execution time
Definition: vtkTimeStamp.h:32
vtkTimeStamp SupportStatusCheckTime
Initialization variables.
Resamples an image to be larger or smaller.
int LowResGPUNecessary
Initialization variables.
vtkFixedPointVolumeRayCastMapper * RayCastMapper
The three potential mappers.
vtkTypeBool InteractiveAdjustSampleDistances
If the InteractiveAdjustSampleDistances flag is enabled, vtkSmartVolumeMapper interactively sets and ...
vtkGPUVolumeRayCastMapper * GPULowResMapper
The three potential mappers.
abstract specification for renderers
Definition: vtkRenderer.h:57
int RequestedRenderMode
The requested render mode is used to compute the current render mode.
int vtkIdType
Definition: vtkType.h:347
vtkImageResample * GPUResampleFilter
This is the resample filter that may be used if we need to create a low resolution version of the vol...
float SampleDistance
The distance between sample points along the ray.
vtkIdType MaxMemoryInBytes
GPU mapper-specific memory ivars.
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...
int vtkTypeBool
Definition: vtkABI.h:69
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
VectorModeType
VectorMode is a special rendering mode for 3-component vectors which makes use of GPURayCastMapper's ...
float FinalColorLevel
Window / level ivars.
a simple class to control print indentation
Definition: vtkIndent.h:33
double InteractiveUpdateRate
If the DesiredUpdateRate of the vtkRenderWindow causing the Render is at or above this value,...
vtkTypeBool AutoAdjustSampleDistances
Set whether or not the sample distance should be automatically calculated within the internal volume ...
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
Colapses components with magnitude function.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
int CurrentRenderMode
The requested render mode is used to compute the current render mode.
represents the common properties for rendering a volume.
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 ...
vtkGPUVolumeRayCastMapper * GPUMapper
The three potential mappers.
int InitializedBlendMode
We need to keep track of the blend mode we had when we initialized because we need to reinitialize (a...
int Initialized
Initialization variables.
int GPUSupported
Initialization variables.
static vtkAlgorithm * New()
vtkImageData * InputDataMagnitude
This filter is used to compute the magnitude of 3-component data.
float MaxMemoryFraction
GPU mapper-specific memory ivars.
int InterpolationMode
Used for downsampling.
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.
float FinalColorWindow
Window / level ivars.