VTK  9.3.0
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
64#ifndef vtkSmartVolumeMapper_h
65#define vtkSmartVolumeMapper_h
66
67#include "vtkImageReslice.h" // for VTK_RESLICE_NEAREST, VTK_RESLICE_CUBIC
68#include "vtkRenderingVolumeOpenGL2Module.h" // For export macro
69#include "vtkVolumeMapper.h"
70
71VTK_ABI_NAMESPACE_BEGIN
77class vtkRenderWindow;
78class vtkVolume;
81
82class VTKRENDERINGVOLUMEOPENGL2_EXPORT vtkSmartVolumeMapper : public vtkVolumeMapper
83{
84public:
87 void PrintSelf(ostream& os, vtkIndent indent) override;
88
90
100 vtkSetMacro(FinalColorWindow, float);
102
104
107 vtkGetMacro(FinalColorWindow, float);
109
111
118 vtkSetMacro(FinalColorLevel, float);
120
122
125 vtkGetMacro(FinalColorLevel, float);
127
128 // The possible values for the default and current render mode ivars
129 enum
130 {
131 DefaultRenderMode = 0,
132 RayCastRenderMode = 1,
133 GPURenderMode = 2,
134 OSPRayRenderMode = 3,
135 UndefinedRenderMode = 4,
136 InvalidRenderMode = 5
137 };
138
144
151
158
165
171
173
176 vtkGetMacro(RequestedRenderMode, int);
178
184
186
193 vtkSetMacro(MaxMemoryInBytes, vtkIdType);
194 vtkGetMacro(MaxMemoryInBytes, vtkIdType);
196
198
204 vtkSetClampMacro(MaxMemoryFraction, float, 0.1f, 1.0f);
205 vtkGetMacro(MaxMemoryFraction, float);
207
209
213 vtkSetClampMacro(InterpolationMode, int, VTK_RESLICE_NEAREST, VTK_RESLICE_CUBIC);
214 vtkGetMacro(InterpolationMode, int);
219
226 vtkImageData* image, int blend_mode, double viewDirection[3], double viewUp[3]);
227
229
234 vtkSetClampMacro(UseJittering, vtkTypeBool, 0, 1);
235 vtkGetMacro(UseJittering, vtkTypeBool);
236 vtkBooleanMacro(UseJittering, vtkTypeBool);
238
240
246 vtkSetClampMacro(InteractiveUpdateRate, double, 1.0e-10, 1.0e10);
248
250
255 vtkGetMacro(InteractiveUpdateRate, double);
257
259
267 vtkSetClampMacro(InteractiveAdjustSampleDistances, vtkTypeBool, 0, 1);
268 vtkGetMacro(InteractiveAdjustSampleDistances, vtkTypeBool);
269 vtkBooleanMacro(InteractiveAdjustSampleDistances, vtkTypeBool);
271
273
282 vtkSetClampMacro(AutoAdjustSampleDistances, vtkTypeBool, 0, 1);
283 vtkGetMacro(AutoAdjustSampleDistances, vtkTypeBool);
284 vtkBooleanMacro(AutoAdjustSampleDistances, vtkTypeBool);
286
288
295 vtkSetMacro(SampleDistance, float);
296 vtkGetMacro(SampleDistance, float);
298
300
306 vtkSetClampMacro(GlobalIlluminationReach, float, 0.0f, 1.0f);
307 vtkGetMacro(GlobalIlluminationReach, float);
309
311
317 vtkSetClampMacro(VolumetricScatteringBlending, float, 0.0f, 2.0f);
318 vtkGetMacro(VolumetricScatteringBlending, float);
320
325 void Render(vtkRenderer*, vtkVolume*) override;
326
334
336
344 {
345 DISABLED = -1,
346 MAGNITUDE = 0,
347 COMPONENT = 1,
348 };
349
350 void SetVectorMode(int mode);
351 vtkGetMacro(VectorMode, int);
352
353 vtkSetClampMacro(VectorComponent, int, 0, 3);
354 vtkGetMacro(VectorComponent, int);
356
358
361 vtkSetStringMacro(Transfer2DYAxisArray);
362 vtkGetStringMacro(Transfer2DYAxisArray);
364
366
374 {
375 LowResModeDisabled = 0,
376 LowResModeResample = 1,
377 };
378
379 vtkSetMacro(LowResMode, int);
380 vtkGetMacro(LowResMode, int)
382
383 protected : vtkSmartVolumeMapper();
385
391 void ConnectMapperInput(vtkVolumeMapper* m);
392
398 void ConnectFilterInput(vtkImageResample* f);
399
401
404 float FinalColorWindow;
405 float FinalColorLevel;
407
409
412 vtkIdType MaxMemoryInBytes;
413 float MaxMemoryFraction;
415
419 int InterpolationMode;
420
422
427 int RequestedRenderMode;
428 int CurrentRenderMode;
430
432
435 int Initialized;
436 vtkTimeStamp SupportStatusCheckTime;
437 int GPUSupported;
438 int RayCastSupported;
439 int LowResGPUNecessary;
441
446 vtkImageResample* GPUResampleFilter;
447
449
458 vtkImageMagnitude* ImageMagnitude;
459 vtkImageData* InputDataMagnitude;
461
466 void Initialize(vtkRenderer* ren, vtkVolume* vol);
467
472 void ComputeRenderMode(vtkRenderer* ren, vtkVolume* vol);
473
478 vtkGetObjectMacro(GPUMapper, vtkGPUVolumeRayCastMapper);
479
481
488
494 int InitializedBlendMode;
495
499 vtkTypeBool UseJittering;
500
504 float SampleDistance;
505
509 float GlobalIlluminationReach = 0.0;
510
514 float VolumetricScatteringBlending = 0.0;
515
520 vtkTypeBool AutoAdjustSampleDistances;
521
527 double InteractiveUpdateRate;
528
536 vtkTypeBool InteractiveAdjustSampleDistances;
537
539
546 int VectorMode;
547 int VectorComponent;
548 vtkTimeStamp MagnitudeUploadTime;
550
552
556 vtkDataSet* LastInput;
557 vtkDataSet* LastFilterInput;
559
565 char* Transfer2DYAxisArray;
566
567 int LowResMode = LowResModeDisabled;
568
569private:
571
575 void SetupVectorMode(vtkVolume* vol);
581 void ComputeMagnitudeCellData(vtkDataSet* input, vtkDataArray* arr);
582 void ComputeMagnitudePointData(vtkDataSet* input, vtkDataArray* arr);
584
586 void operator=(const vtkSmartVolumeMapper&) = delete;
587
588 vtkOSPRayVolumeInterface* OSPRayMapper;
589};
590
591VTK_ABI_NAMESPACE_END
592#endif
abstract superclass for arrays of numeric data
abstract class to specify dataset behavior
Definition vtkDataSet.h:53
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:29
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:59
Adaptive volume mapper.
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int GetLastUsedRenderMode()
This will return the render mode used during the previous call to Render().
void SetVectorMode(int mode)
VectorMode is a special rendering mode for 3-component vectors which makes use of GPURayCastMapper's ...
void SetInterpolationModeToLinear()
Set interpolation mode for downsampling (lowres GPU) (initial value: cubic).
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...
void SetInterpolationModeToNearestNeighbor()
Set interpolation mode for downsampling (lowres GPU) (initial value: cubic).
void SetRequestedRenderMode(int mode)
Set the requested render mode.
static vtkSmartVolumeMapper * New()
LowResModeType
LowResDisable disables low res mode (default) LowResResample enable low res mode by automatically res...
void SetRequestedRenderModeToRayCast()
Set the requested render mode to vtkSmartVolumeMapper::RayCastRenderMode.
void SetRequestedRenderModeToGPU()
Set the requested render mode to vtkSmartVolumeMapper::GPURenderMode.
void SetRequestedRenderModeToDefault()
Set the requested render mode to vtkSmartVolumeMapper::DefaultRenderMode.
void Render(vtkRenderer *, vtkVolume *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Initialize rendering for this volume.
void SetInterpolationModeToCubic()
Set interpolation mode for downsampling (lowres GPU) (initial value: cubic).
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:40
window superclass for vtkRenderWindow
Definition vtkWindow.h:25
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_RESLICE_CUBIC
#define VTK_RESLICE_NEAREST
int vtkIdType
Definition vtkType.h:315