VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkImageMarchingCubes.h 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 =========================================================================*/ 00038 #ifndef vtkImageMarchingCubes_h 00039 #define vtkImageMarchingCubes_h 00040 00041 #include "vtkFiltersGeneralModule.h" // For export macro 00042 #include "vtkPolyDataAlgorithm.h" 00043 00044 #include "vtkContourValues.h" // Needed for direct access to ContourValues 00045 00046 class vtkCellArray; 00047 class vtkFloatArray; 00048 class vtkImageData; 00049 class vtkPoints; 00050 00051 class VTKFILTERSGENERAL_EXPORT vtkImageMarchingCubes : public vtkPolyDataAlgorithm 00052 { 00053 public: 00054 static vtkImageMarchingCubes *New(); 00055 vtkTypeMacro(vtkImageMarchingCubes,vtkPolyDataAlgorithm); 00056 void PrintSelf(ostream& os, vtkIndent indent); 00057 00059 00060 void SetValue(int i, double value); 00061 double GetValue(int i); 00062 double *GetValues(); 00063 void GetValues(double *contourValues); 00064 void SetNumberOfContours(int number); 00065 int GetNumberOfContours(); 00066 void GenerateValues(int numContours, double range[2]); 00067 void GenerateValues(int numContours, double rangeStart, double rangeEnd); 00069 00072 unsigned long int GetMTime(); 00073 00075 00076 vtkSetMacro(ComputeScalars, int); 00077 vtkGetMacro(ComputeScalars, int); 00078 vtkBooleanMacro(ComputeScalars, int); 00080 00082 00086 vtkSetMacro(ComputeNormals, int); 00087 vtkGetMacro(ComputeNormals, int); 00088 vtkBooleanMacro(ComputeNormals, int); 00090 00092 00098 vtkSetMacro(ComputeGradients, int); 00099 vtkGetMacro(ComputeGradients, int); 00100 vtkBooleanMacro(ComputeGradients, int); 00102 00103 // Should be protected, but the templated functions need these 00104 int ComputeScalars; 00105 int ComputeNormals; 00106 int ComputeGradients; 00107 int NeedGradients; 00108 00109 vtkCellArray *Triangles; 00110 vtkFloatArray *Scalars; 00111 vtkPoints *Points; 00112 vtkFloatArray *Normals; 00113 vtkFloatArray *Gradients; 00114 00115 vtkIdType GetLocatorPoint(int cellX, int cellY, int edge); 00116 void AddLocatorPoint(int cellX, int cellY, int edge, vtkIdType ptId); 00117 void IncrementLocatorZ(); 00118 00120 00123 vtkSetMacro(InputMemoryLimit, vtkIdType); 00124 vtkGetMacro(InputMemoryLimit, vtkIdType); 00126 00127 protected: 00128 vtkImageMarchingCubes(); 00129 ~vtkImageMarchingCubes(); 00130 00131 int NumberOfSlicesPerChunk; 00132 vtkIdType InputMemoryLimit; 00133 00134 vtkContourValues *ContourValues; 00135 00136 vtkIdType *LocatorPointIds; 00137 int LocatorDimX; 00138 int LocatorDimY; 00139 int LocatorMinX; 00140 int LocatorMinY; 00141 00142 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00143 virtual int FillInputPortInformation(int port, vtkInformation *info); 00144 00145 void March(vtkImageData *inData, int chunkMin, int chunkMax, 00146 int numContours, double *values); 00147 void InitializeLocator(int min0, int max0, int min1, int max1); 00148 void DeleteLocator(); 00149 vtkIdType *GetLocatorPointer(int cellX, int cellY, int edge); 00150 00151 private: 00152 vtkImageMarchingCubes(const vtkImageMarchingCubes&); // Not implemented. 00153 void operator=(const vtkImageMarchingCubes&); // Not implemented. 00154 }; 00155 00157 00159 inline void vtkImageMarchingCubes::SetValue(int i, double value) 00160 {this->ContourValues->SetValue(i,value);} 00162 00164 00165 inline double vtkImageMarchingCubes::GetValue(int i) 00166 {return this->ContourValues->GetValue(i);} 00168 00170 00172 inline double *vtkImageMarchingCubes::GetValues() 00173 {return this->ContourValues->GetValues();} 00175 00177 00180 inline void vtkImageMarchingCubes::GetValues(double *contourValues) 00181 {this->ContourValues->GetValues(contourValues);} 00183 00185 00188 inline void vtkImageMarchingCubes::SetNumberOfContours(int number) 00189 {this->ContourValues->SetNumberOfContours(number);} 00191 00193 00194 inline int vtkImageMarchingCubes::GetNumberOfContours() 00195 {return this->ContourValues->GetNumberOfContours();} 00197 00199 00201 inline void vtkImageMarchingCubes::GenerateValues(int numContours, double range[2]) 00202 {this->ContourValues->GenerateValues(numContours, range);} 00204 00206 00208 inline void vtkImageMarchingCubes::GenerateValues(int numContours, double 00209 rangeStart, double rangeEnd) 00210 {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);} 00212 00213 #endif