VTK  9.4.20241118
vtkSmartVolumeMapper.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
83#ifndef vtkSmartVolumeMapper_h
84#define vtkSmartVolumeMapper_h
85
86#include "vtkImageReslice.h" // for VTK_RESLICE_NEAREST, VTK_RESLICE_CUBIC
87#include "vtkRenderingVolumeOpenGL2Module.h" // For export macro
88#include "vtkVolumeMapper.h"
89#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
90
91VTK_ABI_NAMESPACE_BEGIN
98class vtkRenderWindow;
99class vtkVolume;
102
103class VTKRENDERINGVOLUMEOPENGL2_EXPORT VTK_MARSHALAUTO vtkSmartVolumeMapper : public vtkVolumeMapper
104{
105public:
108 void PrintSelf(ostream& os, vtkIndent indent) override;
109
111
121 vtkSetMacro(FinalColorWindow, float);
123
125
128 vtkGetMacro(FinalColorWindow, float);
130
132
139 vtkSetMacro(FinalColorLevel, float);
141
143
146 vtkGetMacro(FinalColorLevel, float);
148
149 // The possible values for the default and current render mode ivars
150 enum
151 {
152 DefaultRenderMode = 0,
153 RayCastRenderMode = 1,
154 GPURenderMode = 2,
155 OSPRayRenderMode = 3,
156 AnariRenderMode = 4,
157 UndefinedRenderMode = 5,
158 InvalidRenderMode = 6
159 };
160
166
173
180
187
193
199
201
204 vtkGetMacro(RequestedRenderMode, int);
206
212
214
221 vtkSetMacro(MaxMemoryInBytes, vtkIdType);
222 vtkGetMacro(MaxMemoryInBytes, vtkIdType);
224
226
232 vtkSetClampMacro(MaxMemoryFraction, float, 0.1f, 1.0f);
233 vtkGetMacro(MaxMemoryFraction, float);
235
237
241 vtkSetClampMacro(InterpolationMode, int, VTK_RESLICE_NEAREST, VTK_RESLICE_CUBIC);
242 vtkGetMacro(InterpolationMode, int);
247
254 vtkImageData* image, int blend_mode, double viewDirection[3], double viewUp[3]);
255
257
262 vtkSetClampMacro(UseJittering, vtkTypeBool, 0, 1);
263 vtkGetMacro(UseJittering, vtkTypeBool);
264 vtkBooleanMacro(UseJittering, vtkTypeBool);
266
268
274 vtkSetClampMacro(InteractiveUpdateRate, double, 1.0e-10, 1.0e10);
276
278
283 vtkGetMacro(InteractiveUpdateRate, double);
285
287
295 vtkSetClampMacro(InteractiveAdjustSampleDistances, vtkTypeBool, 0, 1);
296 vtkGetMacro(InteractiveAdjustSampleDistances, vtkTypeBool);
297 vtkBooleanMacro(InteractiveAdjustSampleDistances, vtkTypeBool);
299
301
310 vtkSetClampMacro(AutoAdjustSampleDistances, vtkTypeBool, 0, 1);
311 vtkGetMacro(AutoAdjustSampleDistances, vtkTypeBool);
312 vtkBooleanMacro(AutoAdjustSampleDistances, vtkTypeBool);
314
316
323 vtkSetMacro(SampleDistance, float);
324 vtkGetMacro(SampleDistance, float);
326
328
334 vtkSetClampMacro(GlobalIlluminationReach, float, 0.0f, 1.0f);
335 vtkGetMacro(GlobalIlluminationReach, float);
337
339
345 vtkSetClampMacro(VolumetricScatteringBlending, float, 0.0f, 2.0f);
346 vtkGetMacro(VolumetricScatteringBlending, float);
348
353 void Render(vtkRenderer*, vtkVolume*) override;
354
362
364
372 {
373 DISABLED = -1,
374 MAGNITUDE = 0,
375 COMPONENT = 1,
376 };
377
378 void SetVectorMode(int mode);
379 vtkGetMacro(VectorMode, int);
380
381 vtkSetClampMacro(VectorComponent, int, 0, 3);
382 vtkGetMacro(VectorComponent, int);
384
386
389 vtkSetStringMacro(Transfer2DYAxisArray);
390 vtkGetStringMacro(Transfer2DYAxisArray);
392
394
402 {
403 LowResModeDisabled = 0,
404 LowResModeResample = 1,
405 };
406
407 vtkSetMacro(LowResMode, int);
408 vtkGetMacro(LowResMode, int)
410
411protected:
414
421
428
430
436
438
444
449
451
459
461
470
476
478
490
496
502
507 vtkGetObjectMacro(GPUMapper, vtkGPUVolumeRayCastMapper);
508
510
517
524
529
534
538 float GlobalIlluminationReach = 0.0;
539
543 float VolumetricScatteringBlending = 0.0;
544
550
557
566
568
579
581
588
595
596 int LowResMode = LowResModeDisabled;
597
598private:
600
604 void SetupVectorMode(vtkVolume* vol);
610 void ComputeMagnitudeCellData(vtkDataSet* input, vtkDataArray* arr);
611 void ComputeMagnitudePointData(vtkDataSet* input, vtkDataArray* arr);
613
615 void operator=(const vtkSmartVolumeMapper&) = delete;
616
617 vtkOSPRayVolumeInterface* OSPRayMapper;
618 vtkAnariVolumeInterface* AnariMapper;
619};
620
621VTK_ABI_NAMESPACE_END
622#endif
Removes link dependence on optional ANARI module.
abstract superclass for arrays of numeric data
abstract class to specify dataset behavior
Definition vtkDataSet.h:166
Ray casting performed on the GPU.
topologically and geometrically regular array of data
Resamples an image to be larger or smaller.
a simple class to control print indentation
Definition vtkIndent.h:108
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
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.
void SetRequestedRenderModeToAnari()
Set the requested render mode to vtkSmartVolumeMapper::AnariRenderMode.
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 propagated 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.
vtkTypeBool UseJittering
Enable / disable stochastic jittering.
~vtkSmartVolumeMapper() override
vtkDataSet * LastFilterInput
Keep a cache of the last input to the mapper so that input data changes can be propagated 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.
static vtkSmartVolumeMapper * New()
double InteractiveUpdateRate
If the DesiredUpdateRate of the vtkRenderWindow causing the Render is at or above this value,...
LowResModeType
LowResDisable disables low res mode (default) LowResResample enable low res mode by automatically res...
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.
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
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:130
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_RESLICE_CUBIC
#define VTK_RESLICE_NEAREST
int vtkIdType
Definition vtkType.h:315
#define VTK_MARSHALAUTO