VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkUnstructuredGridVolumeRayCastMapper.h,v $ 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 00028 #ifndef __vtkUnstructuredGridVolumeRayCastMapper_h 00029 #define __vtkUnstructuredGridVolumeRayCastMapper_h 00030 00031 #include "vtkUnstructuredGridVolumeMapper.h" 00032 00033 class vtkDoubleArray; 00034 class vtkIdList; 00035 class vtkMultiThreader; 00036 class vtkRayCastImageDisplayHelper; 00037 class vtkRenderer; 00038 class vtkTimerLog; 00039 class vtkUnstructuredGridVolumeRayCastFunction; 00040 class vtkUnstructuredGridVolumeRayCastIterator; 00041 class vtkUnstructuredGridVolumeRayIntegrator; 00042 class vtkVolume; 00043 00044 class VTK_VOLUMERENDERING_EXPORT vtkUnstructuredGridVolumeRayCastMapper : public vtkUnstructuredGridVolumeMapper 00045 { 00046 public: 00047 static vtkUnstructuredGridVolumeRayCastMapper *New(); 00048 vtkTypeRevisionMacro(vtkUnstructuredGridVolumeRayCastMapper,vtkUnstructuredGridVolumeMapper); 00049 void PrintSelf( ostream& os, vtkIndent indent ); 00050 00052 00055 vtkSetClampMacro( ImageSampleDistance, float, 0.1f, 100.0f ); 00056 vtkGetMacro( ImageSampleDistance, float ); 00058 00060 00062 vtkSetClampMacro( MinimumImageSampleDistance, float, 0.1f, 100.0f ); 00063 vtkGetMacro( MinimumImageSampleDistance, float ); 00065 00067 00069 vtkSetClampMacro( MaximumImageSampleDistance, float, 0.1f, 100.0f ); 00070 vtkGetMacro( MaximumImageSampleDistance, float ); 00072 00074 00077 vtkSetClampMacro( AutoAdjustSampleDistances, int, 0, 1 ); 00078 vtkGetMacro( AutoAdjustSampleDistances, int ); 00079 vtkBooleanMacro( AutoAdjustSampleDistances, int ); 00081 00083 00085 vtkSetMacro( NumberOfThreads, int ); 00086 vtkGetMacro( NumberOfThreads, int ); 00088 00090 00092 vtkSetClampMacro( IntermixIntersectingGeometry, int, 0, 1 ); 00093 vtkGetMacro( IntermixIntersectingGeometry, int ); 00094 vtkBooleanMacro( IntermixIntersectingGeometry, int ); 00096 00098 00099 virtual void SetRayCastFunction(vtkUnstructuredGridVolumeRayCastFunction *f); 00100 vtkGetObjectMacro(RayCastFunction, vtkUnstructuredGridVolumeRayCastFunction); 00102 00104 00106 virtual void SetRayIntegrator(vtkUnstructuredGridVolumeRayIntegrator *ri); 00107 vtkGetObjectMacro(RayIntegrator, vtkUnstructuredGridVolumeRayIntegrator); 00109 00110 //BTX 00113 void Render( vtkRenderer *, vtkVolume * ); 00114 00119 void ReleaseGraphicsResources(vtkWindow *); 00120 00121 vtkGetVectorMacro( ImageInUseSize, int, 2 ); 00122 vtkGetVectorMacro( ImageOrigin, int, 2 ); 00123 vtkGetVectorMacro( ImageViewportSize, int , 2 ); 00124 00125 //ETX 00126 00127 void CastRays( int threadID, int threadCount ); 00128 00129 protected: 00130 vtkUnstructuredGridVolumeRayCastMapper(); 00131 ~vtkUnstructuredGridVolumeRayCastMapper(); 00132 00133 float ImageSampleDistance; 00134 float MinimumImageSampleDistance; 00135 float MaximumImageSampleDistance; 00136 int AutoAdjustSampleDistances; 00137 00138 vtkMultiThreader *Threader; 00139 int NumberOfThreads; 00140 00141 vtkRayCastImageDisplayHelper *ImageDisplayHelper; 00142 00143 // This is how big the image would be if it covered the entire viewport 00144 int ImageViewportSize[2]; 00145 00146 // This is how big the allocated memory for image is. This may be bigger 00147 // or smaller than ImageFullSize - it will be bigger if necessary to 00148 // ensure a power of 2, it will be smaller if the volume only covers a 00149 // small region of the viewport 00150 int ImageMemorySize[2]; 00151 00152 // This is the size of subregion in ImageSize image that we are using for 00153 // the current image. Since ImageSize is a power of 2, there is likely 00154 // wasted space in it. This number will be used for things such as clearing 00155 // the image if necessary. 00156 int ImageInUseSize[2]; 00157 00158 // This is the location in ImageFullSize image where our ImageSize image 00159 // is located. 00160 int ImageOrigin[2]; 00161 00162 // This is the allocated image 00163 unsigned char *Image; 00164 00165 float *RenderTimeTable; 00166 vtkVolume **RenderVolumeTable; 00167 vtkRenderer **RenderRendererTable; 00168 int RenderTableSize; 00169 int RenderTableEntries; 00170 00171 void StoreRenderTime( vtkRenderer *ren, vtkVolume *vol, float t ); 00172 float RetrieveRenderTime( vtkRenderer *ren, vtkVolume *vol ); 00173 00174 int IntermixIntersectingGeometry; 00175 00176 float *ZBuffer; 00177 int ZBufferSize[2]; 00178 int ZBufferOrigin[2]; 00179 00180 // Get the ZBuffer value corresponding to location (x,y) where (x,y) 00181 // are indexing into the ImageInUse image. This must be converted to 00182 // the zbuffer image coordinates. Nearest neighbor value is returned. 00183 double GetZBufferValue( int x, int y ); 00184 00185 double GetMinimumBoundsDepth( vtkRenderer *ren, 00186 vtkVolume *vol ); 00187 00188 vtkUnstructuredGridVolumeRayCastFunction *RayCastFunction; 00189 vtkUnstructuredGridVolumeRayCastIterator **RayCastIterators; 00190 vtkUnstructuredGridVolumeRayIntegrator *RayIntegrator; 00191 vtkUnstructuredGridVolumeRayIntegrator *RealRayIntegrator; 00192 00193 vtkIdList **IntersectedCellsBuffer; 00194 vtkDoubleArray **IntersectionLengthsBuffer; 00195 vtkDataArray **NearIntersectionsBuffer; 00196 vtkDataArray **FarIntersectionsBuffer; 00197 00198 vtkVolume *CurrentVolume; 00199 vtkRenderer *CurrentRenderer; 00200 00201 vtkDataArray *Scalars; 00202 int CellScalars; 00203 00204 private: 00205 vtkUnstructuredGridVolumeRayCastMapper(const vtkUnstructuredGridVolumeRayCastMapper&); // Not implemented. 00206 void operator=(const vtkUnstructuredGridVolumeRayCastMapper&); // Not implemented. 00207 }; 00208 00209 #endif 00210