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 =========================================================================*/
26 #ifndef vtkAMRVolumeMapper_h
27 #define vtkAMRVolumeMapper_h
28 
29 #include "vtkRenderingVolumeAMRModule.h" // For export macro
30 #include "vtkVolumeMapper.h"
31 #include "vtkImageReslice.h" // for VTK_RESLICE_NEAREST, VTK_RESLICE_CUBIC
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  {this->SetInputConnection(0, input);}
58 
60 
64  double *GetBounds() override;
65  void GetBounds(double bounds[6]) override
66  {this->vtkVolumeMapper::GetBounds(bounds); };
68 
80  void SetScalarMode(int mode) override;
81 
83 
88  void SetBlendMode(int mode) override;
89  int GetBlendMode() override;
91 
93 
99  void SelectScalarArray(int arrayNum) override;
100  void SelectScalarArray(const char* arrayName) override;
102 
104 
107  char* GetArrayName() override;
108  int GetArrayId() override;
109  int GetArrayAccessMode() override;
111 
115  const char *GetScalarModeAsString();
117 
121  void SetCropping(int mode) override;
122  int GetCropping() override;
124 
126 
131  void SetCroppingRegionPlanes(double arg1, double arg2, double arg3,
132  double arg4, double arg5, double arg6) override;
133  void SetCroppingRegionPlanes(double *planes) override
135  planes[0],planes[1],planes[2],
136  planes[3],planes[4],planes[5]);}
137  void GetCroppingRegionPlanes(double *planes) override;
138  double *GetCroppingRegionPlanes() VTK_SIZEHINT(6) override;
140 
141 
152  void SetCroppingRegionFlags(int mode) override;
153  int GetCroppingRegionFlags() override;
155 
156 // The possible values for the default and current render mode ivars
157  enum
158  {
159  DefaultRenderMode=0,
165  InvalidRenderMode
166  };
167 
169 
173  void SetRequestedRenderMode(int mode);
174  int GetRequestedRenderMode();
176 
183  {this->SetRequestedRenderMode(vtkAMRVolumeMapper::DefaultRenderMode);}
184 
193  {this->SetRequestedRenderMode(vtkAMRVolumeMapper::RayCastAndTextureRenderMode);}
194 
201  {this->SetRequestedRenderMode(vtkAMRVolumeMapper::RayCastRenderMode);}
202 
210  {this->SetRequestedRenderMode(vtkAMRVolumeMapper::TextureRenderMode);}
211 
218  {this->SetRequestedRenderMode(vtkAMRVolumeMapper::GPURenderMode);}
219 
221 
225  void SetInterpolationMode(int mode);
226  int GetInterpolationMode();
228 
230  {this->SetInterpolationMode(VTK_RESLICE_NEAREST);}
231 
233  {this->SetInterpolationMode(VTK_RESLICE_LINEAR);}
234 
236  {this->SetInterpolationMode(VTK_RESLICE_CUBIC);}
237 
239 
243  vtkSetVector3Macro(NumberOfSamples,int);
244  vtkGetVector3Macro(NumberOfSamples,int);
246 
252  void Render(vtkRenderer *ren, vtkVolume *vol) override;
253 
260  void ReleaseGraphicsResources(vtkWindow *) override;
261 
262  void ProcessUpdateExtentRequest(vtkRenderer *renderer, vtkInformation*info,
263  vtkInformationVector **inputVector,
264  vtkInformationVector *outputVector);
265  void ProcessInformationRequest(vtkRenderer *renderer, vtkInformation*info,
266  vtkInformationVector **inputVector,
267  vtkInformationVector *outputVector);
268  void UpdateResampler(vtkRenderer *ren, vtkOverlappingAMR *amr);
269  void UpdateResamplerFrustrumMethod(vtkRenderer *ren, vtkOverlappingAMR *amr);
270 
272 
275  vtkSetMacro(RequestedResamplingMode, int);
276  vtkGetMacro(RequestedResamplingMode, int);
277  vtkSetMacro(FreezeFocalPoint, bool);
278  vtkGetMacro(FreezeFocalPoint, bool);
280 
282 
286  vtkSetMacro(ResamplerUpdateTolerance, double);
287  vtkGetMacro(ResamplerUpdateTolerance, double);
289 
291 
296  vtkSetMacro(UseDefaultThreading, bool);
297  vtkGetMacro(UseDefaultThreading, bool);
299 
304  static bool ComputeResamplerBoundsFrustumMethod(
305  vtkCamera* camera, vtkRenderer* renderer,
306  const double data_bounds[6], double out_bounds[6]);
307 
308 protected:
310  ~vtkAMRVolumeMapper() override;
311 
312  // see algorithm for more info
313  int FillInputPortInformation(int port, vtkInformation* info) override;
314  void UpdateGrid();
315 
319  int NumberOfSamples[3];
320  double Bounds[6];
321  // This indicates that the input has meta data for
322  // doing demand driven operations.
326  // Cached values for camera focal point and
327  // the distance between the camera position and
328  // focal point
329  double LastFocalPointPosition[3];
331  // This is used when determining if
332  // either the camera or focal point has
333  // move enough to cause the resampler to update
337 
338 private:
339  vtkAMRVolumeMapper(const vtkAMRVolumeMapper&) = delete;
340  void operator=(const vtkAMRVolumeMapper&) = delete;
341 };
342 
343 
344 #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.
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:57
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.
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.
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:44
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
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,...
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,...
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.