VTK  9.2.6
vtkAMRVolumeMapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAMRVolumeMapper.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 =========================================================================*/
29 #ifndef vtkAMRVolumeMapper_h
30 #define vtkAMRVolumeMapper_h
31 
32 #include "vtkImageReslice.h" // for VTK_RESLICE_NEAREST, VTK_RESLICE_CUBIC
33 #include "vtkRenderingVolumeAMRModule.h" // For export macro
34 #include "vtkVolumeMapper.h"
35 
37 class vtkCamera;
38 class vtkImageData;
39 class vtkOverlappingAMR;
41 class vtkUniformGrid;
42 
43 class VTKRENDERINGVOLUMEAMR_EXPORT vtkAMRVolumeMapper : public vtkVolumeMapper
44 {
45 public:
46  static vtkAMRVolumeMapper* New();
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
51 
54  void SetInputData(vtkImageData*) override;
55  void SetInputData(vtkDataSet*) override;
56  void SetInputData(vtkRectilinearGrid*) override;
57  virtual void SetInputData(vtkOverlappingAMR*);
58  void SetInputConnection(int port, vtkAlgorithmOutput* input) override;
59  void SetInputConnection(vtkAlgorithmOutput* input) override
60  {
61  this->SetInputConnection(0, input);
62  }
64 
66 
70  double* GetBounds() override;
71  void GetBounds(double bounds[6]) override { this->vtkVolumeMapper::GetBounds(bounds); }
73 
85  void SetScalarMode(int mode) override;
86 
88 
93  void SetBlendMode(int mode) override;
94  int GetBlendMode() override;
96 
98 
104  void SelectScalarArray(int arrayNum) override;
105  void SelectScalarArray(const char* arrayName) override;
107 
109 
112  char* GetArrayName() override;
113  int GetArrayId() override;
114  int GetArrayAccessMode() override;
116 
120  const char* GetScalarModeAsString();
122 
126  void SetCropping(vtkTypeBool) override;
127  vtkTypeBool GetCropping() override;
129 
131 
137  double arg1, double arg2, double arg3, double arg4, double arg5, double arg6) override;
138  void SetCroppingRegionPlanes(const double* planes) override
139  {
140  this->SetCroppingRegionPlanes(planes[0], planes[1], planes[2], planes[3], planes[4], planes[5]);
141  }
142  void GetCroppingRegionPlanes(double* planes) override;
143  double* GetCroppingRegionPlanes() VTK_SIZEHINT(6) override;
146 
157  void SetCroppingRegionFlags(int mode) override;
158  int GetCroppingRegionFlags() override;
160 
161  // The possible values for the default and current render mode ivars
162  enum
163  {
164  DefaultRenderMode = 0,
170  InvalidRenderMode
171  };
172 
174 
178  void SetRequestedRenderMode(int mode);
179  int GetRequestedRenderMode();
181 
188  {
189  this->SetRequestedRenderMode(vtkAMRVolumeMapper::DefaultRenderMode);
190  }
191 
200  {
201  this->SetRequestedRenderMode(vtkAMRVolumeMapper::RayCastAndTextureRenderMode);
202  }
203 
210  {
211  this->SetRequestedRenderMode(vtkAMRVolumeMapper::RayCastRenderMode);
212  }
213 
221  {
222  this->SetRequestedRenderMode(vtkAMRVolumeMapper::TextureRenderMode);
223  }
224 
231  {
232  this->SetRequestedRenderMode(vtkAMRVolumeMapper::GPURenderMode);
233  }
234 
236 
240  void SetInterpolationMode(int mode);
241  int GetInterpolationMode();
243 
244  void SetInterpolationModeToNearestNeighbor() { this->SetInterpolationMode(VTK_RESLICE_NEAREST); }
245 
246  void SetInterpolationModeToLinear() { this->SetInterpolationMode(VTK_RESLICE_LINEAR); }
247 
248  void SetInterpolationModeToCubic() { this->SetInterpolationMode(VTK_RESLICE_CUBIC); }
249 
251 
255  vtkSetVector3Macro(NumberOfSamples, int);
256  vtkGetVector3Macro(NumberOfSamples, int);
258 
264  void Render(vtkRenderer* ren, vtkVolume* vol) override;
265 
272  void ReleaseGraphicsResources(vtkWindow*) override;
273 
274  void ProcessUpdateExtentRequest(vtkRenderer* renderer, vtkInformation* info,
275  vtkInformationVector** inputVector, vtkInformationVector* outputVector);
276  void ProcessInformationRequest(vtkRenderer* renderer, vtkInformation* info,
277  vtkInformationVector** inputVector, vtkInformationVector* outputVector);
278  void UpdateResampler(vtkRenderer* ren, vtkOverlappingAMR* amr);
279  void UpdateResamplerFrustrumMethod(vtkRenderer* ren, vtkOverlappingAMR* amr);
280 
282 
285  vtkSetMacro(RequestedResamplingMode, int);
286  vtkGetMacro(RequestedResamplingMode, int);
287  vtkSetMacro(FreezeFocalPoint, bool);
288  vtkGetMacro(FreezeFocalPoint, bool);
290 
292 
296  vtkSetMacro(ResamplerUpdateTolerance, double);
297  vtkGetMacro(ResamplerUpdateTolerance, double);
299 
301 
306  vtkSetMacro(UseDefaultThreading, bool);
307  vtkGetMacro(UseDefaultThreading, bool);
309 
314  static bool ComputeResamplerBoundsFrustumMethod(
315  vtkCamera* camera, vtkRenderer* renderer, const double data_bounds[6], double out_bounds[6]);
316 
317 protected:
319  ~vtkAMRVolumeMapper() override;
320 
321  // see algorithm for more info
322  int FillInputPortInformation(int port, vtkInformation* info) override;
323  void UpdateGrid();
324 
328  int NumberOfSamples[3];
329 
330  // This indicates that the input has meta data for
331  // doing demand driven operations.
335  // Cached values for camera focal point and
336  // the distance between the camera position and
337  // focal point
338  double LastFocalPointPosition[3];
340  // This is used when determining if
341  // either the camera or focal point has
342  // move enough to cause the resampler to update
346 
347 private:
348  vtkAMRVolumeMapper(const vtkAMRVolumeMapper&) = delete;
349  void operator=(const vtkAMRVolumeMapper&) = delete;
350 };
351 
352 #endif
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:50
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:62
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:72
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:69
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
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:39
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
a virtual camera for 3D rendering
Definition: vtkCamera.h:51
topologically and geometrically regular array of data
Definition: vtkImageData.h:53
virtual double * GetCroppingRegionPlanes()
Set/Get the Cropping Region Planes ( xmin, xmax, ymin, ymax, zmin, zmax ) These planes are defined in...
void UpdateGrid(const int iteration)
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.