VTK  9.2.20230603
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 
36 VTK_ABI_NAMESPACE_BEGIN
38 class vtkCamera;
39 class vtkImageData;
40 class vtkOverlappingAMR;
42 class vtkUniformGrid;
43 
44 class VTKRENDERINGVOLUMEAMR_EXPORT vtkAMRVolumeMapper : public vtkVolumeMapper
45 {
46 public:
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
52 
55  void SetInputData(vtkImageData*) override;
56  void SetInputData(vtkDataSet*) override;
59  void SetInputConnection(int port, vtkAlgorithmOutput* input) override;
60  void SetInputConnection(vtkAlgorithmOutput* input) override
61  {
62  this->SetInputConnection(0, input);
63  }
65 
67 
71  double* GetBounds() override;
72  void GetBounds(double bounds[6]) override { this->vtkVolumeMapper::GetBounds(bounds); }
74 
86  void SetScalarMode(int mode) override;
87 
89 
94  void SetBlendMode(int mode) override;
95  int GetBlendMode() override;
97 
99 
105  void SelectScalarArray(int arrayNum) override;
106  void SelectScalarArray(const char* arrayName) override;
108 
110 
113  char* GetArrayName() override;
114  int GetArrayId() override;
115  int GetArrayAccessMode() override;
117 
121  const char* GetScalarModeAsString();
123 
127  void SetCropping(vtkTypeBool) override;
130 
132 
138  double arg1, double arg2, double arg3, double arg4, double arg5, double arg6) override;
139  void SetCroppingRegionPlanes(const double* planes) override
140  {
141  this->SetCroppingRegionPlanes(planes[0], planes[1], planes[2], planes[3], planes[4], planes[5]);
142  }
143  void GetCroppingRegionPlanes(double* planes) override;
144  double* GetCroppingRegionPlanes() VTK_SIZEHINT(6) override;
147 
158  void SetCroppingRegionFlags(int mode) override;
159  int GetCroppingRegionFlags() override;
161 
162  // The possible values for the default and current render mode ivars
163  enum
164  {
165  DefaultRenderMode = 0,
171  InvalidRenderMode
172  };
173 
175 
182 
189  {
190  this->SetRequestedRenderMode(vtkAMRVolumeMapper::DefaultRenderMode);
191  }
192 
201  {
202  this->SetRequestedRenderMode(vtkAMRVolumeMapper::RayCastAndTextureRenderMode);
203  }
204 
211  {
212  this->SetRequestedRenderMode(vtkAMRVolumeMapper::RayCastRenderMode);
213  }
214 
222  {
223  this->SetRequestedRenderMode(vtkAMRVolumeMapper::TextureRenderMode);
224  }
225 
232  {
233  this->SetRequestedRenderMode(vtkAMRVolumeMapper::GPURenderMode);
234  }
235 
237 
244 
245  void SetInterpolationModeToNearestNeighbor() { this->SetInterpolationMode(VTK_RESLICE_NEAREST); }
246 
247  void SetInterpolationModeToLinear() { this->SetInterpolationMode(VTK_RESLICE_LINEAR); }
248 
249  void SetInterpolationModeToCubic() { this->SetInterpolationMode(VTK_RESLICE_CUBIC); }
250 
252 
256  vtkSetVector3Macro(NumberOfSamples, int);
257  vtkGetVector3Macro(NumberOfSamples, int);
259 
265  void Render(vtkRenderer* ren, vtkVolume* vol) override;
266 
274 
276  vtkInformationVector** inputVector, vtkInformationVector* outputVector);
278  vtkInformationVector** inputVector, vtkInformationVector* outputVector);
281 
283 
286  vtkSetMacro(RequestedResamplingMode, int);
287  vtkGetMacro(RequestedResamplingMode, int);
288  vtkSetMacro(FreezeFocalPoint, bool);
289  vtkGetMacro(FreezeFocalPoint, bool);
291 
293 
297  vtkSetMacro(ResamplerUpdateTolerance, double);
298  vtkGetMacro(ResamplerUpdateTolerance, double);
300 
302 
307  vtkSetMacro(UseDefaultThreading, bool);
308  vtkGetMacro(UseDefaultThreading, bool);
310 
316  vtkCamera* camera, vtkRenderer* renderer, const double data_bounds[6], double out_bounds[6]);
317 
318 protected:
321 
322  // see algorithm for more info
324  void UpdateGrid();
325 
329  int NumberOfSamples[3];
330 
331  // This indicates that the input has meta data for
332  // doing demand driven operations.
336  // Cached values for camera focal point and
337  // the distance between the camera position and
338  // focal point
339  double LastFocalPointPosition[3];
341  // This is used when determining if
342  // either the camera or focal point has
343  // move enough to cause the resampler to update
347 
348 private:
349  vtkAMRVolumeMapper(const vtkAMRVolumeMapper&) = delete;
350  void operator=(const vtkAMRVolumeMapper&) = delete;
351 };
352 
353 VTK_ABI_NAMESPACE_END
354 #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).
vtkTypeBool GetCropping() override
Turn On/Off orthogonal cropping.
int GetBlendMode() override
Set/Get the blend mode.
double * GetCroppingRegionPlanes() override
Set/Get the Cropping Region Planes ( xmin, xmax, ymin, ymax, zmin, zmax ) These planes are defined in...
const char * GetScalarModeAsString()
Return the method for obtaining scalar data.
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 SetCroppingRegionPlanes(double arg1, double arg2, double arg3, double arg4, double arg5, double arg6) override
Set/Get the Cropping Region Planes ( xmin, xmax, ymin, ymax, zmin, zmax ) These planes are defined in...
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)
void SelectScalarArray(const char *arrayName) override
When ScalarMode is set to UsePointFieldData or UseCellFieldData, you can specify which scalar array t...
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
int GetArrayId() override
Get the array name or number and component to use for rendering.
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.
int GetArrayAccessMode() override
Get the array name or number and component to use for rendering.
void SelectScalarArray(int arrayNum) override
When ScalarMode is set to UsePointFieldData or UseCellFieldData, you can specify which scalar array t...
void SetCropping(vtkTypeBool) override
Turn On/Off orthogonal cropping.
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.
void SetInputConnection(vtkAlgorithmOutput *input) override
Set the input data.
void SetRequestedRenderModeToDefault()
Set the requested render mode to vtkAMRVolumeMapper::DefaultRenderMode.
static vtkAMRVolumeMapper * New()
void SetCroppingRegionPlanes(const double *planes) override
Set/Get the Cropping Region Planes ( xmin, xmax, ymin, ymax, zmin, zmax ) These planes are defined in...
char * GetArrayName() override
Get the array name or number and component to use for rendering.
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:162
abstract class to specify dataset behavior
Definition: vtkDataSet.h:174
topologically and geometrically regular array of data
Definition: vtkImageData.h:164
a simple class to control print indentation
Definition: vtkIndent.h:120
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:183
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:151
window superclass for vtkRenderWindow
Definition: vtkWindow.h:40
@ info
Definition: vtkX3D.h:388
@ mode
Definition: vtkX3D.h:259
@ port
Definition: vtkX3D.h:459
int vtkTypeBool
Definition: vtkABI.h:71
#define VTK_RESLICE_CUBIC
#define VTK_RESLICE_NEAREST
#define VTK_RESLICE_LINEAR
#define VTK_SIZEHINT(...)