VTK
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 "vtkRenderingVolumeAMRModule.h" // For export macro
33 #include "vtkVolumeMapper.h"
34 #include "vtkImageReslice.h" // for VTK_RESLICE_NEAREST, VTK_RESLICE_CUBIC
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  virtual void SetInputData( vtkOverlappingAMR* );
57  void SetInputConnection (int port, vtkAlgorithmOutput *input) override;
58  void SetInputConnection (vtkAlgorithmOutput *input) override
59  {this->SetInputConnection(0, input);}
61 
63 
67  double *GetBounds() override;
68  void GetBounds(double bounds[6]) override
69  {this->vtkVolumeMapper::GetBounds(bounds); };
71 
83  void SetScalarMode(int mode) override;
84 
86 
91  void SetBlendMode(int mode) override;
92  int GetBlendMode() override;
94 
96 
102  void SelectScalarArray(int arrayNum) override;
103  void SelectScalarArray(const char* arrayName) override;
105 
107 
110  char* GetArrayName() override;
111  int GetArrayId() override;
112  int GetArrayAccessMode() override;
114 
118  const char *GetScalarModeAsString();
120 
124  void SetCropping(vtkTypeBool) override;
125  vtkTypeBool GetCropping() override;
127 
129 
134  void SetCroppingRegionPlanes(double arg1, double arg2, double arg3,
135  double arg4, double arg5, double arg6) override;
136  void SetCroppingRegionPlanes(double *planes) override
138  planes[0],planes[1],planes[2],
139  planes[3],planes[4],planes[5]);}
140  void GetCroppingRegionPlanes(double *planes) override;
141  double *GetCroppingRegionPlanes() VTK_SIZEHINT(6) override;
143 
144 
155  void SetCroppingRegionFlags(int mode) override;
156  int GetCroppingRegionFlags() override;
158 
159 // The possible values for the default and current render mode ivars
160  enum
161  {
162  DefaultRenderMode=0,
168  InvalidRenderMode
169  };
170 
172 
176  void SetRequestedRenderMode(int mode);
177  int GetRequestedRenderMode();
179 
186  {this->SetRequestedRenderMode(vtkAMRVolumeMapper::DefaultRenderMode);}
187 
196  {this->SetRequestedRenderMode(vtkAMRVolumeMapper::RayCastAndTextureRenderMode);}
197 
204  {this->SetRequestedRenderMode(vtkAMRVolumeMapper::RayCastRenderMode);}
205 
213  {this->SetRequestedRenderMode(vtkAMRVolumeMapper::TextureRenderMode);}
214 
221  {this->SetRequestedRenderMode(vtkAMRVolumeMapper::GPURenderMode);}
222 
224 
228  void SetInterpolationMode(int mode);
229  int GetInterpolationMode();
231 
233  {this->SetInterpolationMode(VTK_RESLICE_NEAREST);}
234 
236  {this->SetInterpolationMode(VTK_RESLICE_LINEAR);}
237 
239  {this->SetInterpolationMode(VTK_RESLICE_CUBIC);}
240 
242 
246  vtkSetVector3Macro(NumberOfSamples,int);
247  vtkGetVector3Macro(NumberOfSamples,int);
249 
255  void Render(vtkRenderer *ren, vtkVolume *vol) override;
256 
263  void ReleaseGraphicsResources(vtkWindow *) override;
264 
265  void ProcessUpdateExtentRequest(vtkRenderer *renderer, vtkInformation*info,
266  vtkInformationVector **inputVector,
267  vtkInformationVector *outputVector);
268  void ProcessInformationRequest(vtkRenderer *renderer, vtkInformation*info,
269  vtkInformationVector **inputVector,
270  vtkInformationVector *outputVector);
271  void UpdateResampler(vtkRenderer *ren, vtkOverlappingAMR *amr);
272  void UpdateResamplerFrustrumMethod(vtkRenderer *ren, vtkOverlappingAMR *amr);
273 
275 
278  vtkSetMacro(RequestedResamplingMode, int);
279  vtkGetMacro(RequestedResamplingMode, int);
280  vtkSetMacro(FreezeFocalPoint, bool);
281  vtkGetMacro(FreezeFocalPoint, bool);
283 
285 
289  vtkSetMacro(ResamplerUpdateTolerance, double);
290  vtkGetMacro(ResamplerUpdateTolerance, double);
292 
294 
299  vtkSetMacro(UseDefaultThreading, bool);
300  vtkGetMacro(UseDefaultThreading, bool);
302 
307  static bool ComputeResamplerBoundsFrustumMethod(
308  vtkCamera* camera, vtkRenderer* renderer,
309  const double data_bounds[6], double out_bounds[6]);
310 
311 protected:
313  ~vtkAMRVolumeMapper() override;
314 
315  // see algorithm for more info
316  int FillInputPortInformation(int port, vtkInformation* info) override;
317  void UpdateGrid();
318 
322  int NumberOfSamples[3];
323  double Bounds[6];
324  // This indicates that the input has meta data for
325  // doing demand driven operations.
329  // Cached values for camera focal point and
330  // the distance between the camera position and
331  // focal point
332  double LastFocalPointPosition[3];
334  // This is used when determining if
335  // either the camera or focal point has
336  // move enough to cause the resampler to update
340 
341 private:
342  vtkAMRVolumeMapper(const vtkAMRVolumeMapper&) = delete;
343  void operator=(const vtkAMRVolumeMapper&) = delete;
344 };
345 
346 
347 #endif
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:50
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: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:63
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:37
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.
void SetCroppingRegionPlanes(double *planes) override
Set/Get the Cropping Region Planes ( xmin, xmax, ymin, ymax, zmin, zmax ) These planes are defined in...
a virtual camera for 3D rendering
Definition: vtkCamera.h:50
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
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.
#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.