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
vtkVolumeMapper
Abstract class for a volume mapper.
Definition: vtkVolumeMapper.h:43
vtkImageReslice.h
vtkSmartVolumeMapper::VectorComponent
int VectorComponent
Definition: vtkSmartVolumeMapper.h:491
vtkSmartVolumeMapper::FinalColorLevel
float FinalColorLevel
Definition: vtkSmartVolumeMapper.h:361
vtkVolume
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:44
vtkSmartVolumeMapper::SupportStatusCheckTime
vtkTimeStamp SupportStatusCheckTime
Definition: vtkSmartVolumeMapper.h:392
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkFixedPointVolumeRayCastMapper
A fixed point mapper for volumes.
Definition: vtkFixedPointVolumeRayCastMapper.h:94
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:32
vtkX3D::image
Definition: vtkX3D.h:374
vtkSmartVolumeMapper::InteractiveUpdateRate
double InteractiveUpdateRate
If the DesiredUpdateRate of the vtkRenderWindow causing the Render is at or above this value,...
Definition: vtkSmartVolumeMapper.h:471
vtkSmartVolumeMapper::GPUSupported
int GPUSupported
Definition: vtkSmartVolumeMapper.h:393
vtkSmartVolumeMapper::RayCastSupported
int RayCastSupported
Definition: vtkSmartVolumeMapper.h:394
vtkMultiBlockVolumeMapper
Mapper to render volumes defined as vtkMultiBlockDataSet.
Definition: vtkMultiBlockVolumeMapper.h:51
vtkSmartVolumeMapper::CurrentRenderMode
int CurrentRenderMode
Definition: vtkSmartVolumeMapper.h:384
vtkImageMagnitude
Colapses components with magnitude function..
Definition: vtkImageMagnitude.h:29
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
vtkSmartVolumeMapper::MaxMemoryFraction
float MaxMemoryFraction
Definition: vtkSmartVolumeMapper.h:369
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkSmartVolumeMapper::AutoAdjustSampleDistances
vtkTypeBool AutoAdjustSampleDistances
Set whether or not the sample distance should be automatically calculated within the internal volume ...
Definition: vtkSmartVolumeMapper.h:464
vtkSmartVolumeMapper::GPULowResMapper
vtkGPUVolumeRayCastMapper * GPULowResMapper
The three potential mappers.
Definition: vtkSmartVolumeMapper.h:436
vtkSmartVolumeMapper::VectorMode
int VectorMode
VectorMode is a special rendering mode for 3-component vectors which makes use of GPURayCastMapper's ...
Definition: vtkSmartVolumeMapper.h:490
vtkSmartVolumeMapper::InterpolationMode
int InterpolationMode
Used for downsampling.
Definition: vtkSmartVolumeMapper.h:375
vtkImageResample
Resamples an image to be larger or smaller.
Definition: vtkImageResample.h:32
vtkVolumeMapper::Render
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...
vtkSmartVolumeMapper::VectorModeType
VectorModeType
VectorMode is a special rendering mode for 3-component vectors which makes use of GPURayCastMapper's ...
Definition: vtkSmartVolumeMapper.h:324
VTK_RESLICE_CUBIC
#define VTK_RESLICE_CUBIC
Definition: vtkImageReslice.h:62
vtkVolumeMapper.h
vtkSmartVolumeMapper::InputDataMagnitude
vtkImageData * InputDataMagnitude
Definition: vtkSmartVolumeMapper.h:415
vtkSmartVolumeMapper::Initialized
int Initialized
Initialization variables.
Definition: vtkSmartVolumeMapper.h:391
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkSmartVolumeMapper
Adaptive volume mapper.
Definition: vtkSmartVolumeMapper.h:90
vtkSmartVolumeMapper::InteractiveAdjustSampleDistances
vtkTypeBool InteractiveAdjustSampleDistances
If the InteractiveAdjustSampleDistances flag is enabled, vtkSmartVolumeMapper interactively sets and ...
Definition: vtkSmartVolumeMapper.h:480
vtkSmartVolumeMapper::GPUMapper
vtkGPUVolumeRayCastMapper * GPUMapper
Definition: vtkSmartVolumeMapper.h:443
vtkGPUVolumeRayCastMapper
Ray casting performed on the GPU.
Definition: vtkGPUVolumeRayCastMapper.h:43
VTK_RESLICE_NEAREST
#define VTK_RESLICE_NEAREST
Definition: vtkImageReslice.h:60
vtkSmartVolumeMapper::InitializedBlendMode
int InitializedBlendMode
We need to keep track of the blend mode we had when we initialized because we need to reinitialize (a...
Definition: vtkSmartVolumeMapper.h:453
vtkSmartVolumeMapper::RequestedRenderMode
int RequestedRenderMode
The requested render mode is used to compute the current render mode.
Definition: vtkSmartVolumeMapper.h:383
vtkSmartVolumeMapper::ImageMagnitude
vtkImageMagnitude * ImageMagnitude
This filter is used to compute the magnitude of 3-component data.
Definition: vtkSmartVolumeMapper.h:414
vtkVolumeMapper::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
Definition: vtkVolumeMapper.h:198
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkSmartVolumeMapper::LowResGPUNecessary
int LowResGPUNecessary
Definition: vtkSmartVolumeMapper.h:395
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:57
vtkSmartVolumeMapper::MagnitudeUploadTime
vtkTimeStamp MagnitudeUploadTime
Definition: vtkSmartVolumeMapper.h:492
vtkOSPRayVolumeInterface
Removes link dependence on optional ospray module.
Definition: vtkOSPRayVolumeInterface.h:33
vtkSmartVolumeMapper::RayCastMapper
vtkFixedPointVolumeRayCastMapper * RayCastMapper
Definition: vtkSmartVolumeMapper.h:444
vtkSmartVolumeMapper::MaxMemoryInBytes
vtkIdType MaxMemoryInBytes
GPU mapper-specific memory ivars.
Definition: vtkSmartVolumeMapper.h:368
vtkVolumeMapper::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkX3D::mode
Definition: vtkX3D.h:247
vtkRenderWindow
create a window for renderers to draw into
Definition: vtkRenderWindow.h:81
vtkSmartVolumeMapper::FinalColorWindow
float FinalColorWindow
Window / level ivars.
Definition: vtkSmartVolumeMapper.h:360
vtkSmartVolumeMapper::GPUResampleFilter
vtkImageResample * GPUResampleFilter
This is the resample filter that may be used if we need to create a low resolution version of the vol...
Definition: vtkSmartVolumeMapper.h:402
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkVolumeProperty
represents the common properties for rendering a volume.
Definition: vtkVolumeProperty.h:68
vtkSmartVolumeMapper::SampleDistance
float SampleDistance
The distance between sample points along the ray.
Definition: vtkSmartVolumeMapper.h:458