00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkUnstructuredGridTestRayIntegrator.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 00040 #ifndef __vtkUnstructuredGridTestRayIntegrator_h 00041 #define __vtkUnstructuredGridTestRayIntegrator_h 00042 00043 #include "vtkUnstructuredGridVolumeRayIntegrator.h" 00044 00045 class vtkColorTransferFunction; 00046 class vtkPiecewiseFunction; 00047 class vtkUnstructuredGrid; 00048 00049 class VTK_RENDERING_EXPORT vtkUnstructuredGridTestRayIntegrator : public vtkUnstructuredGridVolumeRayIntegrator 00050 { 00051 public: 00052 vtkTypeRevisionMacro(vtkUnstructuredGridTestRayIntegrator, 00053 vtkUnstructuredGridVolumeRayIntegrator); 00054 virtual void PrintSelf(ostream& os, vtkIndent indent); 00055 static vtkUnstructuredGridTestRayIntegrator *New(); 00056 00058 virtual void Initialize(vtkVolumeProperty *property, vtkDataArray *scalars); 00059 00061 00068 virtual void Integrate(vtkDoubleArray *intersectionLengths, 00069 vtkDataArray *nearIntersections, 00070 vtkDataArray *farIntersections, 00071 float color[4]); 00073 00074 double **GetColorTable() {return this->ColorTable;} 00075 double *GetColorTableShift() {return this->ColorTableShift;} 00076 double *GetColorTableScale() {return this->ColorTableScale;} 00077 00078 vtkGetMacro( ScalarOpacityUnitDistance, double ); 00079 00080 protected: 00081 vtkUnstructuredGridTestRayIntegrator(); 00082 ~vtkUnstructuredGridTestRayIntegrator(); 00083 00084 // This table holds the mapping from scalar value to color/opacity. 00085 // There is one table per component. 00086 double **ColorTable; 00087 int *ColorTableSize; 00088 00089 // This is the shift/scale that needs to be applied to the scalar value 00090 // to map it into the (integer) range of the color table. There is one 00091 // shift/scale value per component. 00092 double *ColorTableShift; 00093 double *ColorTableScale; 00094 00095 // These are some values saved during the computation of the ColorTable. 00096 // These saved values help us determine if anything changed since the 00097 // last time the functions were updated - if so we need to recreate them, 00098 // otherwise we can just keep using the current ones. 00099 vtkColorTransferFunction **SavedRGBFunction; 00100 vtkPiecewiseFunction **SavedGrayFunction; 00101 vtkPiecewiseFunction **SavedScalarOpacityFunction; 00102 int *SavedColorChannels; 00103 double *SavedScalarOpacityDistance; 00104 double SavedSampleDistance; 00105 int SavedNumberOfComponents; 00106 vtkDataArray *SavedParametersScalars; 00107 vtkTimeStamp SavedParametersMTime; 00108 00109 // This method is used during the initialization process to 00110 // update the arrays holding the mapping from scalar value 00111 // to color/opacity 00112 virtual void UpdateColorTable(vtkVolumeProperty *property, 00113 vtkDataArray *scalars); 00114 00115 // This method is used to change the number of components 00116 // for which information is being cached. This will delete 00117 // the color table and all saved arrays for computing it, 00118 // and will reconstruct them with the right size. 00119 void SetNumberOfComponents(int num); 00120 00121 // Hang on to this value (from vtkVolumeProperty) since the CastRay method 00122 // will need access to it to correct the opacity for the actual length 00123 // through each cell 00124 double ScalarOpacityUnitDistance; 00125 00126 private: 00127 vtkUnstructuredGridTestRayIntegrator(const vtkUnstructuredGridTestRayIntegrator&); // Not implemented. 00128 void operator=(const vtkUnstructuredGridTestRayIntegrator&); // Not implemented. 00129 }; 00130 00131 #endif 00132 00133 00134 00135 00136 00137 00138