VTK  9.1.0
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 =========================================================================*/
92 #ifndef vtkSmartVolumeMapper_h
93 #define vtkSmartVolumeMapper_h
94 
95 #include "vtkImageReslice.h" // for VTK_RESLICE_NEAREST, VTK_RESLICE_CUBIC
96 #include "vtkRenderingVolumeOpenGL2Module.h" // For export macro
97 #include "vtkVolumeMapper.h"
98 
101 class vtkImageResample;
104 class vtkRenderWindow;
105 class vtkVolume;
106 class vtkVolumeProperty;
107 class vtkImageMagnitude;
108 
109 class VTKRENDERINGVOLUMEOPENGL2_EXPORT vtkSmartVolumeMapper : public vtkVolumeMapper
110 {
111 public:
114  void PrintSelf(ostream& os, vtkIndent indent) override;
115 
117 
127  vtkSetMacro(FinalColorWindow, float);
129 
131 
134  vtkGetMacro(FinalColorWindow, float);
136 
138 
145  vtkSetMacro(FinalColorLevel, float);
147 
149 
152  vtkGetMacro(FinalColorLevel, float);
154 
155  // The possible values for the default and current render mode ivars
156  enum
157  {
158  DefaultRenderMode = 0,
159  RayCastRenderMode = 1,
160  GPURenderMode = 2,
161  OSPRayRenderMode = 3,
162  UndefinedRenderMode = 4,
163  InvalidRenderMode = 5
164  };
165 
171 
178 
185 
192 
198 
200 
203  vtkGetMacro(RequestedRenderMode, int);
205 
211 
213 
220  vtkSetMacro(MaxMemoryInBytes, vtkIdType);
221  vtkGetMacro(MaxMemoryInBytes, vtkIdType);
223 
225 
231  vtkSetClampMacro(MaxMemoryFraction, float, 0.1f, 1.0f);
232  vtkGetMacro(MaxMemoryFraction, float);
234 
236 
240  vtkSetClampMacro(InterpolationMode, int, VTK_RESLICE_NEAREST, VTK_RESLICE_CUBIC);
241  vtkGetMacro(InterpolationMode, int);
246 
252  void CreateCanonicalView(vtkRenderer* ren, vtkVolume* volume, vtkVolume* volume2,
253  vtkImageData* image, int blend_mode, double viewDirection[3], double viewUp[3]);
254 
256 
262  vtkSetClampMacro(InteractiveUpdateRate, double, 1.0e-10, 1.0e10);
264 
266 
271  vtkGetMacro(InteractiveUpdateRate, double);
273 
275 
283  vtkSetClampMacro(InteractiveAdjustSampleDistances, vtkTypeBool, 0, 1);
284  vtkGetMacro(InteractiveAdjustSampleDistances, vtkTypeBool);
285  vtkBooleanMacro(InteractiveAdjustSampleDistances, vtkTypeBool);
287 
289 
298  vtkSetClampMacro(AutoAdjustSampleDistances, vtkTypeBool, 0, 1);
299  vtkGetMacro(AutoAdjustSampleDistances, vtkTypeBool);
300  vtkBooleanMacro(AutoAdjustSampleDistances, vtkTypeBool);
302 
304 
311  vtkSetMacro(SampleDistance, float);
312  vtkGetMacro(SampleDistance, float);
314 
319  void Render(vtkRenderer*, vtkVolume*) override;
320 
328 
330 
338  {
339  DISABLED = -1,
340  MAGNITUDE = 0,
341  COMPONENT = 1,
342  };
343 
344  void SetVectorMode(int mode);
345  vtkGetMacro(VectorMode, int);
346 
347  vtkSetClampMacro(VectorComponent, int, 0, 3);
348  vtkGetMacro(VectorComponent, int);
350 
352 
355  vtkSetStringMacro(Transfer2DYAxisArray);
356  vtkGetStringMacro(Transfer2DYAxisArray);
358 
359 protected:
362 
369 
376 
378 
384 
386 
392 
397 
399 
407 
409 
418 
424 
426 
438 
443  void Initialize(vtkRenderer* ren, vtkVolume* vol);
444 
450 
455  vtkGetObjectMacro(GPUMapper, vtkGPUVolumeRayCastMapper);
456 
458 
465 
472 
477 
483 
490 
499 
501 
512 
514 
521 
528 
529 private:
531 
535  void SetupVectorMode(vtkVolume* vol);
541  void ComputeMagnitudeCellData(vtkDataSet* input, vtkDataArray* arr);
542  void ComputeMagnitudePointData(vtkDataSet* input, vtkDataArray* arr);
544 
546  void operator=(const vtkSmartVolumeMapper&) = delete;
547 
548  vtkOSPRayVolumeInterface* OSPRayMapper;
549 };
550 
551 #endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
abstract class to specify dataset behavior
Definition: vtkDataSet.h:166
Ray casting performed on the GPU.
topologically and geometrically regular array of data
Definition: vtkImageData.h:157
Resamples an image to be larger or smaller.
a simple class to control print indentation
Definition: vtkIndent.h:113
Mapper to render volumes defined as vtkMultiBlockDataSet.
Removes link dependence on optional ospray module.
create a window for renderers to draw into
abstract specification for renderers
Definition: vtkRenderer.h:173
Adaptive volume mapper.
float MaxMemoryFraction
GPU mapper-specific memory ivars.
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
vtkTypeBool AutoAdjustSampleDistances
Set whether or not the sample distance should be automatically calculated within the internal volume ...
int Initialized
Initialization variables.
int VectorMode
VectorMode is a special rendering mode for 3-component vectors which makes use of GPURayCastMapper's ...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int RequestedRenderMode
The requested render mode is used to compute the current render mode.
int GetLastUsedRenderMode()
This will return the render mode used during the previous call to Render().
vtkImageResample * GPUResampleFilter
This is the resample filter that may be used if we need to create a low resolution version of the vol...
vtkFixedPointVolumeRayCastMapper * RayCastMapper
The three potential mappers.
vtkImageData * InputDataMagnitude
This filter is used to compute the magnitude of 3-component data.
float SampleDistance
The distance between sample points along the ray.
vtkDataSet * LastInput
Keep a cache of the last input to the mapper so that input data changes can be propogated to the resa...
vtkIdType MaxMemoryInBytes
GPU mapper-specific memory ivars.
void SetVectorMode(int mode)
VectorMode is a special rendering mode for 3-component vectors which makes use of GPURayCastMapper's ...
void Initialize(vtkRenderer *ren, vtkVolume *vol)
The initialize method.
int InitializedBlendMode
We need to keep track of the blend mode we had when we initialized because we need to reinitialize (a...
void SetInterpolationModeToLinear()
Set interpolation mode for downsampling (lowres GPU) (initial value: cubic).
void ConnectFilterInput(vtkImageResample *f)
Connect input of the vtkSmartVolumeMapper to the input of the internal resample filter by doing a sha...
void SetRequestedRenderModeToOSPRay()
Set the requested render mode to vtkSmartVolumeMapper::OSPRayRenderMode.
void CreateCanonicalView(vtkRenderer *ren, vtkVolume *volume, vtkVolume *volume2, vtkImageData *image, int blend_mode, double viewDirection[3], double viewUp[3])
This method can be used to render a representative view of the input data into the supplied image giv...
int CurrentRenderMode
The requested render mode is used to compute the current render mode.
~vtkSmartVolumeMapper() override
vtkDataSet * LastFilterInput
Keep a cache of the last input to the mapper so that input data changes can be propogated to the resa...
void SetInterpolationModeToNearestNeighbor()
Set interpolation mode for downsampling (lowres GPU) (initial value: cubic).
void SetRequestedRenderMode(int mode)
Set the requested render mode.
float FinalColorLevel
Window / level ivars.
double InteractiveUpdateRate
If the DesiredUpdateRate of the vtkRenderWindow causing the Render is at or above this value,...
void ConnectMapperInput(vtkVolumeMapper *m)
Connect input of the vtkSmartVolumeMapper to the input of the internal volume mapper by doing a shall...
int VectorComponent
VectorMode is a special rendering mode for 3-component vectors which makes use of GPURayCastMapper's ...
vtkTypeBool InteractiveAdjustSampleDistances
If the InteractiveAdjustSampleDistances flag is enabled, vtkSmartVolumeMapper interactively sets and ...
int InterpolationMode
Used for downsampling.
vtkTimeStamp SupportStatusCheckTime
Initialization variables.
void SetRequestedRenderModeToRayCast()
Set the requested render mode to vtkSmartVolumeMapper::RayCastRenderMode.
vtkGPUVolumeRayCastMapper * GPUMapper
The three potential mappers.
void SetRequestedRenderModeToGPU()
Set the requested render mode to vtkSmartVolumeMapper::GPURenderMode.
vtkGPUVolumeRayCastMapper * GPULowResMapper
The three potential mappers.
float FinalColorWindow
Window / level ivars.
vtkTimeStamp MagnitudeUploadTime
VectorMode is a special rendering mode for 3-component vectors which makes use of GPURayCastMapper's ...
int GPUSupported
Initialization variables.
static vtkSmartVolumeMapper * New()
void SetRequestedRenderModeToDefault()
Set the requested render mode to vtkSmartVolumeMapper::DefaultRenderMode.
vtkImageMagnitude * ImageMagnitude
This filter is used to compute the magnitude of 3-component data.
int RayCastSupported
Initialization variables.
void ComputeRenderMode(vtkRenderer *ren, vtkVolume *vol)
The method that computes the render mode from the requested render mode based on the support status f...
void Render(vtkRenderer *, vtkVolume *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Initialize rendering for this volume.
char * Transfer2DYAxisArray
Define the array used for the Y axis of transfer 2D.
void SetInterpolationModeToCubic()
Set interpolation mode for downsampling (lowres GPU) (initial value: cubic).
int LowResGPUNecessary
Initialization variables.
VectorModeType
VectorMode is a special rendering mode for 3-component vectors which makes use of GPURayCastMapper's ...
record modification and/or execution time
Definition: vtkTimeStamp.h:52
Abstract class for a volume mapper.
represents the common properties for rendering a volume.
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:134
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
@ mode
Definition: vtkX3D.h:253
@ image
Definition: vtkX3D.h:380
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_RESLICE_CUBIC
#define VTK_RESLICE_NEAREST
int vtkIdType
Definition: vtkType.h:332