VTK  9.0.1
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 "vtkImageReslice.h" // for VTK_RESLICE_NEAREST, VTK_RESLICE_CUBIC
77 #include "vtkRenderingVolumeOpenGL2Module.h" // For export macro
78 #include "vtkVolumeMapper.h"
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, VTK_RESLICE_NEAREST, VTK_RESLICE_CUBIC);
222  vtkGetMacro(InterpolationMode, int);
223  void SetInterpolationModeToNearestNeighbor();
224  void SetInterpolationModeToLinear();
225  void SetInterpolationModeToCubic();
227 
233  void CreateCanonicalView(vtkRenderer* ren, vtkVolume* volume, vtkVolume* volume2,
234  vtkImageData* image, int blend_mode, double viewDirection[3], double viewUp[3]);
235 
237 
243  vtkSetClampMacro(InteractiveUpdateRate, double, 1.0e-10, 1.0e10);
245 
247 
252  vtkGetMacro(InteractiveUpdateRate, double);
254 
256 
264  vtkSetClampMacro(InteractiveAdjustSampleDistances, vtkTypeBool, 0, 1);
265  vtkGetMacro(InteractiveAdjustSampleDistances, vtkTypeBool);
266  vtkBooleanMacro(InteractiveAdjustSampleDistances, vtkTypeBool);
268 
270 
279  vtkSetClampMacro(AutoAdjustSampleDistances, vtkTypeBool, 0, 1);
280  vtkGetMacro(AutoAdjustSampleDistances, vtkTypeBool);
281  vtkBooleanMacro(AutoAdjustSampleDistances, vtkTypeBool);
283 
285 
292  vtkSetMacro(SampleDistance, float);
293  vtkGetMacro(SampleDistance, float);
295 
300  void Render(vtkRenderer*, vtkVolume*) override;
301 
308  void ReleaseGraphicsResources(vtkWindow*) override;
309 
311 
319  {
320  DISABLED = -1,
321  MAGNITUDE = 0,
322  COMPONENT = 1,
323  };
324 
325  void SetVectorMode(int mode);
326  vtkGetMacro(VectorMode, int);
327 
328  vtkSetClampMacro(VectorComponent, int, 0, 3);
329  vtkGetMacro(VectorComponent, int);
331 
332 protected:
334  ~vtkSmartVolumeMapper() override;
335 
341  void ConnectMapperInput(vtkVolumeMapper* m);
342 
348  void ConnectFilterInput(vtkImageResample* f);
349 
351 
357 
359 
365 
370 
372 
380 
382 
391 
397 
399 
411 
416  void Initialize(vtkRenderer* ren, vtkVolume* vol);
417 
422  void ComputeRenderMode(vtkRenderer* ren, vtkVolume* vol);
423 
428  vtkGetObjectMacro(GPUMapper, vtkGPUVolumeRayCastMapper);
429 
431 
438 
445 
450 
456 
463 
472 
474 
485 
486 private:
488 
492  void SetupVectorMode(vtkVolume* vol);
498  void ComputeMagnitudeCellData(vtkImageData* input, vtkDataArray* arr);
499  void ComputeMagnitudePointData(vtkImageData* input, vtkDataArray* arr);
501 
503  void operator=(const vtkSmartVolumeMapper&) = delete;
504 
505  vtkOSPRayVolumeInterface* OSPRayMapper;
506 };
507 
508 #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:67
int RequestedRenderMode
The requested render mode is used to compute the current render mode.
int vtkIdType
Definition: vtkType.h:338
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:37
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:41
Colapses components with magnitude function.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
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.