Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkImageMarchingCubes.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkImageMarchingCubes.h,v $
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 
00015      THIS CLASS IS PATENTED UNDER UNITED STATES PATENT NUMBER 4,710,876
00016      "System and Method for the Display of Surface Structures Contained
00017      Within The Interior Region of a Solid body".
00018      Application of this software for commercial purposes requires 
00019      a license grant from GE. Contact:
00020 
00021          Carl B. Horton
00022          Sr. Counsel, Intellectual Property
00023          3000 N. Grandview Blvd., W-710
00024          Waukesha, WI  53188
00025          Phone:  (262) 513-4022
00026          E-Mail: [email protected]
00027 
00028      for more information.
00029 
00030 =========================================================================*/
00070 #ifndef __vtkImageMarchingCubes_h
00071 #define __vtkImageMarchingCubes_h
00072 
00073 #include "vtkPolyDataSource.h"
00074 
00075 #include "vtkContourValues.h" // Needed for direct access to ContourValues
00076 
00077 class vtkCellArray;
00078 class vtkFloatArray;
00079 class vtkImageData;
00080 class vtkPoints;
00081 
00082 class VTK_PATENTED_EXPORT vtkImageMarchingCubes : public vtkPolyDataSource
00083 {
00084 public:
00085   static vtkImageMarchingCubes *New();
00086   vtkTypeRevisionMacro(vtkImageMarchingCubes,vtkPolyDataSource);
00087   void PrintSelf(ostream& os, vtkIndent indent);
00088   
00090 
00091   void SetInput(vtkImageData *input);
00092   vtkImageData *GetInput();
00094   
00095   // Methods to set contour values
00096   void SetValue(int i, double value);
00097   double GetValue(int i);
00098   double *GetValues();
00099   void GetValues(double *contourValues);
00100   void SetNumberOfContours(int number);
00101   int GetNumberOfContours();
00102   void GenerateValues(int numContours, double range[2]);
00103   void GenerateValues(int numContours, double rangeStart, double rangeEnd);
00104 
00105   // Because we delegate to vtkContourValues & refer to vtkImplicitFunction
00106   unsigned long int GetMTime();
00107 
00109 
00110   vtkSetMacro(ComputeScalars, int);
00111   vtkGetMacro(ComputeScalars, int);
00112   vtkBooleanMacro(ComputeScalars, int);
00114   
00116 
00120   vtkSetMacro(ComputeNormals, int);
00121   vtkGetMacro(ComputeNormals, int);
00122   vtkBooleanMacro(ComputeNormals, int);
00124   
00126 
00132   vtkSetMacro(ComputeGradients, int);
00133   vtkGetMacro(ComputeGradients, int);
00134   vtkBooleanMacro(ComputeGradients, int);
00136   
00137   // Should be protected, but the templated functions need these
00138   int ComputeScalars;
00139   int ComputeNormals;
00140   int ComputeGradients;
00141   int NeedGradients;
00142 
00143   vtkCellArray *Triangles;
00144   vtkFloatArray *Scalars;
00145   vtkPoints *Points;
00146   vtkFloatArray *Normals;
00147   vtkFloatArray *Gradients;
00148   
00149   int GetLocatorPoint(int cellX, int cellY, int edge);
00150   void AddLocatorPoint(int cellX, int cellY, int edge, int ptId);
00151   void IncrementLocatorZ();
00152 
00153   void Update();
00154   
00156 
00159   vtkSetMacro(InputMemoryLimit, int);
00160   vtkGetMacro(InputMemoryLimit, int);
00162 
00163 protected:
00164   vtkImageMarchingCubes();
00165   ~vtkImageMarchingCubes();
00166 
00167   int NumberOfSlicesPerChunk;
00168   int InputMemoryLimit;
00169 
00170   vtkContourValues *ContourValues;
00171    
00172   int *LocatorPointIds;
00173   int LocatorDimX;
00174   int LocatorDimY;
00175   int LocatorMinX;
00176   int LocatorMinY;
00177   
00178   void Execute();
00179 
00180   void March(vtkImageData *inData, int chunkMin, int chunkMax,
00181              int numContours, double *values);
00182   void InitializeLocator(int min0, int max0, int min1, int max1);
00183   void DeleteLocator();
00184   int *GetLocatorPointer(int cellX, int cellY, int edge);
00185 
00186   virtual int FillInputPortInformation(int, vtkInformation*);
00187 private:
00188   vtkImageMarchingCubes(const vtkImageMarchingCubes&);  // Not implemented.
00189   void operator=(const vtkImageMarchingCubes&);  // Not implemented.
00190 };
00191 
00194 inline void vtkImageMarchingCubes::SetValue(int i, double value)
00195 {this->ContourValues->SetValue(i,value);}
00196 
00198 
00199 inline double vtkImageMarchingCubes::GetValue(int i)
00200 {return this->ContourValues->GetValue(i);}
00202 
00204 
00206 inline double *vtkImageMarchingCubes::GetValues()
00207 {return this->ContourValues->GetValues();}
00209 
00213 inline void vtkImageMarchingCubes::GetValues(double *contourValues)
00214 {this->ContourValues->GetValues(contourValues);}
00215 
00219 inline void vtkImageMarchingCubes::SetNumberOfContours(int number)
00220 {this->ContourValues->SetNumberOfContours(number);}
00221 
00223 
00224 inline int vtkImageMarchingCubes::GetNumberOfContours()
00225 {return this->ContourValues->GetNumberOfContours();}
00227 
00229 
00231 inline void vtkImageMarchingCubes::GenerateValues(int numContours, double range[2])
00232 {this->ContourValues->GenerateValues(numContours, range);}
00234 
00236 
00238 inline void vtkImageMarchingCubes::GenerateValues(int numContours, double
00239                                                  rangeStart, double rangeEnd)
00240 {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);}
00242 
00243 #endif
00244 
00245 
00246