VTK
vtkUnstructuredGridVolumeRayCastMapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkUnstructuredGridVolumeRayCastMapper.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 
26 #ifndef vtkUnstructuredGridVolumeRayCastMapper_h
27 #define vtkUnstructuredGridVolumeRayCastMapper_h
28 
29 #include "vtkRenderingVolumeModule.h" // For export macro
31 
32 class vtkDoubleArray;
33 class vtkIdList;
34 class vtkMultiThreader;
36 class vtkRenderer;
37 class vtkTimerLog;
41 class vtkVolume;
42 
44 {
45 public:
48  void PrintSelf( ostream& os, vtkIndent indent ) VTK_OVERRIDE;
49 
51 
56  vtkSetClampMacro( ImageSampleDistance, float, 0.1f, 100.0f );
57  vtkGetMacro( ImageSampleDistance, float );
59 
61 
65  vtkSetClampMacro( MinimumImageSampleDistance, float, 0.1f, 100.0f );
66  vtkGetMacro( MinimumImageSampleDistance, float );
68 
70 
74  vtkSetClampMacro( MaximumImageSampleDistance, float, 0.1f, 100.0f );
75  vtkGetMacro( MaximumImageSampleDistance, float );
77 
79 
85  vtkSetClampMacro( AutoAdjustSampleDistances, int, 0, 1 );
86  vtkGetMacro( AutoAdjustSampleDistances, int );
87  vtkBooleanMacro( AutoAdjustSampleDistances, int );
89 
91 
95  vtkSetMacro( NumberOfThreads, int );
96  vtkGetMacro( NumberOfThreads, int );
98 
100 
104  vtkSetClampMacro( IntermixIntersectingGeometry, int, 0, 1 );
105  vtkGetMacro( IntermixIntersectingGeometry, int );
106  vtkBooleanMacro( IntermixIntersectingGeometry, int );
108 
110 
113  virtual void SetRayCastFunction(vtkUnstructuredGridVolumeRayCastFunction *f);
114  vtkGetObjectMacro(RayCastFunction, vtkUnstructuredGridVolumeRayCastFunction);
116 
118 
122  virtual void SetRayIntegrator(vtkUnstructuredGridVolumeRayIntegrator *ri);
123  vtkGetObjectMacro(RayIntegrator, vtkUnstructuredGridVolumeRayIntegrator);
125 
130  void Render( vtkRenderer *, vtkVolume * ) VTK_OVERRIDE;
131 
138  void ReleaseGraphicsResources(vtkWindow *) VTK_OVERRIDE;
139 
140  vtkGetVectorMacro( ImageInUseSize, int, 2 );
141  vtkGetVectorMacro( ImageOrigin, int, 2 );
142  vtkGetVectorMacro( ImageViewportSize, int , 2 );
143 
144  void CastRays( int threadID, int threadCount );
145 
146 protected:
149 
150  float ImageSampleDistance;
151  float MinimumImageSampleDistance;
152  float MaximumImageSampleDistance;
153  int AutoAdjustSampleDistances;
154 
155  vtkMultiThreader *Threader;
156  int NumberOfThreads;
157 
158  vtkRayCastImageDisplayHelper *ImageDisplayHelper;
159 
160  // This is how big the image would be if it covered the entire viewport
161  int ImageViewportSize[2];
162 
163  // This is how big the allocated memory for image is. This may be bigger
164  // or smaller than ImageFullSize - it will be bigger if necessary to
165  // ensure a power of 2, it will be smaller if the volume only covers a
166  // small region of the viewport
167  int ImageMemorySize[2];
168 
169  // This is the size of subregion in ImageSize image that we are using for
170  // the current image. Since ImageSize is a power of 2, there is likely
171  // wasted space in it. This number will be used for things such as clearing
172  // the image if necessary.
173  int ImageInUseSize[2];
174 
175  // This is the location in ImageFullSize image where our ImageSize image
176  // is located.
177  int ImageOrigin[2];
178 
179  // This is the allocated image
180  unsigned char *Image;
181 
182  float *RenderTimeTable;
183  vtkVolume **RenderVolumeTable;
184  vtkRenderer **RenderRendererTable;
185  int RenderTableSize;
186  int RenderTableEntries;
187 
188  void StoreRenderTime( vtkRenderer *ren, vtkVolume *vol, float t );
189  float RetrieveRenderTime( vtkRenderer *ren, vtkVolume *vol );
190 
191  int IntermixIntersectingGeometry;
192 
193  float *ZBuffer;
194  int ZBufferSize[2];
195  int ZBufferOrigin[2];
196 
197  // Get the ZBuffer value corresponding to location (x,y) where (x,y)
198  // are indexing into the ImageInUse image. This must be converted to
199  // the zbuffer image coordinates. Nearest neighbor value is returned.
200  double GetZBufferValue( int x, int y );
201 
202  double GetMinimumBoundsDepth( vtkRenderer *ren,
203  vtkVolume *vol );
204 
209 
210  vtkIdList **IntersectedCellsBuffer;
211  vtkDoubleArray **IntersectionLengthsBuffer;
212  vtkDataArray **NearIntersectionsBuffer;
213  vtkDataArray **FarIntersectionsBuffer;
214 
215  vtkVolume *CurrentVolume;
216  vtkRenderer *CurrentRenderer;
217 
218  vtkDataArray *Scalars;
219  int CellScalars;
220 
221 private:
223  void operator=(const vtkUnstructuredGridVolumeRayCastMapper&) VTK_DELETE_FUNCTION;
224 };
225 
226 #endif
227 
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:44
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
A class for performing multithreaded execution.
A software mapper for unstructured volumes.
abstract specification for renderers
Definition: vtkRenderer.h:57
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...
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
helper class that draws the image to the screen
dynamic, self-adjusting array of double
a superclass for volume ray integration functions
Timer support and logging.
Definition: vtkTimerLog.h:85
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
a simple class to control print indentation
Definition: vtkIndent.h:33
Abstract class for a unstructured grid volume mapper.
list of point or cell ids
Definition: vtkIdList.h:30
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
vtkUnstructuredGridVolumeRayCastIterator is a superclass for iterating over the intersections of a vi...
static vtkAlgorithm * New()
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.