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
00053
00085 #ifndef __vtkImageMarchingCubes_h
00086 #define __vtkImageMarchingCubes_h
00087
00088 #include "vtkImageData.h"
00089 #include "vtkPolyDataSource.h"
00090 #include "vtkContourValues.h"
00091
00092 class vtkFloatArray;
00093
00094 class VTK_PATENTED_EXPORT vtkImageMarchingCubes : public vtkPolyDataSource
00095 {
00096 public:
00097 static vtkImageMarchingCubes *New();
00098 vtkTypeMacro(vtkImageMarchingCubes,vtkPolyDataSource);
00099 void PrintSelf(ostream& os, vtkIndent indent);
00100
00102
00103 void SetInput(vtkImageData *input);
00104 vtkImageData *GetInput();
00106
00107
00108 void SetValue(int i, float value);
00109 float GetValue(int i);
00110 float *GetValues();
00111 void GetValues(float *contourValues);
00112 void SetNumberOfContours(int number);
00113 int GetNumberOfContours();
00114 void GenerateValues(int numContours, float range[2]);
00115 void GenerateValues(int numContours, float rangeStart, float rangeEnd);
00116
00117
00118 unsigned long int GetMTime();
00119
00121
00122 vtkSetMacro(ComputeScalars, int);
00123 vtkGetMacro(ComputeScalars, int);
00124 vtkBooleanMacro(ComputeScalars, int);
00126
00128
00132 vtkSetMacro(ComputeNormals, int);
00133 vtkGetMacro(ComputeNormals, int);
00134 vtkBooleanMacro(ComputeNormals, int);
00136
00138
00144 vtkSetMacro(ComputeGradients, int);
00145 vtkGetMacro(ComputeGradients, int);
00146 vtkBooleanMacro(ComputeGradients, int);
00148
00149
00150 int ComputeScalars;
00151 int ComputeNormals;
00152 int ComputeGradients;
00153 int NeedGradients;
00154
00155 vtkCellArray *Triangles;
00156 vtkFloatArray *Scalars;
00157 vtkPoints *Points;
00158 vtkFloatArray *Normals;
00159 vtkFloatArray *Gradients;
00160
00161 int GetLocatorPoint(int cellX, int cellY, int edge);
00162 void AddLocatorPoint(int cellX, int cellY, int edge, int ptId);
00163 void IncrementLocatorZ();
00164
00165 void Update();
00166
00168
00171 vtkSetMacro(InputMemoryLimit, int);
00172 vtkGetMacro(InputMemoryLimit, int);
00174
00175 protected:
00176 vtkImageMarchingCubes();
00177 ~vtkImageMarchingCubes();
00178
00179 int NumberOfSlicesPerChunk;
00180 int InputMemoryLimit;
00181
00182 vtkContourValues *ContourValues;
00183
00184 int *LocatorPointIds;
00185 int LocatorDimX;
00186 int LocatorDimY;
00187 int LocatorMinX;
00188 int LocatorMinY;
00189
00190 void Execute();
00191
00192 void March(vtkImageData *inData, int chunkMin, int chunkMax,
00193 int numContours, float *values);
00194 void InitializeLocator(int min0, int max0, int min1, int max1);
00195 void DeleteLocator();
00196 int *GetLocatorPointer(int cellX, int cellY, int edge);
00197 private:
00198 vtkImageMarchingCubes(const vtkImageMarchingCubes&);
00199 void operator=(const vtkImageMarchingCubes&);
00200 };
00201
00204 inline void vtkImageMarchingCubes::SetValue(int i, float value)
00205 {this->ContourValues->SetValue(i,value);}
00206
00208
00209 inline float vtkImageMarchingCubes::GetValue(int i)
00210 {return this->ContourValues->GetValue(i);}
00212
00214
00216 inline float *vtkImageMarchingCubes::GetValues()
00217 {return this->ContourValues->GetValues();}
00219
00223 inline void vtkImageMarchingCubes::GetValues(float *contourValues)
00224 {this->ContourValues->GetValues(contourValues);}
00225
00229 inline void vtkImageMarchingCubes::SetNumberOfContours(int number)
00230 {this->ContourValues->SetNumberOfContours(number);}
00231
00233
00234 inline int vtkImageMarchingCubes::GetNumberOfContours()
00235 {return this->ContourValues->GetNumberOfContours();}
00237
00239
00241 inline void vtkImageMarchingCubes::GenerateValues(int numContours, float range[2])
00242 {this->ContourValues->GenerateValues(numContours, range);}
00244
00246
00248 inline void vtkImageMarchingCubes::GenerateValues(int numContours, float
00249 rangeStart, float rangeEnd)
00250 {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);}
00252
00253 #endif
00254
00255
00256