VTK  9.0.1
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 =========================================================================*/
26 #ifndef vtkAMRVolumeMapper_h
27 #define vtkAMRVolumeMapper_h
28 
29 #include "vtkImageReslice.h" // for VTK_RESLICE_NEAREST, VTK_RESLICE_CUBIC
30 #include "vtkRenderingVolumeAMRModule.h" // For export macro
31 #include "vtkVolumeMapper.h"
32 
34 class vtkCamera;
35 class vtkImageData;
36 class vtkOverlappingAMR;
38 class vtkUniformGrid;
39 
40 class VTKRENDERINGVOLUMEAMR_EXPORT vtkAMRVolumeMapper : public vtkVolumeMapper
41 {
42 public:
43  static vtkAMRVolumeMapper* New();
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
48 
51  void SetInputData(vtkImageData*) override;
52  void SetInputData(vtkDataSet*) override;
53  virtual void SetInputData(vtkOverlappingAMR*);
54  void SetInputConnection(int port, vtkAlgorithmOutput* input) override;
55  void SetInputConnection(vtkAlgorithmOutput* input) override
56  {
57  this->SetInputConnection(0, input);
58  }
60 
62 
66  double* GetBounds() override;
67  void GetBounds(double bounds[6]) override { this->vtkVolumeMapper::GetBounds(bounds); }
69 
81  void SetScalarMode(int mode) override;
82 
84 
89  void SetBlendMode(int mode) override;
90  int GetBlendMode() override;
92 
94 
100  void SelectScalarArray(int arrayNum) override;
101  void SelectScalarArray(const char* arrayName) override;
103 
105 
108  char* GetArrayName() override;
109  int GetArrayId() override;
110  int GetArrayAccessMode() override;
112 
116  const char* GetScalarModeAsString();
118 
122  void SetCropping(vtkTypeBool) override;
123  vtkTypeBool GetCropping() override;
125 
127 
133  double arg1, double arg2, double arg3, double arg4, double arg5, double arg6) override;
134  void SetCroppingRegionPlanes(const double* planes) override
135  {
136  this->SetCroppingRegionPlanes(planes[0], planes[1], planes[2], planes[3], planes[4], planes[5]);
137  }
138  void GetCroppingRegionPlanes(double* planes) override;
139  double* GetCroppingRegionPlanes() VTK_SIZEHINT(6) override;
141 
142 
153  void SetCroppingRegionFlags(int mode) override;
154  int GetCroppingRegionFlags() override;
156 
157  // The possible values for the default and current render mode ivars
158  enum
159  {
160  DefaultRenderMode = 0,
166  InvalidRenderMode
167  };
168 
170 
174  void SetRequestedRenderMode(int mode);
175  int GetRequestedRenderMode();
177 
184  {
185  this->SetRequestedRenderMode(vtkAMRVolumeMapper::DefaultRenderMode);
186  }
187 
196  {
197  this->SetRequestedRenderMode(vtkAMRVolumeMapper::RayCastAndTextureRenderMode);
198  }
199 
206  {
207  this->SetRequestedRenderMode(vtkAMRVolumeMapper::RayCastRenderMode);
208  }
209 
217  {
218  this->SetRequestedRenderMode(vtkAMRVolumeMapper::TextureRenderMode);
219  }
220 
227  {
228  this->SetRequestedRenderMode(vtkAMRVolumeMapper::GPURenderMode);
229  }
230 
232 
236  void SetInterpolationMode(int mode);
237  int GetInterpolationMode();
239 
240  void SetInterpolationModeToNearestNeighbor() { this->SetInterpolationMode(VTK_RESLICE_NEAREST); }
241 
242  void SetInterpolationModeToLinear() { this->SetInterpolationMode(VTK_RESLICE_LINEAR); }
243 
244  void SetInterpolationModeToCubic() { this->SetInterpolationMode(VTK_RESLICE_CUBIC); }
245 
247 
251  vtkSetVector3Macro(NumberOfSamples, int);
252  vtkGetVector3Macro(NumberOfSamples, int);
254 
260  void Render(vtkRenderer* ren, vtkVolume* vol) override;
261 
268  void ReleaseGraphicsResources(vtkWindow*) override;
269 
270  void ProcessUpdateExtentRequest(vtkRenderer* renderer, vtkInformation* info,
271  vtkInformationVector** inputVector, vtkInformationVector* outputVector);
272  void ProcessInformationRequest(vtkRenderer* renderer, vtkInformation* info,
273  vtkInformationVector** inputVector, vtkInformationVector* outputVector);
274  void UpdateResampler(vtkRenderer* ren, vtkOverlappingAMR* amr);
275  void UpdateResamplerFrustrumMethod(vtkRenderer* ren, vtkOverlappingAMR* amr);
276 
278 
281  vtkSetMacro(RequestedResamplingMode, int);
282  vtkGetMacro(RequestedResamplingMode, int);
283  vtkSetMacro(FreezeFocalPoint, bool);
284  vtkGetMacro(FreezeFocalPoint, bool);
286 
288 
292  vtkSetMacro(ResamplerUpdateTolerance, double);
293  vtkGetMacro(ResamplerUpdateTolerance, double);
295 
297 
302  vtkSetMacro(UseDefaultThreading, bool);
303  vtkGetMacro(UseDefaultThreading, bool);
305 
310  static bool ComputeResamplerBoundsFrustumMethod(
311  vtkCamera* camera, vtkRenderer* renderer, const double data_bounds[6], double out_bounds[6]);
312 
313 protected:
315  ~vtkAMRVolumeMapper() override;
316 
317  // see algorithm for more info
318  int FillInputPortInformation(int port, vtkInformation* info) override;
319  void UpdateGrid();
320 
324  int NumberOfSamples[3];
325 
326  // This indicates that the input has meta data for
327  // doing demand driven operations.
331  // Cached values for camera focal point and
332  // the distance between the camera position and
333  // focal point
334  double LastFocalPointPosition[3];
336  // This is used when determining if
337  // either the camera or focal point has
338  // move enough to cause the resampler to update
342 
343 private:
344  vtkAMRVolumeMapper(const vtkAMRVolumeMapper&) = delete;
345  void operator=(const vtkAMRVolumeMapper&) = delete;
346 };
347 
348 #endif
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:44
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.
virtual void SetCroppingRegionFlags(int)
Set the flags for the cropping regions.
vtkAMRResampleFilter * Resampler
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
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:58
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:34
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:33
int FillInputPortInformation(int, vtkInformation *) override
Fill the input port information objects for this algorithm.
a virtual camera for 3D rendering
Definition: vtkCamera.h:45
topologically and geometrically regular array of data
Definition: vtkImageData.h:41
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...
virtual int GetCroppingRegionFlags()
Set the flags for the cropping regions.
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.