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  RayCastRenderMode=1,
147  GPURenderMode=2,
148  OSPRayRenderMode=3,
149  UndefinedRenderMode=4,
150  InvalidRenderMode=5
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, vtkTypeBool, 0, 1);
277  vtkGetMacro( InteractiveAdjustSampleDistances, vtkTypeBool);
278  vtkBooleanMacro( InteractiveAdjustSampleDistances, vtkTypeBool);
280 
282 
291  vtkSetClampMacro( AutoAdjustSampleDistances, vtkTypeBool, 0, 1 );
292  vtkGetMacro( AutoAdjustSampleDistances, vtkTypeBool );
293  vtkBooleanMacro( AutoAdjustSampleDistances, vtkTypeBool );
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 
369 
371 
377 
382 
384 
392 
394 
403 
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 
452 
453 
460 
465 
471 
478 
487 
489 
500 
501 private:
503 
507  void SetupVectorMode(vtkVolume* vol);
513  void ComputeMagnitudeCellData(vtkImageData* input, vtkDataArray* arr);
514  void ComputeMagnitudePointData(vtkImageData* input, vtkDataArray* arr);
516 
518  void operator=(const vtkSmartVolumeMapper&) = delete;
519 
520  vtkOSPRayVolumeInterface *OSPRayMapper;
521 };
522 
523 #endif
vtkVolumeMapper
Abstract class for a volume mapper.
Definition: vtkVolumeMapper.h:46
vtkImageReslice.h
vtkSmartVolumeMapper::VectorComponent
int VectorComponent
Definition: vtkSmartVolumeMapper.h:497
vtkSmartVolumeMapper::FinalColorLevel
float FinalColorLevel
Definition: vtkSmartVolumeMapper.h:367
vtkVolume
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:50
vtkSmartVolumeMapper::SupportStatusCheckTime
vtkTimeStamp SupportStatusCheckTime
Definition: vtkSmartVolumeMapper.h:398
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkFixedPointVolumeRayCastMapper
A fixed point mapper for volumes.
Definition: vtkFixedPointVolumeRayCastMapper.h:100
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:35
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:477
vtkSmartVolumeMapper::GPUSupported
int GPUSupported
Definition: vtkSmartVolumeMapper.h:399
vtkSmartVolumeMapper::RayCastSupported
int RayCastSupported
Definition: vtkSmartVolumeMapper.h:400
vtkMultiBlockVolumeMapper
Mapper to render volumes defined as vtkMultiBlockDataSet.
Definition: vtkMultiBlockVolumeMapper.h:51
vtkSmartVolumeMapper::CurrentRenderMode
int CurrentRenderMode
Definition: vtkSmartVolumeMapper.h:390
vtkImageMagnitude
Colapses components with magnitude function..
Definition: vtkImageMagnitude.h:32
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkSmartVolumeMapper::MaxMemoryFraction
float MaxMemoryFraction
Definition: vtkSmartVolumeMapper.h:375
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkSmartVolumeMapper::AutoAdjustSampleDistances
vtkTypeBool AutoAdjustSampleDistances
Set whether or not the sample distance should be automatically calculated within the internal volume ...
Definition: vtkSmartVolumeMapper.h:470
vtkSmartVolumeMapper::GPULowResMapper
vtkGPUVolumeRayCastMapper * GPULowResMapper
The three potential mappers.
Definition: vtkSmartVolumeMapper.h:442
vtkSmartVolumeMapper::VectorMode
int VectorMode
VectorMode is a special rendering mode for 3-component vectors which makes use of GPURayCastMapper's ...
Definition: vtkSmartVolumeMapper.h:496
vtkSmartVolumeMapper::InterpolationMode
int InterpolationMode
Used for downsampling.
Definition: vtkSmartVolumeMapper.h:381
vtkImageResample
Resamples an image to be larger or smaller.
Definition: vtkImageResample.h:38
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:330
VTK_RESLICE_CUBIC
#define VTK_RESLICE_CUBIC
Definition: vtkImageReslice.h:68
vtkVolumeMapper.h
vtkSmartVolumeMapper::InputDataMagnitude
vtkImageData * InputDataMagnitude
Definition: vtkSmartVolumeMapper.h:421
vtkSmartVolumeMapper::Initialized
int Initialized
Initialization variables.
Definition: vtkSmartVolumeMapper.h:397
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkSmartVolumeMapper
Adaptive volume mapper.
Definition: vtkSmartVolumeMapper.h:96
vtkSmartVolumeMapper::InteractiveAdjustSampleDistances
vtkTypeBool InteractiveAdjustSampleDistances
If the InteractiveAdjustSampleDistances flag is enabled, vtkSmartVolumeMapper interactively sets and ...
Definition: vtkSmartVolumeMapper.h:486
vtkSmartVolumeMapper::GPUMapper
vtkGPUVolumeRayCastMapper * GPUMapper
Definition: vtkSmartVolumeMapper.h:449
vtkGPUVolumeRayCastMapper
Ray casting performed on the GPU.
Definition: vtkGPUVolumeRayCastMapper.h:43
VTK_RESLICE_NEAREST
#define VTK_RESLICE_NEAREST
Definition: vtkImageReslice.h:66
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:459
vtkSmartVolumeMapper::RequestedRenderMode
int RequestedRenderMode
The requested render mode is used to compute the current render mode.
Definition: vtkSmartVolumeMapper.h:389
vtkSmartVolumeMapper::ImageMagnitude
vtkImageMagnitude * ImageMagnitude
This filter is used to compute the magnitude of 3-component data.
Definition: vtkSmartVolumeMapper.h:420
vtkVolumeMapper::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
Definition: vtkVolumeMapper.h:201
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkSmartVolumeMapper::LowResGPUNecessary
int LowResGPUNecessary
Definition: vtkSmartVolumeMapper.h:401
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkSmartVolumeMapper::MagnitudeUploadTime
vtkTimeStamp MagnitudeUploadTime
Definition: vtkSmartVolumeMapper.h:498
vtkOSPRayVolumeInterface
Removes link dependence on optional ospray module.
Definition: vtkOSPRayVolumeInterface.h:33
vtkSmartVolumeMapper::RayCastMapper
vtkFixedPointVolumeRayCastMapper * RayCastMapper
Definition: vtkSmartVolumeMapper.h:450
vtkSmartVolumeMapper::MaxMemoryInBytes
vtkIdType MaxMemoryInBytes
GPU mapper-specific memory ivars.
Definition: vtkSmartVolumeMapper.h:374
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:87
vtkSmartVolumeMapper::FinalColorWindow
float FinalColorWindow
Window / level ivars.
Definition: vtkSmartVolumeMapper.h:366
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:408
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:464