VTK
dox/Filters/General/vtkImageMarchingCubes.h
Go to the documentation of this file.
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 =========================================================================*/
00041 #ifndef __vtkImageMarchingCubes_h
00042 #define __vtkImageMarchingCubes_h
00043 
00044 #include "vtkFiltersGeneralModule.h" // For export macro
00045 #include "vtkPolyDataAlgorithm.h"
00046 
00047 #include "vtkContourValues.h" // Needed for direct access to ContourValues
00048 
00049 class vtkCellArray;
00050 class vtkFloatArray;
00051 class vtkImageData;
00052 class vtkPoints;
00053 
00054 class VTKFILTERSGENERAL_EXPORT vtkImageMarchingCubes : public vtkPolyDataAlgorithm
00055 {
00056 public:
00057   static vtkImageMarchingCubes *New();
00058   vtkTypeMacro(vtkImageMarchingCubes,vtkPolyDataAlgorithm);
00059   void PrintSelf(ostream& os, vtkIndent indent);
00060 
00062 
00063   void SetValue(int i, double value);
00064   double GetValue(int i);
00065   double *GetValues();
00066   void GetValues(double *contourValues);
00067   void SetNumberOfContours(int number);
00068   int GetNumberOfContours();
00069   void GenerateValues(int numContours, double range[2]);
00070   void GenerateValues(int numContours, double rangeStart, double rangeEnd);
00072 
00075   unsigned long int GetMTime();
00076 
00078 
00079   vtkSetMacro(ComputeScalars, int);
00080   vtkGetMacro(ComputeScalars, int);
00081   vtkBooleanMacro(ComputeScalars, int);
00083 
00085 
00089   vtkSetMacro(ComputeNormals, int);
00090   vtkGetMacro(ComputeNormals, int);
00091   vtkBooleanMacro(ComputeNormals, int);
00093 
00095 
00101   vtkSetMacro(ComputeGradients, int);
00102   vtkGetMacro(ComputeGradients, int);
00103   vtkBooleanMacro(ComputeGradients, int);
00105 
00106   // Should be protected, but the templated functions need these
00107   int ComputeScalars;
00108   int ComputeNormals;
00109   int ComputeGradients;
00110   int NeedGradients;
00111 
00112   vtkCellArray *Triangles;
00113   vtkFloatArray *Scalars;
00114   vtkPoints *Points;
00115   vtkFloatArray *Normals;
00116   vtkFloatArray *Gradients;
00117 
00118   vtkIdType GetLocatorPoint(int cellX, int cellY, int edge);
00119   void AddLocatorPoint(int cellX, int cellY, int edge, vtkIdType ptId);
00120   void IncrementLocatorZ();
00121 
00123 
00126   vtkSetMacro(InputMemoryLimit, vtkIdType);
00127   vtkGetMacro(InputMemoryLimit, vtkIdType);
00129 
00130 protected:
00131   vtkImageMarchingCubes();
00132   ~vtkImageMarchingCubes();
00133 
00134   int NumberOfSlicesPerChunk;
00135   vtkIdType InputMemoryLimit;
00136 
00137   vtkContourValues *ContourValues;
00138 
00139   vtkIdType *LocatorPointIds;
00140   int LocatorDimX;
00141   int LocatorDimY;
00142   int LocatorMinX;
00143   int LocatorMinY;
00144 
00145   virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00146   virtual int FillInputPortInformation(int port, vtkInformation *info);
00147 
00148   void March(vtkImageData *inData, int chunkMin, int chunkMax,
00149              int numContours, double *values);
00150   void InitializeLocator(int min0, int max0, int min1, int max1);
00151   void DeleteLocator();
00152   vtkIdType *GetLocatorPointer(int cellX, int cellY, int edge);
00153 
00154 private:
00155   vtkImageMarchingCubes(const vtkImageMarchingCubes&);  // Not implemented.
00156   void operator=(const vtkImageMarchingCubes&);  // Not implemented.
00157 };
00158 
00160 
00162 inline void vtkImageMarchingCubes::SetValue(int i, double value)
00163 {this->ContourValues->SetValue(i,value);}
00165 
00167 
00168 inline double vtkImageMarchingCubes::GetValue(int i)
00169 {return this->ContourValues->GetValue(i);}
00171 
00173 
00175 inline double *vtkImageMarchingCubes::GetValues()
00176 {return this->ContourValues->GetValues();}
00178 
00180 
00183 inline void vtkImageMarchingCubes::GetValues(double *contourValues)
00184 {this->ContourValues->GetValues(contourValues);}
00186 
00188 
00191 inline void vtkImageMarchingCubes::SetNumberOfContours(int number)
00192 {this->ContourValues->SetNumberOfContours(number);}
00194 
00196 
00197 inline int vtkImageMarchingCubes::GetNumberOfContours()
00198 {return this->ContourValues->GetNumberOfContours();}
00200 
00202 
00204 inline void vtkImageMarchingCubes::GenerateValues(int numContours, double range[2])
00205 {this->ContourValues->GenerateValues(numContours, range);}
00207 
00209 
00211 inline void vtkImageMarchingCubes::GenerateValues(int numContours, double
00212                                                  rangeStart, double rangeEnd)
00213 {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);}
00215 
00216 #endif