00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 
00043 
00044 
00045 
00046 
00047 
00048 
00049 
00050 
00051 
00052 
00080 #ifndef __vtkImageMarchingCubes_h
00081 #define __vtkImageMarchingCubes_h
00082 
00083 #include "vtkImageData.h"
00084 #include "vtkPolyDataSource.h"
00085 #include "vtkContourValues.h"
00086 
00087 class VTK_EXPORT vtkImageMarchingCubes : public vtkPolyDataSource
00088 {
00089 public:
00090   static vtkImageMarchingCubes *New();
00091   vtkTypeMacro(vtkImageMarchingCubes,vtkPolyDataSource);
00092   void PrintSelf(ostream& os, vtkIndent indent);
00093   
00095   void SetInput(vtkImageData *input);
00096   vtkImageData *GetInput();
00097   
00098   
00099   void SetValue(int i, float value);
00100   float GetValue(int i);
00101   float *GetValues();
00102   void GetValues(float *contourValues);
00103   void SetNumberOfContours(int number);
00104   int GetNumberOfContours();
00105   void GenerateValues(int numContours, float range[2]);
00106   void GenerateValues(int numContours, float rangeStart, float rangeEnd);
00107 
00108   
00109   unsigned long int GetMTime();
00110 
00112   vtkSetMacro(ComputeScalars, int);
00113   vtkGetMacro(ComputeScalars, int);
00114   vtkBooleanMacro(ComputeScalars, int);
00115   
00120   vtkSetMacro(ComputeNormals, int);
00121   vtkGetMacro(ComputeNormals, int);
00122   vtkBooleanMacro(ComputeNormals, int);
00123   
00130   vtkSetMacro(ComputeGradients, int);
00131   vtkGetMacro(ComputeGradients, int);
00132   vtkBooleanMacro(ComputeGradients, int);
00133   
00134   
00135   int ComputeScalars;
00136   int ComputeNormals;
00137   int ComputeGradients;
00138   int NeedGradients;
00139 
00140   vtkCellArray *Triangles;
00141   vtkScalars *Scalars;
00142   vtkPoints *Points;
00143   vtkNormals *Normals;
00144   vtkVectors *Gradients;
00145   
00146   int GetLocatorPoint(int cellX, int cellY, int edge);
00147   void AddLocatorPoint(int cellX, int cellY, int edge, int ptId);
00148   void IncrementLocatorZ();
00149 
00150   void Update();
00151   
00155   vtkSetMacro(InputMemoryLimit, int);
00156   vtkGetMacro(InputMemoryLimit, int);
00157 
00158 protected:
00159   vtkImageMarchingCubes();
00160   ~vtkImageMarchingCubes();
00161   vtkImageMarchingCubes(const vtkImageMarchingCubes&) {};
00162   void operator=(const vtkImageMarchingCubes&) {};
00163 
00164   int NumberOfSlicesPerChunk;
00165   int InputMemoryLimit;
00166 
00167   vtkContourValues *ContourValues;
00168    
00169   int *LocatorPointIds;
00170   int LocatorDimX;
00171   int LocatorDimY;
00172   int LocatorMinX;
00173   int LocatorMinY;
00174   
00175   void Execute();
00176 
00177   void March(vtkImageData *inData, int chunkMin, int chunkMax,
00178              int numContours, float *values);
00179   void InitializeLocator(int min0, int max0, int min1, int max1);
00180   void DeleteLocator();
00181   int *GetLocatorPointer(int cellX, int cellY, int edge);
00182 };
00183 
00186 inline void vtkImageMarchingCubes::SetValue(int i, float value)
00187 {this->ContourValues->SetValue(i,value);}
00188 
00190 inline float vtkImageMarchingCubes::GetValue(int i)
00191 {return this->ContourValues->GetValue(i);}
00192 
00195 inline float *vtkImageMarchingCubes::GetValues()
00196 {return this->ContourValues->GetValues();}
00197 
00201 inline void vtkImageMarchingCubes::GetValues(float *contourValues)
00202 {this->ContourValues->GetValues(contourValues);}
00203 
00207 inline void vtkImageMarchingCubes::SetNumberOfContours(int number)
00208 {this->ContourValues->SetNumberOfContours(number);}
00209 
00211 inline int vtkImageMarchingCubes::GetNumberOfContours()
00212 {return this->ContourValues->GetNumberOfContours();}
00213 
00216 inline void vtkImageMarchingCubes::GenerateValues(int numContours, float range[2])
00217 {this->ContourValues->GenerateValues(numContours, range);}
00218 
00221 inline void vtkImageMarchingCubes::GenerateValues(int numContours, float
00222                                                  rangeStart, float rangeEnd)
00223 {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);}
00224 
00225 #endif
00226 
00227 
00228