VTK  9.3.1
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:
35  static vtkAMRVolumeMapper* New();
37  void PrintSelf(ostream& os, vtkIndent indent) override;
38 
40 
43  void SetInputData(vtkImageData*) override;
44  void SetInputData(vtkDataSet*) override;
45  void SetInputData(vtkRectilinearGrid*) override;
46  virtual void SetInputData(vtkOverlappingAMR*);
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() 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() override;
118 
120 
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() 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 
167  void SetRequestedRenderMode(int mode);
168  int GetRequestedRenderMode();
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 
229  void SetInterpolationMode(int mode);
230  int GetInterpolationMode();
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 
261  void ReleaseGraphicsResources(vtkWindow*) override;
262 
263  void ProcessUpdateExtentRequest(vtkRenderer* renderer, vtkInformation* info,
264  vtkInformationVector** inputVector, vtkInformationVector* outputVector);
265  void ProcessInformationRequest(vtkRenderer* renderer, vtkInformation* info,
266  vtkInformationVector** inputVector, vtkInformationVector* outputVector);
267  void UpdateResampler(vtkRenderer* ren, vtkOverlappingAMR* amr);
268  void UpdateResamplerFrustrumMethod(vtkRenderer* ren, vtkOverlappingAMR* amr);
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 
303  static bool ComputeResamplerBoundsFrustumMethod(
304  vtkCamera* camera, vtkRenderer* renderer, const double data_bounds[6], double out_bounds[6]);
305 
306 protected:
308  ~vtkAMRVolumeMapper() override;
309 
310  // see algorithm for more info
311  int FillInputPortInformation(int port, vtkInformation* info) override;
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
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:39
a dataset that is topologically regular with variable spacing in the three coordinate directions ...
virtual char * GetArrayName()
Get the array name or number and component to use for rendering.
#define VTK_RESLICE_NEAREST
Abstract class for a volume mapper.
#define VTK_RESLICE_CUBIC
Store vtkAlgorithm input/output information.
Adaptive volume mapper.
void SetRequestedRenderModeToDefault()
Set the requested render mode to vtkAMRVolumeMapper::DefaultRenderMode.
virtual int GetBlendMode()
Set/Get the blend mode.
vtkAMRResampleFilter * Resampler
abstract class to specify dataset behavior
Definition: vtkDataSet.h:52
void SetRequestedRenderModeToGPU()
Set the requested render mode to vtkAMRVolumeMapper::GPURenderMode.
vtkSmartVolumeMapper * InternalMapper
void SetInterpolationModeToNearestNeighbor()
virtual void SetBlendMode(int)
Set/Get the blend mode.
const char * GetScalarModeAsString()
Return the method for obtaining scalar data.
abstract specification for renderers
Definition: vtkRenderer.h:61
vtkUniformGrid * Grid
virtual void SetScalarMode(int)
Control how the mapper works with scalar point data and cell attribute data.
virtual void SetInputData(vtkImageData *)
Set/Get the input data.
#define VTK_RESLICE_LINEAR
void SetRequestedRenderModeToRayCastAndTexture()
Set the requested render mode to vtkAMRVolumeMapper::RayCastAndTextureRenderMode. ...
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...
Proxy object to connect input/output ports.
AMR class for a volume mapper.
void SetInputConnection(vtkAlgorithmOutput *input) override
Set the input data.
int vtkTypeBool
Definition: vtkABI.h:64
window superclass for vtkRenderWindow
Definition: vtkWindow.h:27
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...
This filter is a concrete instance of vtkMultiBlockDataSetAlgorithm and provides functionality for ex...
virtual void SetCropping(vtkTypeBool)
Turn On/Off orthogonal cropping.
a simple class to control print indentation
Definition: vtkIndent.h:28
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
a virtual camera for 3D rendering
Definition: vtkCamera.h:40
void UpdateGrid(int iteration)
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
virtual double * GetCroppingRegionPlanes()
Set/Get the Cropping Region Planes ( xmin, xmax, ymin, ymax, zmin, zmax ) These planes are defined in...
virtual void SetInputConnection(int port, vtkAlgorithmOutput *input)
Set the connection for the given input port index.
void SetCroppingRegionPlanes(const double *planes) override
Set/Get the Cropping Region Planes ( xmin, xmax, ymin, ymax, zmin, zmax ) These planes are defined in...
#define VTK_SIZEHINT(...)
double * GetBounds() override
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax, zmin,zmax).
virtual vtkTypeBool GetCropping()
Turn On/Off orthogonal cropping.
image data with blanking
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
void GetBounds(double bounds[6]) override
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax, zmin,zmax).
hierarchical dataset of vtkUniformGrids
Store zero or more vtkInformation instances.
static vtkAlgorithm * New()
virtual void SelectScalarArray(int arrayNum)
When ScalarMode is set to UsePointFieldData or UseCellFieldData, you can specify which scalar array t...
void SetRequestedRenderModeToRayCast()
Set the requested render mode to vtkAMRVolumeMapper::RayCastRenderMode.
void SetRequestedRenderModeToTexture()
Set the requested render mode to vtkAMRVolumeMapper::TextureRenderMode.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.