VTK
vtkVolumeRayCastMapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkVolumeRayCastMapper.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 =========================================================================*/
15 
33 #ifndef vtkVolumeRayCastMapper_h
34 #define vtkVolumeRayCastMapper_h
35 
36 #include "vtkRenderingVolumeModule.h" // For export macro
37 #include "vtkVolumeMapper.h"
38 #include "vtkVolumeRayCastFunction.h" // For vtkVolumeRayCastStaticInfo
39  // and vtkVolumeRayCastDynamicInfo
40 
43 class vtkMatrix4x4;
44 class vtkMultiThreader;
45 class vtkPlaneCollection;
46 class vtkRenderer;
47 class vtkTimerLog;
48 class vtkVolume;
49 class vtkVolumeTransform;
50 class vtkTransform;
52 
53 #if !defined(VTK_LEGACY_REMOVE)
55 
56 // Macro for tri-linear interpolation - do four linear interpolations on
57 // edges, two linear interpolations between pairs of edges, then a final
58 // interpolation between faces
59 #define vtkTrilinFuncMacro(v,x,y,z,a,b,c,d,e,f,g,h) \
60  t00 = a + (x)*(b-a); \
61  t01 = c + (x)*(d-c); \
62  t10 = e + (x)*(f-e); \
63  t11 = g + (x)*(h-g); \
64  t0 = t00 + (y)*(t01-t00); \
65  t1 = t10 + (y)*(t11-t10); \
66  v = t0 + (z)*(t1-t0);
67 
68 // Forward declaration needed for use by friend declaration below.
70 
71 class VTKRENDERINGVOLUME_EXPORT vtkVolumeRayCastMapper : public vtkVolumeMapper
72 {
73 public:
76  void PrintSelf( ostream& os, vtkIndent indent );
77 
79 
85  vtkSetMacro( SampleDistance, double );
86  vtkGetMacro( SampleDistance, double );
88 
90 
95  vtkGetObjectMacro( VolumeRayCastFunction, vtkVolumeRayCastFunction );
97 
99 
103  vtkGetObjectMacro( GradientEstimator, vtkEncodedGradientEstimator );
105 
107 
110  vtkGetObjectMacro( GradientShader, vtkEncodedGradientShader );
112 
114 
119  vtkSetClampMacro( ImageSampleDistance, double, 0.1, 100.0 );
120  vtkGetMacro( ImageSampleDistance, double );
122 
124 
128  vtkSetClampMacro( MinimumImageSampleDistance, double, 0.1, 100.0 );
129  vtkGetMacro( MinimumImageSampleDistance, double );
131 
133 
137  vtkSetClampMacro( MaximumImageSampleDistance, double, 0.1, 100.0 );
138  vtkGetMacro( MaximumImageSampleDistance, double );
140 
142 
148  vtkSetClampMacro( AutoAdjustSampleDistances, int, 0, 1 );
149  vtkGetMacro( AutoAdjustSampleDistances, int );
150  vtkBooleanMacro( AutoAdjustSampleDistances, int );
152 
154 
158  void SetNumberOfThreads( int num );
161 
163 
167  vtkSetClampMacro( IntermixIntersectingGeometry, int, 0, 1 );
168  vtkGetMacro( IntermixIntersectingGeometry, int );
169  vtkBooleanMacro( IntermixIntersectingGeometry, int );
171 
177 
185 
191 
193 
197  virtual float GetGradientMagnitudeScale();
198  virtual float GetGradientMagnitudeBias();
199  virtual float GetGradientMagnitudeScale(int)
200  {return this->GetGradientMagnitudeScale();};
201  virtual float GetGradientMagnitudeBias(int)
202  {return this->GetGradientMagnitudeBias();};
204 
205 protected:
208 
213 
215 
216  // The distance between sample points along the ray
222 
226 
228  vtkVolume *vol );
229 
232 
234 
236 
243 
245 
249 
250  // This is how big the image would be if it covered the entire viewport
251  int ImageViewportSize[2];
252 
253  // This is how big the allocated memory for image is. This may be bigger
254  // or smaller than ImageFullSize - it will be bigger if necessary to
255  // ensure a power of 2, it will be smaller if the volume only covers a
256  // small region of the viewport
257  int ImageMemorySize[2];
258 
259  // This is the size of subregion in ImageSize image that we are using for
260  // the current image. Since ImageSize is a power of 2, there is likely
261  // wasted space in it. This number will be used for things such as clearing
262  // the image if necessary.
263  int ImageInUseSize[2];
264 
265  // This is the location in ImageFullSize image where our ImageSize image
266  // is located.
267  int ImageOrigin[2];
268 
269  // This is the allocated image
270  unsigned char *Image;
271 
272  int *RowBounds;
274 
280 
281  void StoreRenderTime( vtkRenderer *ren, vtkVolume *vol, float t );
283 
285 
286  float *ZBuffer;
287  int ZBufferSize[2];
288  int ZBufferOrigin[2];
289 
291 
293  float bounds[6] );
294 
296  vtkPlaneCollection *planes );
297 
299  vtkVolumeRayCastStaticInfo *staticInfo);
300 
301  // Get the ZBuffer value corresponding to location (x,y) where (x,y)
302  // are indexing into the ImageInUse image. This must be converted to
303  // the zbuffer image coordinates. Nearest neighbor value is returned.
304  double GetZBufferValue( int x, int y );
305 
306 private:
307  vtkVolumeRayCastMapper(const vtkVolumeRayCastMapper&) VTK_DELETE_FUNCTION;
308  void operator=(const vtkVolumeRayCastMapper&) VTK_DELETE_FUNCTION;
309 };
310 #endif // VTK_LEGACY_REMOVE
311 #endif
312 
vtkVolumeRayCastFunction.h
vtkVolumeRayCastMapper::RetrieveRenderTime
float RetrieveRenderTime(vtkRenderer *ren, vtkVolume *vol)
vtkVolumeRayCastMapper::ImageDisplayHelper
vtkRayCastImageDisplayHelper * ImageDisplayHelper
Definition: vtkVolumeRayCastMapper.h:212
vtkVolumeMapper
Abstract class for a volume mapper.
Definition: vtkVolumeMapper.h:50
vtkVolumeRayCastMapper::OldRowBounds
int * OldRowBounds
Definition: vtkVolumeRayCastMapper.h:273
vtkVolumeRayCastMapper::RenderTableEntries
int RenderTableEntries
Definition: vtkVolumeRayCastMapper.h:279
vtkVolumeRayCastMapper::ScalarDataPointer
void * ScalarDataPointer
Definition: vtkVolumeRayCastMapper.h:225
vtkVolumeRayCastMapper::ComputeRowBounds
int ComputeRowBounds(vtkVolume *vol, vtkRenderer *ren)
vtkVolume
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:51
vtkVolumeRayCastFunction
a superclass for ray casting functions
Definition: vtkVolumeRayCastFunction.h:137
vtkVolumeRayCastMapper::Render
void Render(vtkRenderer *, vtkVolume *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Initialize rendering for this volume.
vtkRayCastImageDisplayHelper
helper class that draws the image to the screen
Definition: vtkRayCastImageDisplayHelper.h:40
vtkVolumeRayCastMapper::PerspectiveTransform
vtkTransform * PerspectiveTransform
Definition: vtkVolumeRayCastMapper.h:246
vtkX3D::data
@ data
Definition: vtkX3D.h:315
vtkVolumeRayCastMapper::WorldSampleDistance
double WorldSampleDistance
Definition: vtkVolumeRayCastMapper.h:223
vtkVolumeRayCastMapper::RenderTimeTable
float * RenderTimeTable
Definition: vtkVolumeRayCastMapper.h:275
vtkVolumeRayCastMapper::SetVolumeRayCastFunction
virtual void SetVolumeRayCastFunction(vtkVolumeRayCastFunction *)
Get / Set the volume ray cast function.
vtkVolumeRayCastMapper::RenderTableSize
int RenderTableSize
Definition: vtkVolumeRayCastMapper.h:278
vtkVolumeRayCastMapper::ReportReferences
void ReportReferences(vtkGarbageCollector *) override
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:61
vtkVolumeRayCastMapper::ClipRayAgainstVolume
int ClipRayAgainstVolume(vtkVolumeRayCastDynamicInfo *dynamicInfo, float bounds[6])
vtkAbstractVolumeMapper::GetGradientMagnitudeScale
virtual float GetGradientMagnitudeScale()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE.
Definition: vtkAbstractVolumeMapper.h:115
vtkVolumeRayCastMapper::MaximumImageSampleDistance
double MaximumImageSampleDistance
Definition: vtkVolumeRayCastMapper.h:220
vtkVolumeRayCastMapper::PerspectiveMatrix
vtkMatrix4x4 * PerspectiveMatrix
Definition: vtkVolumeRayCastMapper.h:237
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
vtkVolumeRayCastMapper::MinimumImageSampleDistance
double MinimumImageSampleDistance
Definition: vtkVolumeRayCastMapper.h:219
vtkVolumeRayCastMapper
A slow but accurate mapper for rendering volumes.
Definition: vtkVolumeRayCastMapper.h:72
vtkVolumeRayCastMapper::ImageSampleDistance
double ImageSampleDistance
Definition: vtkVolumeRayCastMapper.h:218
vtkVolumeRayCastMapper::IntermixIntersectingGeometry
int IntermixIntersectingGeometry
Definition: vtkVolumeRayCastMapper.h:284
vtkMultiThreader
A class for performing multithreaded execution.
Definition: vtkMultiThreader.h:97
vtkVolumeRayCastMapper::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkVolumeRayCastMapper::ClipRayAgainstClippingPlanes
int ClipRayAgainstClippingPlanes(vtkVolumeRayCastDynamicInfo *dynamicInfo, vtkVolumeRayCastStaticInfo *staticInfo)
vtkVolumeRayCastMapper::AutoAdjustSampleDistances
int AutoAdjustSampleDistances
Definition: vtkVolumeRayCastMapper.h:221
vtkEncodedGradientShader
Compute shading tables for encoded normals.
Definition: vtkEncodedGradientShader.h:46
vtkEncodedGradientEstimator
Superclass for gradient estimation.
Definition: vtkEncodedGradientEstimator.h:45
vtkVolumeRayCastMapper::Image
unsigned char * Image
Definition: vtkVolumeRayCastMapper.h:270
vtkVolumeRayCastMapper::GetGradientMagnitudeScale
virtual float GetGradientMagnitudeScale()
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Values needed by the volume.
vtkVolumeRayCastMapper::StoreRenderTime
void StoreRenderTime(vtkRenderer *ren, vtkVolume *vol, float t)
vtkVolumeMapper.h
vtkVolumeRayCastMapper::VoxelsTransform
vtkTransform * VoxelsTransform
Definition: vtkVolumeRayCastMapper.h:247
vtkVolumeRayCastMapper::VoxelsToViewMatrix
vtkMatrix4x4 * VoxelsToViewMatrix
Definition: vtkVolumeRayCastMapper.h:240
vtkVolumeRayCastMapper::ViewToWorldMatrix
vtkMatrix4x4 * ViewToWorldMatrix
Definition: vtkVolumeRayCastMapper.h:238
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:42
vtkVolumeRayCastMapper::vtkVolumeRayCastMapper
vtkVolumeRayCastMapper()
vtkVolumeRayCastMapper::VolumeRayCastFunction
vtkVolumeRayCastFunction * VolumeRayCastFunction
Definition: vtkVolumeRayCastMapper.h:209
vtkVolumeRayCastMapper::ViewToVoxelsMatrix
vtkMatrix4x4 * ViewToVoxelsMatrix
Definition: vtkVolumeRayCastMapper.h:239
vtkVolumeRayCastMapper::GradientEstimator
vtkEncodedGradientEstimator * GradientEstimator
Definition: vtkVolumeRayCastMapper.h:210
vtkVolumeRayCastMapper::RenderRendererTable
vtkRenderer ** RenderRendererTable
Definition: vtkVolumeRayCastMapper.h:277
vtkGarbageCollector
Detect and break reference loops.
Definition: vtkGarbageCollector.h:100
VTK_THREAD_RETURN_TYPE
#define VTK_THREAD_RETURN_TYPE
Definition: vtkSystemIncludes.h:136
vtkVolumeRayCastMapper::GetGradientMagnitudeScale
virtual float GetGradientMagnitudeScale(int)
Definition: vtkVolumeRayCastMapper.h:199
vtkVolumeRayCastMapper::GetGradientMagnitudeBias
virtual float GetGradientMagnitudeBias()
vtkVolumeRayCastDynamicInfo
Definition: vtkVolumeRayCastFunction.h:47
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkVolumeRayCastMapper::VoxelsToViewTransform
vtkTransform * VoxelsToViewTransform
Definition: vtkVolumeRayCastMapper.h:248
vtkVolumeRayCastMapper::RenderVolumeTable
vtkVolume ** RenderVolumeTable
Definition: vtkVolumeRayCastMapper.h:276
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkVolumeRayCastMapper::UpdateShadingTables
void UpdateShadingTables(vtkRenderer *ren, vtkVolume *vol)
vtkVolumeRayCastMapper::GradientShader
vtkEncodedGradientShader * GradientShader
Definition: vtkVolumeRayCastMapper.h:211
vtkTimerLog
Timer support and logging.
Definition: vtkTimerLog.h:81
VolumeRayCastMapper_CastRays
VTK_THREAD_RETURN_TYPE VolumeRayCastMapper_CastRays(void *arg)
vtkVolumeRayCastMapper::New
static vtkVolumeRayCastMapper * New()
vtkVolumeRayCastMapper::GetZeroOpacityThreshold
float GetZeroOpacityThreshold(vtkVolume *vol)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Return the scalar value below which all opaci...
vtkVolumeRayCastMapper::VolumeRayCastMapper_CastRays
friend VTK_THREAD_RETURN_TYPE VolumeRayCastMapper_CastRays(void *arg)
vtkVolumeRayCastMapper::InitializeClippingPlanes
void InitializeClippingPlanes(vtkVolumeRayCastStaticInfo *staticInfo, vtkPlaneCollection *planes)
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:64
vtkVolumeRayCastMapper::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
vtkVolumeRayCastMapper::SetNumberOfThreads
void SetNumberOfThreads(int num)
Set/Get the number of threads to use.
vtkVolumeRayCastMapper::GetNumberOfThreads
int GetNumberOfThreads()
vtkVolumeRayCastMapper::SampleDistance
double SampleDistance
Definition: vtkVolumeRayCastMapper.h:217
vtkVolumeRayCastMapper::MinimumViewDistance
float MinimumViewDistance
Definition: vtkVolumeRayCastMapper.h:290
vtkVolumeRayCastMapper::SetGradientEstimator
virtual void SetGradientEstimator(vtkEncodedGradientEstimator *gradest)
Set / Get the gradient estimator used to estimate normals.
vtkPlaneCollection
maintain a list of planes
Definition: vtkPlaneCollection.h:37
vtkVolumeRayCastMapper::ComputeMatrices
void ComputeMatrices(vtkImageData *data, vtkVolume *vol)
vtkVolumeRayCastMapper::ZBuffer
float * ZBuffer
Definition: vtkVolumeRayCastMapper.h:286
vtkVolumeRayCastMapper::~vtkVolumeRayCastMapper
~vtkVolumeRayCastMapper()
vtkVolumeRayCastMapper::GetZBufferValue
double GetZBufferValue(int x, int y)
vtkVolumeRayCastMapper::RowBounds
int * RowBounds
Definition: vtkVolumeRayCastMapper.h:272
vtkVolumeRayCastMapper::VolumeMatrix
vtkMatrix4x4 * VolumeMatrix
Definition: vtkVolumeRayCastMapper.h:244
vtkVolumeRayCastMapper::GetGradientMagnitudeBias
virtual float GetGradientMagnitudeBias(int)
Definition: vtkVolumeRayCastMapper.h:201
vtkAbstractVolumeMapper::GetGradientMagnitudeBias
virtual float GetGradientMagnitudeBias()
Definition: vtkAbstractVolumeMapper.h:116
vtkVolumeRayCastStaticInfo
Definition: vtkVolumeRayCastFunction.h:71
vtkVolumeRayCastMapper::VoxelsToWorldMatrix
vtkMatrix4x4 * VoxelsToWorldMatrix
Definition: vtkVolumeRayCastMapper.h:242
vtkVolumeRayCastMapper::WorldToVoxelsMatrix
vtkMatrix4x4 * WorldToVoxelsMatrix
Definition: vtkVolumeRayCastMapper.h:241
vtkVolumeRayCastMapper::Threader
vtkMultiThreader * Threader
Definition: vtkVolumeRayCastMapper.h:235
vtkVolumeRayCastMapper::ScalarDataType
int ScalarDataType
Definition: vtkVolumeRayCastMapper.h:224