VTK  9.3.20240329
vtkAMRVolumeMapper.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
17 #ifndef vtkAMRVolumeMapper_h
18 #define vtkAMRVolumeMapper_h
19 
20 #include "vtkImageReslice.h" // for VTK_RESLICE_NEAREST, VTK_RESLICE_CUBIC
21 #include "vtkRenderingVolumeAMRModule.h" // For export macro
22 #include "vtkVolumeMapper.h"
23 
24 VTK_ABI_NAMESPACE_BEGIN
26 class vtkCamera;
27 class vtkImageData;
28 class vtkOverlappingAMR;
30 class vtkUniformGrid;
31 
32 class VTKRENDERINGVOLUMEAMR_EXPORT vtkAMRVolumeMapper : public vtkVolumeMapper
33 {
34 public:
37  void PrintSelf(ostream& os, vtkIndent indent) override;
38 
40 
43  void SetInputData(vtkImageData*) override;
44  void SetInputData(vtkDataSet*) override;
47  void SetInputConnection(int port, vtkAlgorithmOutput* input) override;
48  void SetInputConnection(vtkAlgorithmOutput* input) override
49  {
50  this->SetInputConnection(0, input);
51  }
53 
55 
59  double* GetBounds() override;
60  void GetBounds(double bounds[6]) override { this->vtkVolumeMapper::GetBounds(bounds); }
62 
74  void SetScalarMode(int mode) override;
75 
77 
82  void SetBlendMode(int mode) override;
83  int GetBlendMode() VTK_FUTURE_CONST override;
85 
87 
93  void SelectScalarArray(int arrayNum) override;
94  void SelectScalarArray(const char* arrayName) override;
96 
98 
101  char* GetArrayName() override;
102  int GetArrayId() override;
103  int GetArrayAccessMode() override;
105 
109  const char* GetScalarModeAsString();
111 
115  void SetCropping(vtkTypeBool) override;
116  vtkTypeBool GetCropping() VTK_FUTURE_CONST override;
118 
120 
125  void SetCroppingRegionPlanes(
126  double arg1, double arg2, double arg3, double arg4, double arg5, double arg6) override;
127  void SetCroppingRegionPlanes(const double* planes) override
128  {
129  this->SetCroppingRegionPlanes(planes[0], planes[1], planes[2], planes[3], planes[4], planes[5]);
130  }
131  void GetCroppingRegionPlanes(double* planes) override;
132  double* GetCroppingRegionPlanes() VTK_SIZEHINT(6) override;
135 
146  void SetCroppingRegionFlags(int mode) override;
147  int GetCroppingRegionFlags() VTK_FUTURE_CONST override;
149 
150  // The possible values for the default and current render mode ivars
151  enum
152  {
153  DefaultRenderMode = 0,
159  InvalidRenderMode
160  };
161 
163 
170 
177  {
178  this->SetRequestedRenderMode(vtkAMRVolumeMapper::DefaultRenderMode);
179  }
180 
189  {
190  this->SetRequestedRenderMode(vtkAMRVolumeMapper::RayCastAndTextureRenderMode);
191  }
192 
199  {
200  this->SetRequestedRenderMode(vtkAMRVolumeMapper::RayCastRenderMode);
201  }
202 
210  {
211  this->SetRequestedRenderMode(vtkAMRVolumeMapper::TextureRenderMode);
212  }
213 
220  {
221  this->SetRequestedRenderMode(vtkAMRVolumeMapper::GPURenderMode);
222  }
223 
225 
232 
233  void SetInterpolationModeToNearestNeighbor() { this->SetInterpolationMode(VTK_RESLICE_NEAREST); }
234 
235  void SetInterpolationModeToLinear() { this->SetInterpolationMode(VTK_RESLICE_LINEAR); }
236 
237  void SetInterpolationModeToCubic() { this->SetInterpolationMode(VTK_RESLICE_CUBIC); }
238 
240 
244  vtkSetVector3Macro(NumberOfSamples, int);
245  vtkGetVector3Macro(NumberOfSamples, int);
247 
253  void Render(vtkRenderer* ren, vtkVolume* vol) override;
254 
262 
264  vtkInformationVector** inputVector, vtkInformationVector* outputVector);
266  vtkInformationVector** inputVector, vtkInformationVector* outputVector);
269 
271 
274  vtkSetMacro(RequestedResamplingMode, int);
275  vtkGetMacro(RequestedResamplingMode, int);
276  vtkSetMacro(FreezeFocalPoint, bool);
277  vtkGetMacro(FreezeFocalPoint, bool);
279 
281 
285  vtkSetMacro(ResamplerUpdateTolerance, double);
286  vtkGetMacro(ResamplerUpdateTolerance, double);
288 
290 
295  vtkSetMacro(UseDefaultThreading, bool);
296  vtkGetMacro(UseDefaultThreading, bool);
298 
304  vtkCamera* camera, vtkRenderer* renderer, const double data_bounds[6], double out_bounds[6]);
305 
306 protected:
309 
310  // see algorithm for more info
312  void UpdateGrid();
313 
317  int NumberOfSamples[3];
318 
319  // This indicates that the input has meta data for
320  // doing demand driven operations.
324  // Cached values for camera focal point and
325  // the distance between the camera position and
326  // focal point
327  double LastFocalPointPosition[3];
329  // This is used when determining if
330  // either the camera or focal point has
331  // move enough to cause the resampler to update
335 
336 private:
337  vtkAMRVolumeMapper(const vtkAMRVolumeMapper&) = delete;
338  void operator=(const vtkAMRVolumeMapper&) = delete;
339 };
340 
341 VTK_ABI_NAMESPACE_END
342 #endif
This filter is a concrete instance of vtkMultiBlockDataSetAlgorithm and provides functionality for ex...
AMR class for a volume mapper.
void SetInputData(vtkRectilinearGrid *) override
Set the input data.
void SetInterpolationMode(int mode)
Set interpolation mode for downsampling (lowres GPU) (initial value: cubic).
double * GetCroppingRegionPlanes() override
Set/Get the Cropping Region Planes ( xmin, xmax, ymin, ymax, zmin, zmax ) These planes are defined in...
void UpdateResampler(vtkRenderer *ren, vtkOverlappingAMR *amr)
void SetRequestedRenderModeToRayCast()
Set the requested render mode to vtkAMRVolumeMapper::RayCastRenderMode.
void SetInputData(vtkImageData *) override
Set the input data.
void SetInputData(vtkDataSet *) override
Set the input data.
void UpdateResamplerFrustrumMethod(vtkRenderer *ren, vtkOverlappingAMR *amr)
void SetInputConnection(int port, vtkAlgorithmOutput *input) override
Set the input data.
double * GetBounds() override
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
void ProcessUpdateExtentRequest(vtkRenderer *renderer, vtkInformation *info, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
vtkSmartVolumeMapper * InternalMapper
vtkUniformGrid * Grid
void GetCroppingRegionPlanes(double *planes) override
Set/Get the Cropping Region Planes ( xmin, xmax, ymin, ymax, zmin, zmax ) These planes are defined in...
virtual void SetInputData(vtkOverlappingAMR *)
Set the input data.
~vtkAMRVolumeMapper() override
void SetBlendMode(int mode) override
Set/Get the blend mode.
int GetInterpolationMode()
Set interpolation mode for downsampling (lowres GPU) (initial value: cubic).
void SetRequestedRenderModeToTexture()
Set the requested render mode to vtkAMRVolumeMapper::TextureRenderMode.
void SetScalarMode(int mode) override
Control how the mapper works with scalar point data and cell attribute data.
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
void ProcessInformationRequest(vtkRenderer *renderer, vtkInformation *info, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
void GetBounds(double bounds[6]) override
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
void SetInterpolationModeToNearestNeighbor()
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
void SetRequestedRenderMode(int mode)
Set the requested render mode.
void SetRequestedRenderModeToRayCastAndTexture()
Set the requested render mode to vtkAMRVolumeMapper::RayCastAndTextureRenderMode.
void SetRequestedRenderModeToGPU()
Set the requested render mode to vtkAMRVolumeMapper::GPURenderMode.
static bool ComputeResamplerBoundsFrustumMethod(vtkCamera *camera, vtkRenderer *renderer, const double data_bounds[6], double out_bounds[6])
Utility method used by UpdateResamplerFrustrumMethod() to compute the bounds.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int GetRequestedRenderMode()
Set the requested render mode.
int GetBlendMode() VTK_FUTURE_CONST override
Set/Get the blend mode.
void SetInputConnection(vtkAlgorithmOutput *input) override
Set the input data.
void SetRequestedRenderModeToDefault()
Set the requested render mode to vtkAMRVolumeMapper::DefaultRenderMode.
static vtkAMRVolumeMapper * New()
void Render(vtkRenderer *ren, vtkVolume *vol) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
vtkAMRResampleFilter * Resampler
double * GetBounds() override
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
Proxy object to connect input/output ports.
virtual void SetInputConnection(int port, vtkAlgorithmOutput *input)
Set the connection for the given input port index.
a virtual camera for 3D rendering
Definition: vtkCamera.h:151
abstract class to specify dataset behavior
Definition: vtkDataSet.h:166
topologically and geometrically regular array of data
Definition: vtkImageData.h:156
a simple class to control print indentation
Definition: vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
hierarchical dataset of vtkUniformGrids
a dataset that is topologically regular with variable spacing in the three coordinate directions
abstract specification for renderers
Definition: vtkRenderer.h:172
Adaptive volume mapper.
image data with blanking
Abstract class for a volume mapper.
virtual void SetCroppingRegionPlanes(double, double, double, double, double, double)
Set/Get the Cropping Region Planes ( xmin, xmax, ymin, ymax, zmin, zmax ) These planes are defined in...
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:120
window superclass for vtkRenderWindow
Definition: vtkWindow.h:48
@ info
Definition: vtkX3D.h:376
@ mode
Definition: vtkX3D.h:247
@ port
Definition: vtkX3D.h:447
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_RESLICE_CUBIC
#define VTK_RESLICE_NEAREST
#define VTK_RESLICE_LINEAR
#define VTK_SIZEHINT(...)