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 );
46 
48 
51  virtual void SetInputData( vtkImageData* );
52  virtual void SetInputData( vtkDataSet* );
53  virtual void SetInputData( vtkOverlappingAMR* );
54  virtual void SetInputConnection (int port, vtkAlgorithmOutput *input);
55  virtual void SetInputConnection (vtkAlgorithmOutput *input)
56  {this->SetInputConnection(0, input);}
58 
60 
64  virtual double *GetBounds();
65  virtual void GetBounds(double bounds[6])
66  {this->vtkVolumeMapper::GetBounds(bounds); };
68 
80  virtual void SetScalarMode(int mode);
81 
83 
92  virtual void SetBlendMode(int mode);
93  virtual int GetBlendMode();
95 
97 
103  virtual void SelectScalarArray(int arrayNum);
104  virtual void SelectScalarArray(const char* arrayName);
106 
108 
111  virtual char* GetArrayName();
112  virtual int GetArrayId();
113  virtual int GetArrayAccessMode();
115 
119  const char *GetScalarModeAsString();
121 
125  virtual void SetCropping(int mode);
126  virtual int GetCropping();
128 
130 
135  virtual void SetCroppingRegionPlanes(double arg1, double arg2, double arg3,
136  double arg4, double arg5, double arg6);
137  virtual void SetCroppingRegionPlanes(double *planes)
139  planes[0],planes[1],planes[2],
140  planes[3],planes[4],planes[5]);}
141  virtual void GetCroppingRegionPlanes(double *planes);
142  virtual double *GetCroppingRegionPlanes();
144 
145 
156  virtual void SetCroppingRegionFlags(int mode);
157  virtual int GetCroppingRegionFlags();
159 
160 // The possible values for the default and current render mode ivars
161  enum
162  {
163  DefaultRenderMode=0,
169  InvalidRenderMode
170  };
171 
173 
177  void SetRequestedRenderMode(int mode);
178  int GetRequestedRenderMode();
180 
187  {this->SetRequestedRenderMode(vtkAMRVolumeMapper::DefaultRenderMode);}
188 
197  {this->SetRequestedRenderMode(vtkAMRVolumeMapper::RayCastAndTextureRenderMode);}
198 
205  {this->SetRequestedRenderMode(vtkAMRVolumeMapper::RayCastRenderMode);}
206 
214  {this->SetRequestedRenderMode(vtkAMRVolumeMapper::TextureRenderMode);}
215 
222  {this->SetRequestedRenderMode(vtkAMRVolumeMapper::GPURenderMode);}
223 
225 
229  void SetInterpolationMode(int mode);
230  int GetInterpolationMode();
232 
234  {this->SetInterpolationMode(VTK_RESLICE_NEAREST);}
235 
237  {this->SetInterpolationMode(VTK_RESLICE_LINEAR);}
238 
240  {this->SetInterpolationMode(VTK_RESLICE_CUBIC);}
241 
243 
247  vtkSetVector3Macro(NumberOfSamples,int);
248  vtkGetVector3Macro(NumberOfSamples,int);
250 
256  virtual void Render(vtkRenderer *ren, vtkVolume *vol);
257 
264  virtual void ReleaseGraphicsResources(vtkWindow *);
265 
266  void ProcessUpdateExtentRequest(vtkRenderer *renderer, vtkInformation*info,
267  vtkInformationVector **inputVector,
268  vtkInformationVector *outputVector);
269  void ProcessInformationRequest(vtkRenderer *renderer, vtkInformation*info,
270  vtkInformationVector **inputVector,
271  vtkInformationVector *outputVector);
272  void UpdateResampler(vtkRenderer *ren, vtkOverlappingAMR *amr);
273  void UpdateResamplerFrustrumMethod(vtkRenderer *ren, vtkOverlappingAMR *amr);
274 
276 
279  vtkSetMacro(RequestedResamplingMode, int);
280  vtkGetMacro(RequestedResamplingMode, int);
281  vtkSetMacro(FreezeFocalPoint, bool);
282  vtkGetMacro(FreezeFocalPoint, bool);
284 
286 
290  vtkSetMacro(ResamplerUpdateTolerance, double);
291  vtkGetMacro(ResamplerUpdateTolerance, double);
293 
295 
300  vtkSetMacro(UseDefaultThreading, bool);
301  vtkGetMacro(UseDefaultThreading, bool);
303 
308  static bool ComputeResamplerBoundsFrustumMethod(
309  vtkCamera* camera, vtkRenderer* renderer,
310  const double data_bounds[6], double out_bounds[6]);
311 
312 protected:
315 
316  // see algorithm for more info
318  void UpdateGrid();
319 
323  int NumberOfSamples[3];
324  double Bounds[6];
325  // This indicates that the input has meta data for
326  // doing demand driven operations.
330  // Cached values for camera focal point and
331  // the distance between the camera position and
332  // focal point
333  double LastFocalPointPosition[3];
335  // This is used when determing if
336  // either the camera or focal point has
337  // move enough to cause the resampler to update
341 
342 private:
343  vtkAMRVolumeMapper(const vtkAMRVolumeMapper&) VTK_DELETE_FUNCTION;
344  void operator=(const vtkAMRVolumeMapper&) VTK_DELETE_FUNCTION;
345 };
346 
347 
348 #endif
vtkAbstractVolumeMapper::GetArrayName
virtual char * GetArrayName()
Get the array name or number and component to use for rendering.
Definition: vtkAbstractVolumeMapper.h:102
vtkVolumeMapper
Abstract class for a volume mapper.
Definition: vtkVolumeMapper.h:49
vtkAMRVolumeMapper::SetInputConnection
virtual void SetInputConnection(vtkAlgorithmOutput *input)
Definition: vtkAMRVolumeMapper.h:55
vtkImageReslice.h
vtkVolumeMapper::SetCroppingRegionFlags
virtual void SetCroppingRegionFlags(int)
Set the flags for the cropping regions.
vtkVolumeMapper::FillInputPortInformation
virtual int FillInputPortInformation(int, vtkInformation *)
Fill the input port information objects for this algorithm.
vtkAMRVolumeMapper::InternalMapper
vtkSmartVolumeMapper * InternalMapper
Definition: vtkAMRVolumeMapper.h:320
vtkVolume
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:50
vtkAMRVolumeMapper::ResamplerUpdateTolerance
double ResamplerUpdateTolerance
Definition: vtkAMRVolumeMapper.h:338
vtkAMRVolumeMapper::RayCastRenderMode
Definition: vtkAMRVolumeMapper.h:165
vtkAbstractVolumeMapper::GetScalarModeAsString
const char * GetScalarModeAsString()
Return the method for obtaining scalar data.
vtkAMRVolumeMapper::LastPostionFPDistance
double LastPostionFPDistance
Definition: vtkAMRVolumeMapper.h:334
vtkAMRVolumeMapper::SetCroppingRegionPlanes
virtual void SetCroppingRegionPlanes(double *planes)
Definition: vtkAMRVolumeMapper.h:137
vtkVolumeMapper::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkAMRVolumeMapper::UseDefaultThreading
bool UseDefaultThreading
Definition: vtkAMRVolumeMapper.h:340
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkAMRVolumeMapper::RequestedResamplingMode
int RequestedResamplingMode
Definition: vtkAMRVolumeMapper.h:328
vtkVolumeMapper::GetBlendMode
virtual int GetBlendMode()
vtkAMRVolumeMapper::UndefinedRenderMode
Definition: vtkAMRVolumeMapper.h:168
vtkAMRVolumeMapper::FreezeFocalPoint
bool FreezeFocalPoint
Definition: vtkAMRVolumeMapper.h:329
vtkUniformGrid
image data with blanking
Definition: vtkUniformGrid.h:40
vtkVolumeMapper::SetCroppingRegionPlanes
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...
vtkAMRVolumeMapper::SetRequestedRenderModeToDefault
void SetRequestedRenderModeToDefault()
Set the requested render mode to vtkAMRVolumeMapper::DefaultRenderMode.
Definition: vtkAMRVolumeMapper.h:186
vtkAMRVolumeMapper::HasMetaData
bool HasMetaData
Definition: vtkAMRVolumeMapper.h:327
vtkAMRVolumeMapper::DefaultRenderMode
Definition: vtkAMRVolumeMapper.h:163
vtkVolumeMapper::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
Definition: vtkVolumeMapper.h:196
vtkAMRVolumeMapper::GPURenderMode
Definition: vtkAMRVolumeMapper.h:167
vtkAMRVolumeMapper::TextureRenderMode
Definition: vtkAMRVolumeMapper.h:166
vtkAbstractVolumeMapper::GetArrayId
virtual int GetArrayId()
Definition: vtkAbstractVolumeMapper.h:103
vtkAbstractVolumeMapper::GetArrayAccessMode
virtual int GetArrayAccessMode()
Definition: vtkAbstractVolumeMapper.h:104
vtkVolumeMapper::SetCropping
virtual void SetCropping(int)
Turn On/Off orthogonal cropping.
vtkAbstractVolumeMapper::SetScalarMode
virtual void SetScalarMode(int)
Control how the mapper works with scalar point data and cell attribute data.
vtkAMRVolumeMapper::SetInterpolationModeToNearestNeighbor
void SetInterpolationModeToNearestNeighbor()
Definition: vtkAMRVolumeMapper.h:233
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkAMRVolumeMapper::GetBounds
virtual void GetBounds(double bounds[6])
Get the bounds for this mapper as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
Definition: vtkAMRVolumeMapper.h:65
vtkAMRVolumeMapper::SetInterpolationModeToCubic
void SetInterpolationModeToCubic()
Definition: vtkAMRVolumeMapper.h:239
UpdateGrid
void UpdateGrid(const int iteration)
vtkX3D::port
Definition: vtkX3D.h:447
vtkVolumeMapper::GetCropping
virtual int GetCropping()
vtkVolumeMapper::SetBlendMode
virtual void SetBlendMode(int)
Set/Get the blend mode.
VTK_RESLICE_CUBIC
#define VTK_RESLICE_CUBIC
Definition: vtkImageReslice.h:68
vtkVolumeMapper.h
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkVolumeMapper::Render
virtual void Render(vtkRenderer *ren, vtkVolume *vol)=0
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
vtkSmartVolumeMapper
Adaptive volume mapper.
Definition: vtkSmartVolumeMapper.h:95
vtkAMRVolumeMapper::Grid
vtkUniformGrid * Grid
Definition: vtkAMRVolumeMapper.h:322
vtkCamera
a virtual camera for 3D rendering
Definition: vtkCamera.h:50
vtkAMRVolumeMapper::GridNeedsToBeUpdated
bool GridNeedsToBeUpdated
Definition: vtkAMRVolumeMapper.h:339
VTK_RESLICE_NEAREST
#define VTK_RESLICE_NEAREST
Definition: vtkImageReslice.h:66
vtkAMRVolumeMapper::SetInterpolationModeToLinear
void SetInterpolationModeToLinear()
Definition: vtkAMRVolumeMapper.h:236
vtkOverlappingAMR
hierarchical dataset of vtkUniformGrids
Definition: vtkOverlappingAMR.h:46
vtkAMRVolumeMapper::SetRequestedRenderModeToRayCast
void SetRequestedRenderModeToRayCast()
Set the requested render mode to vtkAMRVolumeMapper::RayCastRenderMode.
Definition: vtkAMRVolumeMapper.h:204
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkAlgorithm::SetInputConnection
virtual void SetInputConnection(int port, vtkAlgorithmOutput *input)
Set the connection for the given input port index.
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkAbstractVolumeMapper::GetBounds
virtual double * GetBounds()
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkAMRVolumeMapper::RayCastAndTextureRenderMode
Definition: vtkAMRVolumeMapper.h:164
vtkX3D::info
Definition: vtkX3D.h:376
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkAMRVolumeMapper::SetRequestedRenderModeToTexture
void SetRequestedRenderModeToTexture()
Set the requested render mode to vtkAMRVolumeMapper::TextureRenderMode.
Definition: vtkAMRVolumeMapper.h:213
vtkVolumeMapper::GetCroppingRegionFlags
virtual int GetCroppingRegionFlags()
vtkAlgorithmOutput
Proxy object to connect input/output ports.
Definition: vtkAlgorithmOutput.h:39
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkVolumeMapper::GetCroppingRegionPlanes
virtual double * GetCroppingRegionPlanes()
VTK_RESLICE_LINEAR
#define VTK_RESLICE_LINEAR
Definition: vtkImageReslice.h:67
vtkAbstractVolumeMapper::SelectScalarArray
virtual void SelectScalarArray(int arrayNum)
When ScalarMode is set to UsePointFieldData or UseCellFieldData, you can specify which scalar array t...
vtkVolumeMapper::SetInputData
virtual void SetInputData(vtkImageData *)
Set/Get the input data.
vtkAMRVolumeMapper::SetRequestedRenderModeToGPU
void SetRequestedRenderModeToGPU()
Set the requested render mode to vtkAMRVolumeMapper::GPURenderMode.
Definition: vtkAMRVolumeMapper.h:221
vtkAMRVolumeMapper
AMR class for a volume mapper.
Definition: vtkAMRVolumeMapper.h:40
vtkAMRVolumeMapper::Resampler
vtkAMRResampleFilter * Resampler
Definition: vtkAMRVolumeMapper.h:321
vtkX3D::mode
Definition: vtkX3D.h:247
vtkAMRVolumeMapper::SetRequestedRenderModeToRayCastAndTexture
void SetRequestedRenderModeToRayCastAndTexture()
Set the requested render mode to vtkAMRVolumeMapper::RayCastAndTextureRenderMode.
Definition: vtkAMRVolumeMapper.h:196
vtkAMRResampleFilter
Definition: vtkAMRResampleFilter.h:55