00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00031 #ifndef __vtkUnstructuredGridVolumeRayCastMapper_h
00032 #define __vtkUnstructuredGridVolumeRayCastMapper_h
00033
00034 #include "vtkUnstructuredGridVolumeMapper.h"
00035
00036 class vtkDoubleArray;
00037 class vtkIdList;
00038 class vtkMultiThreader;
00039 class vtkRayCastImageDisplayHelper;
00040 class vtkRenderer;
00041 class vtkTimerLog;
00042 class vtkUnstructuredGridVolumeRayCastFunction;
00043 class vtkUnstructuredGridVolumeRayCastIterator;
00044 class vtkUnstructuredGridVolumeRayIntegrator;
00045 class vtkVolume;
00046
00047 class VTK_VOLUMERENDERING_EXPORT vtkUnstructuredGridVolumeRayCastMapper : public vtkUnstructuredGridVolumeMapper
00048 {
00049 public:
00050 static vtkUnstructuredGridVolumeRayCastMapper *New();
00051 vtkTypeMacro(vtkUnstructuredGridVolumeRayCastMapper,vtkUnstructuredGridVolumeMapper);
00052 void PrintSelf( ostream& os, vtkIndent indent );
00053
00055
00058 vtkSetClampMacro( ImageSampleDistance, float, 0.1f, 100.0f );
00059 vtkGetMacro( ImageSampleDistance, float );
00061
00063
00065 vtkSetClampMacro( MinimumImageSampleDistance, float, 0.1f, 100.0f );
00066 vtkGetMacro( MinimumImageSampleDistance, float );
00068
00070
00072 vtkSetClampMacro( MaximumImageSampleDistance, float, 0.1f, 100.0f );
00073 vtkGetMacro( MaximumImageSampleDistance, float );
00075
00077
00080 vtkSetClampMacro( AutoAdjustSampleDistances, int, 0, 1 );
00081 vtkGetMacro( AutoAdjustSampleDistances, int );
00082 vtkBooleanMacro( AutoAdjustSampleDistances, int );
00084
00086
00088 vtkSetMacro( NumberOfThreads, int );
00089 vtkGetMacro( NumberOfThreads, int );
00091
00093
00095 vtkSetClampMacro( IntermixIntersectingGeometry, int, 0, 1 );
00096 vtkGetMacro( IntermixIntersectingGeometry, int );
00097 vtkBooleanMacro( IntermixIntersectingGeometry, int );
00099
00101
00102 virtual void SetRayCastFunction(vtkUnstructuredGridVolumeRayCastFunction *f);
00103 vtkGetObjectMacro(RayCastFunction, vtkUnstructuredGridVolumeRayCastFunction);
00105
00107
00109 virtual void SetRayIntegrator(vtkUnstructuredGridVolumeRayIntegrator *ri);
00110 vtkGetObjectMacro(RayIntegrator, vtkUnstructuredGridVolumeRayIntegrator);
00112
00113
00116 void Render( vtkRenderer *, vtkVolume * );
00117
00122 void ReleaseGraphicsResources(vtkWindow *);
00123
00124 vtkGetVectorMacro( ImageInUseSize, int, 2 );
00125 vtkGetVectorMacro( ImageOrigin, int, 2 );
00126 vtkGetVectorMacro( ImageViewportSize, int , 2 );
00127
00128
00129
00130 void CastRays( int threadID, int threadCount );
00131
00132 protected:
00133 vtkUnstructuredGridVolumeRayCastMapper();
00134 ~vtkUnstructuredGridVolumeRayCastMapper();
00135
00136 float ImageSampleDistance;
00137 float MinimumImageSampleDistance;
00138 float MaximumImageSampleDistance;
00139 int AutoAdjustSampleDistances;
00140
00141 vtkMultiThreader *Threader;
00142 int NumberOfThreads;
00143
00144 vtkRayCastImageDisplayHelper *ImageDisplayHelper;
00145
00146
00147 int ImageViewportSize[2];
00148
00149
00150
00151
00152
00153 int ImageMemorySize[2];
00154
00155
00156
00157
00158
00159 int ImageInUseSize[2];
00160
00161
00162
00163 int ImageOrigin[2];
00164
00165
00166 unsigned char *Image;
00167
00168 float *RenderTimeTable;
00169 vtkVolume **RenderVolumeTable;
00170 vtkRenderer **RenderRendererTable;
00171 int RenderTableSize;
00172 int RenderTableEntries;
00173
00174 void StoreRenderTime( vtkRenderer *ren, vtkVolume *vol, float t );
00175 float RetrieveRenderTime( vtkRenderer *ren, vtkVolume *vol );
00176
00177 int IntermixIntersectingGeometry;
00178
00179 float *ZBuffer;
00180 int ZBufferSize[2];
00181 int ZBufferOrigin[2];
00182
00183
00184
00185
00186 double GetZBufferValue( int x, int y );
00187
00188 double GetMinimumBoundsDepth( vtkRenderer *ren,
00189 vtkVolume *vol );
00190
00191 vtkUnstructuredGridVolumeRayCastFunction *RayCastFunction;
00192 vtkUnstructuredGridVolumeRayCastIterator **RayCastIterators;
00193 vtkUnstructuredGridVolumeRayIntegrator *RayIntegrator;
00194 vtkUnstructuredGridVolumeRayIntegrator *RealRayIntegrator;
00195
00196 vtkIdList **IntersectedCellsBuffer;
00197 vtkDoubleArray **IntersectionLengthsBuffer;
00198 vtkDataArray **NearIntersectionsBuffer;
00199 vtkDataArray **FarIntersectionsBuffer;
00200
00201 vtkVolume *CurrentVolume;
00202 vtkRenderer *CurrentRenderer;
00203
00204 vtkDataArray *Scalars;
00205 int CellScalars;
00206
00207 private:
00208 vtkUnstructuredGridVolumeRayCastMapper(const vtkUnstructuredGridVolumeRayCastMapper&);
00209 void operator=(const vtkUnstructuredGridVolumeRayCastMapper&);
00210 };
00211
00212 #endif
00213