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 
31 #ifndef vtkVolumeRayCastMapper_h
32 #define vtkVolumeRayCastMapper_h
33 
34 #include "vtkRenderingVolumeModule.h" // For export macro
35 #include "vtkVolumeMapper.h"
36 #include "vtkVolumeRayCastFunction.h" // For vtkVolumeRayCastStaticInfo
37  // and vtkVolumeRayCastDynamicInfo
38 
41 class vtkMatrix4x4;
42 class vtkMultiThreader;
43 class vtkPlaneCollection;
44 class vtkRenderer;
45 class vtkTimerLog;
46 class vtkVolume;
48 class vtkVolumeTransform;
49 class vtkTransform;
51 
52 // Macro for tri-linear interpolation - do four linear interpolations on
53 // edges, two linear interpolations between pairs of edges, then a final
54 // interpolation between faces
55 #define vtkTrilinFuncMacro(v,x,y,z,a,b,c,d,e,f,g,h) \
56  t00 = a + (x)*(b-a); \
57  t01 = c + (x)*(d-c); \
58  t10 = e + (x)*(f-e); \
59  t11 = g + (x)*(h-g); \
60  t0 = t00 + (y)*(t01-t00); \
61  t1 = t10 + (y)*(t11-t10); \
62  v = t0 + (z)*(t1-t0);
63 
64 // Forward declaration needed for use by friend declaration below.
66 
68 {
69 public:
72  void PrintSelf( ostream& os, vtkIndent indent );
73 
75 
78  vtkSetMacro( SampleDistance, double );
79  vtkGetMacro( SampleDistance, double );
81 
83 
86  vtkGetObjectMacro( VolumeRayCastFunction, vtkVolumeRayCastFunction );
88 
90 
94 
96 
99 
101 
104  vtkSetClampMacro( ImageSampleDistance, double, 0.1, 100.0 );
105  vtkGetMacro( ImageSampleDistance, double );
107 
109 
111  vtkSetClampMacro( MinimumImageSampleDistance, double, 0.1, 100.0 );
112  vtkGetMacro( MinimumImageSampleDistance, double );
114 
116 
118  vtkSetClampMacro( MaximumImageSampleDistance, double, 0.1, 100.0 );
119  vtkGetMacro( MaximumImageSampleDistance, double );
121 
123 
126  vtkSetClampMacro( AutoAdjustSampleDistances, int, 0, 1 );
127  vtkGetMacro( AutoAdjustSampleDistances, int );
128  vtkBooleanMacro( AutoAdjustSampleDistances, int );
130 
132 
134  void SetNumberOfThreads( int num );
137 
139 
141  vtkSetClampMacro( IntermixIntersectingGeometry, int, 0, 1 );
142  vtkGetMacro( IntermixIntersectingGeometry, int );
143  vtkBooleanMacro( IntermixIntersectingGeometry, int );
145 
146 //BTX
150 
156 
160 
162 
164  virtual float GetGradientMagnitudeScale();
165  virtual float GetGradientMagnitudeBias();
166  virtual float GetGradientMagnitudeScale(int)
167  {return this->GetGradientMagnitudeScale();};
168  virtual float GetGradientMagnitudeBias(int)
169  {return this->GetGradientMagnitudeBias();};
171 
172 //ETX
173 
174 protected:
177 
182 
184 
185  // The distance between sample points along the ray
191 
195 
197  vtkVolume *vol );
198 
201 
203 
205 
212 
214 
218 
219  // This is how big the image would be if it covered the entire viewport
220  int ImageViewportSize[2];
221 
222  // This is how big the allocated memory for image is. This may be bigger
223  // or smaller than ImageFullSize - it will be bigger if necessary to
224  // ensure a power of 2, it will be smaller if the volume only covers a
225  // small region of the viewport
226  int ImageMemorySize[2];
227 
228  // This is the size of subregion in ImageSize image that we are using for
229  // the current image. Since ImageSize is a power of 2, there is likely
230  // wasted space in it. This number will be used for things such as clearing
231  // the image if necessary.
232  int ImageInUseSize[2];
233 
234  // This is the location in ImageFullSize image where our ImageSize image
235  // is located.
236  int ImageOrigin[2];
237 
238  // This is the allocated image
239  unsigned char *Image;
240 
241  int *RowBounds;
243 
249 
250  void StoreRenderTime( vtkRenderer *ren, vtkVolume *vol, float t );
252 
254 
255  float *ZBuffer;
256  int ZBufferSize[2];
257  int ZBufferOrigin[2];
258 
260 
262  float bounds[6] );
263 
265  vtkPlaneCollection *planes );
266 
268  vtkVolumeRayCastStaticInfo *staticInfo);
269 
270  // Get the ZBuffer value corresponding to location (x,y) where (x,y)
271  // are indexing into the ImageInUse image. This must be converted to
272  // the zbuffer image coordinates. Nearest neighbor value is returned.
273  double GetZBufferValue( int x, int y );
274 
275 private:
276  vtkVolumeRayCastMapper(const vtkVolumeRayCastMapper&); // Not implemented.
277  void operator=(const vtkVolumeRayCastMapper&); // Not implemented.
278 };
279 
280 #endif
281 
vtkVolumeRayCastFunction.h
vtkVolumeRayCastMapper::RetrieveRenderTime
float RetrieveRenderTime(vtkRenderer *ren, vtkVolume *vol)
vtkVolumeRayCastMapper::ImageDisplayHelper
vtkRayCastImageDisplayHelper * ImageDisplayHelper
Definition: vtkVolumeRayCastMapper.h:181
vtkVolumeMapper
Abstract class for a volume mapper.
Definition: vtkVolumeMapper.h:46
vtkgl::data
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: vtkgl.h:11339
vtkGetObjectMacro
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:232
vtkVolumeRayCastMapper::OldRowBounds
int * OldRowBounds
Definition: vtkVolumeRayCastMapper.h:242
vtkVolumeRayCastMapper::RenderTableEntries
int RenderTableEntries
Definition: vtkVolumeRayCastMapper.h:248
vtkVolumeRayCastMapper::ScalarDataPointer
void * ScalarDataPointer
Definition: vtkVolumeRayCastMapper.h:194
vtkVolumeRayCastMapper::ComputeRowBounds
int ComputeRowBounds(vtkVolume *vol, vtkRenderer *ren)
vtkVolume
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:50
vtkVolumeRayCastFunction
a superclass for ray casting functions
Definition: vtkVolumeRayCastFunction.h:134
vtkVolumeRayCastMapper::Render
void Render(vtkRenderer *, vtkVolume *)
vtkRayCastImageDisplayHelper
helper class that draws the image to the screen
Definition: vtkRayCastImageDisplayHelper.h:39
vtkVolumeRayCastMapper::PerspectiveTransform
vtkTransform * PerspectiveTransform
Definition: vtkVolumeRayCastMapper.h:215
vtkVolumeRayCastMapper::WorldSampleDistance
double WorldSampleDistance
Definition: vtkVolumeRayCastMapper.h:192
vtkVolumeRayCastMapper::RenderTimeTable
float * RenderTimeTable
Definition: vtkVolumeRayCastMapper.h:244
vtkRenderingVolumeModule.h
vtkVolumeRayCastMapper::SetVolumeRayCastFunction
virtual void SetVolumeRayCastFunction(vtkVolumeRayCastFunction *)
vtkVolumeRayCastMapper::RenderTableSize
int RenderTableSize
Definition: vtkVolumeRayCastMapper.h:247
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkgl::x
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
vtkVolumeRayCastMapper::ClipRayAgainstVolume
int ClipRayAgainstVolume(vtkVolumeRayCastDynamicInfo *dynamicInfo, float bounds[6])
vtkAbstractVolumeMapper::GetGradientMagnitudeScale
virtual float GetGradientMagnitudeScale()
Definition: vtkAbstractVolumeMapper.h:103
vtkVolumeRayCastMapper::MaximumImageSampleDistance
double MaximumImageSampleDistance
Definition: vtkVolumeRayCastMapper.h:189
vtkVolumeRayCastMapper::PerspectiveMatrix
vtkMatrix4x4 * PerspectiveMatrix
Definition: vtkVolumeRayCastMapper.h:206
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkVolumeRayCastMapper::MinimumImageSampleDistance
double MinimumImageSampleDistance
Definition: vtkVolumeRayCastMapper.h:188
vtkVolumeRayCastMapper
A slow but accurate mapper for rendering volumes.
Definition: vtkVolumeRayCastMapper.h:68
vtkVolumeRayCastMapper::ImageSampleDistance
double ImageSampleDistance
Definition: vtkVolumeRayCastMapper.h:187
vtkVolumeRayCastMapper::IntermixIntersectingGeometry
int IntermixIntersectingGeometry
Definition: vtkVolumeRayCastMapper.h:253
vtkMultiThreader
A class for performing multithreaded execution.
Definition: vtkMultiThreader.h:94
vtkVolumeRayCastMapper::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkSetClampMacro
#define vtkSetClampMacro(name, type, min, max)
Definition: vtkSetGet.h:143
vtkVolumeRayCastMapper::ClipRayAgainstClippingPlanes
int ClipRayAgainstClippingPlanes(vtkVolumeRayCastDynamicInfo *dynamicInfo, vtkVolumeRayCastStaticInfo *staticInfo)
vtkVolumeRayCastMapper::AutoAdjustSampleDistances
int AutoAdjustSampleDistances
Definition: vtkVolumeRayCastMapper.h:190
vtkEncodedGradientShader
Compute shading tables for encoded normals.
Definition: vtkEncodedGradientShader.h:45
vtkEncodedGradientEstimator
Superclass for gradient estimation.
Definition: vtkEncodedGradientEstimator.h:44
vtkVolumeRayCastMapper::Image
unsigned char * Image
Definition: vtkVolumeRayCastMapper.h:239
vtkVolumeRayCastMapper::GetGradientMagnitudeScale
virtual float GetGradientMagnitudeScale()
vtkVolumeRayCastMapper::StoreRenderTime
void StoreRenderTime(vtkRenderer *ren, vtkVolume *vol, float t)
vtkVolumeMapper.h
vtkVolumeRayCastMapper::VoxelsTransform
vtkTransform * VoxelsTransform
Definition: vtkVolumeRayCastMapper.h:216
vtkVolumeRayCastMapper::VoxelsToViewMatrix
vtkMatrix4x4 * VoxelsToViewMatrix
Definition: vtkVolumeRayCastMapper.h:209
vtkgl::num
GLuint GLuint num
Definition: vtkgl.h:16907
vtkVolumeRayCastMapper::ViewToWorldMatrix
vtkMatrix4x4 * ViewToWorldMatrix
Definition: vtkVolumeRayCastMapper.h:207
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:39
vtkVolumeRayCastMapper::vtkVolumeRayCastMapper
vtkVolumeRayCastMapper()
vtkVolumeRayCastMapper::VolumeRayCastFunction
vtkVolumeRayCastFunction * VolumeRayCastFunction
Definition: vtkVolumeRayCastMapper.h:178
vtkVolumeRayCastMapper::ViewToVoxelsMatrix
vtkMatrix4x4 * ViewToVoxelsMatrix
Definition: vtkVolumeRayCastMapper.h:208
vtkVolumeRayCastMapper::ReportReferences
virtual void ReportReferences(vtkGarbageCollector *)
vtkVolumeRayCastMapper::GradientEstimator
vtkEncodedGradientEstimator * GradientEstimator
Definition: vtkVolumeRayCastMapper.h:179
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkVolumeRayCastMapper::RenderRendererTable
vtkRenderer ** RenderRendererTable
Definition: vtkVolumeRayCastMapper.h:246
vtkGarbageCollector
Detect and break reference loops.
Definition: vtkGarbageCollector.h:99
VTK_THREAD_RETURN_TYPE
#define VTK_THREAD_RETURN_TYPE
Definition: vtkSystemIncludes.h:132
vtkVolumeRayCastMapper::GetGradientMagnitudeScale
virtual float GetGradientMagnitudeScale(int)
Definition: vtkVolumeRayCastMapper.h:166
vtkVolumeRayCastMapper::GetGradientMagnitudeBias
virtual float GetGradientMagnitudeBias()
vtkVolumeRayCastDynamicInfo
Definition: vtkVolumeRayCastFunction.h:44
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
vtkVolumeRayCastMapper::VoxelsToViewTransform
vtkTransform * VoxelsToViewTransform
Definition: vtkVolumeRayCastMapper.h:217
vtkVolumeRayCastMapper::RenderVolumeTable
vtkVolume ** RenderVolumeTable
Definition: vtkVolumeRayCastMapper.h:245
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkVolumeRayCastMapper::UpdateShadingTables
void UpdateShadingTables(vtkRenderer *ren, vtkVolume *vol)
vtkVolumeRayCastMapper::GradientShader
vtkEncodedGradientShader * GradientShader
Definition: vtkVolumeRayCastMapper.h:180
vtkTimerLog
Timer support and logging.
Definition: vtkTimerLog.h:82
vtkgl::t
GLdouble GLdouble t
Definition: vtkgl.h:11602
VolumeRayCastMapper_CastRays
VTK_THREAD_RETURN_TYPE VolumeRayCastMapper_CastRays(void *arg)
vtkgl::y
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
vtkVolumeRayCastMapper::New
static vtkVolumeRayCastMapper * New()
vtkVolumeRayCastMapper::GetZeroOpacityThreshold
float GetZeroOpacityThreshold(vtkVolume *vol)
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 *)
vtkVolumeRayCastMapper::SetNumberOfThreads
void SetNumberOfThreads(int num)
vtkVolumeRayCastMapper::GetNumberOfThreads
int GetNumberOfThreads()
vtkVolumeRayCastMapper::SampleDistance
double SampleDistance
Definition: vtkVolumeRayCastMapper.h:186
vtkVolumeRayCastMapper::MinimumViewDistance
float MinimumViewDistance
Definition: vtkVolumeRayCastMapper.h:259
VTKRENDERINGVOLUME_EXPORT
#define VTKRENDERINGVOLUME_EXPORT
Definition: vtkRenderingVolumeModule.h:15
vtkVolumeRayCastMapper::SetGradientEstimator
virtual void SetGradientEstimator(vtkEncodedGradientEstimator *gradest)
vtkPlaneCollection
maintain a list of planes
Definition: vtkPlaneCollection.h:36
vtkVolumeRayCastMapper::ComputeMatrices
void ComputeMatrices(vtkImageData *data, vtkVolume *vol)
vtkVolumeRayCastMapper::ZBuffer
float * ZBuffer
Definition: vtkVolumeRayCastMapper.h:255
vtkVolumeRayCastMapper::~vtkVolumeRayCastMapper
~vtkVolumeRayCastMapper()
vtkVolumeRayCastMapper::GetZBufferValue
double GetZBufferValue(int x, int y)
vtkVolumeRayCastMapper::RowBounds
int * RowBounds
Definition: vtkVolumeRayCastMapper.h:241
vtkVolumeRayCastMapper::VolumeMatrix
vtkMatrix4x4 * VolumeMatrix
Definition: vtkVolumeRayCastMapper.h:213
vtkVolumeRayCastMapper::GetGradientMagnitudeBias
virtual float GetGradientMagnitudeBias(int)
Definition: vtkVolumeRayCastMapper.h:168
vtkAbstractVolumeMapper::GetGradientMagnitudeBias
virtual float GetGradientMagnitudeBias()
Definition: vtkAbstractVolumeMapper.h:104
vtkVolumeRayCastStaticInfo
Definition: vtkVolumeRayCastFunction.h:68
vtkVolumeRayCastMapper::VoxelsToWorldMatrix
vtkMatrix4x4 * VoxelsToWorldMatrix
Definition: vtkVolumeRayCastMapper.h:211
vtkVolumeRayCastMapper::WorldToVoxelsMatrix
vtkMatrix4x4 * WorldToVoxelsMatrix
Definition: vtkVolumeRayCastMapper.h:210
vtkVolumeRayCastMapper::Threader
vtkMultiThreader * Threader
Definition: vtkVolumeRayCastMapper.h:204
vtkVolumeRayCastMapper::ScalarDataType
int ScalarDataType
Definition: vtkVolumeRayCastMapper.h:193