Rendering/vtkUnstructuredGridBunykRayCastFunction.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00063 #ifndef __vtkUnstructuredGridBunykRayCastFunction_h
00064 #define __vtkUnstructuredGridBunykRayCastFunction_h
00065
00066 #include "vtkUnstructuredGridVolumeRayCastFunction.h"
00067
00068 class vtkRenderer;
00069 class vtkVolume;
00070 class vtkUnstructuredGridVolumeRayCastMapper;
00071 class vtkMatrix4x4;
00072 class vtkPiecewiseFunction;
00073 class vtkColorTransferFunction;
00074 class vtkUnstructuredGrid;
00075
00076
00077
00078
00079 #define VTK_BUNYKRCF_MAX_ARRAYS 1000
00080 #define VTK_BUNYKRCF_ARRAY_SIZE 10000
00081
00082 class VTK_RENDERING_EXPORT vtkUnstructuredGridBunykRayCastFunction : public vtkUnstructuredGridVolumeRayCastFunction
00083 {
00084 public:
00085 static vtkUnstructuredGridBunykRayCastFunction *New();
00086 vtkTypeRevisionMacro(vtkUnstructuredGridBunykRayCastFunction,vtkUnstructuredGridVolumeRayCastFunction);
00087 virtual void PrintSelf(ostream& os, vtkIndent indent);
00088
00089
00091 virtual void Initialize( vtkRenderer *ren, vtkVolume *vol );
00092
00094 virtual void Finalize();
00095
00097 virtual void CastRay( int x, int y, double bounds[2], float color[4] );
00098
00099
00100
00101 class Triangle {
00102 public:
00103 int PointIndex[3];
00104 int ReferredByTetra[2];
00105 double P1X, P1Y;
00106 double P2X, P2Y;
00107 double Denominator;
00108 double A, B, C, D;
00109 Triangle *Next;
00110 };
00111
00112
00113
00114 class Intersection {
00115 public:
00116 Triangle *TriPtr;
00117 double Z;
00118 Intersection *Next;
00119 };
00120
00122
00124 int InTriangle( double x, double y,
00125 Triangle *triPtr );
00127
00128
00130 double *GetPoints() {return this->Points;}
00131
00133
00134 vtkGetObjectMacro( ViewToWorldMatrix, vtkMatrix4x4 );
00136
00138
00139 vtkGetVectorMacro( ImageOrigin, int, 2 );
00141
00143
00144 vtkGetVectorMacro( ImageViewportSize, int, 2 );
00146
00148 Triangle **GetTetraTriangles () {return this->TetraTriangles;}
00149
00151 Intersection *GetIntersectionList( int x, int y ) { return this->Image[y*this->ImageSize[0] + x]; }
00152
00153 double **GetColorTable() {return this->ColorTable;}
00154 double *GetColorTableShift() {return this->ColorTableShift;}
00155 double *GetColorTableScale() {return this->ColorTableScale;}
00156
00157
00158
00159 protected:
00160 vtkUnstructuredGridBunykRayCastFunction();
00161 ~vtkUnstructuredGridBunykRayCastFunction();
00162
00163
00164
00165 vtkRenderer *Renderer;
00166 vtkVolume *Volume;
00167 vtkUnstructuredGridVolumeRayCastMapper *Mapper;
00168 void *Scalars;
00169 int ScalarType;
00170 int NumberOfComponents;
00171
00172
00173
00174
00175 int Valid;
00176
00177
00178 int NumberOfPoints;
00179 double *Points;
00180
00181
00182
00183 vtkMatrix4x4 *ViewToWorldMatrix;
00184
00185
00186
00187 Intersection **Image;
00188
00189
00190
00191 int ImageSize[2];
00192
00193
00194
00195
00196
00197
00198 int ImageOrigin[2];
00199
00200
00201 int ImageViewportSize[2];
00202
00203
00204
00205 double **ColorTable;
00206 int *ColorTableSize;
00207
00208
00209
00210
00211 double *ColorTableShift;
00212 double *ColorTableScale;
00213
00214
00215
00216
00217
00218 vtkColorTransferFunction **SavedRGBFunction;
00219 vtkPiecewiseFunction **SavedGrayFunction;
00220 vtkPiecewiseFunction **SavedScalarOpacityFunction;
00221 int *SavedColorChannels;
00222 double *SavedScalarOpacityDistance;
00223 double SavedSampleDistance;
00224 int SavedBlendMode;
00225 int SavedNumberOfComponents;
00226 vtkUnstructuredGrid *SavedParametersInput;
00227 vtkTimeStamp SavedParametersMTime;
00228
00229
00230
00231 vtkUnstructuredGrid *SavedTriangleListInput;
00232 vtkTimeStamp SavedTriangleListMTime;
00233
00234
00235
00236 double SampleDistance;
00237
00238
00239
00240
00241
00242
00243
00244
00245 Triangle **TetraTriangles;
00246 Triangle *TriangleList;
00247
00248
00249
00250
00251
00252 int IsTriangleFrontFacing( Triangle *triPtr, int tetraIndex );
00253
00254
00255
00256
00257 void ClearImage();
00258
00259
00260
00261
00262 Intersection *IntersectionBuffer[VTK_BUNYKRCF_MAX_ARRAYS];
00263 int IntersectionBufferCount[VTK_BUNYKRCF_MAX_ARRAYS];
00264
00265
00266
00267
00268 void *NewIntersection();
00269
00270
00271
00272
00273
00274 int CheckValidity(vtkRenderer *ren,
00275 vtkVolume *vol);
00276
00277
00278
00279 void TransformPoints();
00280
00281
00282
00283 void UpdateTriangleList();
00284
00285
00286
00287 void ComputeViewDependentInfo();
00288
00289
00290
00291
00292 void ComputePixelIntersections();
00293
00294
00295
00296
00297 void UpdateColorTable();
00298
00299
00300
00301
00302
00303 void SetNumberOfComponents( int num );
00304
00305
00306
00307 private:
00308 vtkUnstructuredGridBunykRayCastFunction(const vtkUnstructuredGridBunykRayCastFunction&);
00309 void operator=(const vtkUnstructuredGridBunykRayCastFunction&);
00310 };
00311
00312 #endif
00313
00314
00315
00316
00317
00318
00319