00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00041 #ifndef __vtkImageMarchingCubes_h
00042 #define __vtkImageMarchingCubes_h
00043
00044 #include "vtkPolyDataAlgorithm.h"
00045
00046 #include "vtkContourValues.h"
00047
00048 class vtkCellArray;
00049 class vtkFloatArray;
00050 class vtkImageData;
00051 class vtkPoints;
00052
00053 class VTK_GRAPHICS_EXPORT vtkImageMarchingCubes : public vtkPolyDataAlgorithm
00054 {
00055 public:
00056 static vtkImageMarchingCubes *New();
00057 vtkTypeRevisionMacro(vtkImageMarchingCubes,vtkPolyDataAlgorithm);
00058 void PrintSelf(ostream& os, vtkIndent indent);
00059
00061
00062 void SetValue(int i, double value);
00063 double GetValue(int i);
00064 double *GetValues();
00065 void GetValues(double *contourValues);
00066 void SetNumberOfContours(int number);
00067 int GetNumberOfContours();
00068 void GenerateValues(int numContours, double range[2]);
00069 void GenerateValues(int numContours, double rangeStart, double rangeEnd);
00071
00074 unsigned long int GetMTime();
00075
00077
00078 vtkSetMacro(ComputeScalars, int);
00079 vtkGetMacro(ComputeScalars, int);
00080 vtkBooleanMacro(ComputeScalars, int);
00082
00084
00088 vtkSetMacro(ComputeNormals, int);
00089 vtkGetMacro(ComputeNormals, int);
00090 vtkBooleanMacro(ComputeNormals, int);
00092
00094
00100 vtkSetMacro(ComputeGradients, int);
00101 vtkGetMacro(ComputeGradients, int);
00102 vtkBooleanMacro(ComputeGradients, int);
00104
00105
00106 int ComputeScalars;
00107 int ComputeNormals;
00108 int ComputeGradients;
00109 int NeedGradients;
00110
00111 vtkCellArray *Triangles;
00112 vtkFloatArray *Scalars;
00113 vtkPoints *Points;
00114 vtkFloatArray *Normals;
00115 vtkFloatArray *Gradients;
00116
00117 int GetLocatorPoint(int cellX, int cellY, int edge);
00118 void AddLocatorPoint(int cellX, int cellY, int edge, int ptId);
00119 void IncrementLocatorZ();
00120
00122
00125 vtkSetMacro(InputMemoryLimit, int);
00126 vtkGetMacro(InputMemoryLimit, int);
00128
00129 protected:
00130 vtkImageMarchingCubes();
00131 ~vtkImageMarchingCubes();
00132
00133 int NumberOfSlicesPerChunk;
00134 int InputMemoryLimit;
00135
00136 vtkContourValues *ContourValues;
00137
00138 int *LocatorPointIds;
00139 int LocatorDimX;
00140 int LocatorDimY;
00141 int LocatorMinX;
00142 int LocatorMinY;
00143
00144 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00145 virtual int FillInputPortInformation(int port, vtkInformation *info);
00146
00147 void March(vtkImageData *inData, int chunkMin, int chunkMax,
00148 int numContours, double *values);
00149 void InitializeLocator(int min0, int max0, int min1, int max1);
00150 void DeleteLocator();
00151 int *GetLocatorPointer(int cellX, int cellY, int edge);
00152
00153 private:
00154 vtkImageMarchingCubes(const vtkImageMarchingCubes&);
00155 void operator=(const vtkImageMarchingCubes&);
00156 };
00157
00160 inline void vtkImageMarchingCubes::SetValue(int i, double value)
00161 {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
00179 inline void vtkImageMarchingCubes::GetValues(double *contourValues)
00180 {this->ContourValues->GetValues(contourValues);}
00181
00185 inline void vtkImageMarchingCubes::SetNumberOfContours(int number)
00186 {this->ContourValues->SetNumberOfContours(number);}
00187
00189
00190 inline int vtkImageMarchingCubes::GetNumberOfContours()
00191 {return this->ContourValues->GetNumberOfContours();}
00193
00195
00197 inline void vtkImageMarchingCubes::GenerateValues(int numContours, double range[2])
00198 {this->ContourValues->GenerateValues(numContours, range);}
00200
00202
00204 inline void vtkImageMarchingCubes::GenerateValues(int numContours, double
00205 rangeStart, double rangeEnd)
00206 {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);}
00208
00209 #endif