Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Patented/vtkImageMarchingCubes.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkImageMarchingCubes.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
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: Carl.Horton@med.ge.com
00027 
00028      for more information.
00029 
00030 =========================================================================*/
00073 #ifndef __vtkImageMarchingCubes_h
00074 #define __vtkImageMarchingCubes_h
00075 
00076 #include "vtkPolyDataSource.h"
00077 
00078 #include "vtkContourValues.h" // Needed for direct access to ContourValues
00079 
00080 class vtkCellArray;
00081 class vtkFloatArray;
00082 class vtkImageData;
00083 class vtkPoints;
00084 
00085 class VTK_PATENTED_EXPORT vtkImageMarchingCubes : public vtkPolyDataSource
00086 {
00087 public:
00088   static vtkImageMarchingCubes *New();
00089   vtkTypeRevisionMacro(vtkImageMarchingCubes,vtkPolyDataSource);
00090   void PrintSelf(ostream& os, vtkIndent indent);
00091   
00093 
00094   void SetInput(vtkImageData *input);
00095   vtkImageData *GetInput();
00097   
00098   // Methods to set contour values
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   // Because we delegate to vtkContourValues & refer to vtkImplicitFunction
00109   unsigned long int GetMTime();
00110 
00112 
00113   vtkSetMacro(ComputeScalars, int);
00114   vtkGetMacro(ComputeScalars, int);
00115   vtkBooleanMacro(ComputeScalars, int);
00117   
00119 
00123   vtkSetMacro(ComputeNormals, int);
00124   vtkGetMacro(ComputeNormals, int);
00125   vtkBooleanMacro(ComputeNormals, int);
00127   
00129 
00135   vtkSetMacro(ComputeGradients, int);
00136   vtkGetMacro(ComputeGradients, int);
00137   vtkBooleanMacro(ComputeGradients, int);
00139   
00140   // Should be protected, but the templated functions need these
00141   int ComputeScalars;
00142   int ComputeNormals;
00143   int ComputeGradients;
00144   int NeedGradients;
00145 
00146   vtkCellArray *Triangles;
00147   vtkFloatArray *Scalars;
00148   vtkPoints *Points;
00149   vtkFloatArray *Normals;
00150   vtkFloatArray *Gradients;
00151   
00152   int GetLocatorPoint(int cellX, int cellY, int edge);
00153   void AddLocatorPoint(int cellX, int cellY, int edge, int ptId);
00154   void IncrementLocatorZ();
00155 
00156   void Update();
00157   
00159 
00162   vtkSetMacro(InputMemoryLimit, int);
00163   vtkGetMacro(InputMemoryLimit, int);
00165 
00166 protected:
00167   vtkImageMarchingCubes();
00168   ~vtkImageMarchingCubes();
00169 
00170   int NumberOfSlicesPerChunk;
00171   int InputMemoryLimit;
00172 
00173   vtkContourValues *ContourValues;
00174    
00175   int *LocatorPointIds;
00176   int LocatorDimX;
00177   int LocatorDimY;
00178   int LocatorMinX;
00179   int LocatorMinY;
00180   
00181   void Execute();
00182 
00183   void March(vtkImageData *inData, int chunkMin, int chunkMax,
00184              int numContours, float *values);
00185   void InitializeLocator(int min0, int max0, int min1, int max1);
00186   void DeleteLocator();
00187   int *GetLocatorPointer(int cellX, int cellY, int edge);
00188 private:
00189   vtkImageMarchingCubes(const vtkImageMarchingCubes&);  // Not implemented.
00190   void operator=(const vtkImageMarchingCubes&);  // Not implemented.
00191 };
00192 
00195 inline void vtkImageMarchingCubes::SetValue(int i, float value)
00196 {this->ContourValues->SetValue(i,value);}
00197 
00199 
00200 inline float vtkImageMarchingCubes::GetValue(int i)
00201 {return this->ContourValues->GetValue(i);}
00203 
00205 
00207 inline float *vtkImageMarchingCubes::GetValues()
00208 {return this->ContourValues->GetValues();}
00210 
00214 inline void vtkImageMarchingCubes::GetValues(float *contourValues)
00215 {this->ContourValues->GetValues(contourValues);}
00216 
00220 inline void vtkImageMarchingCubes::SetNumberOfContours(int number)
00221 {this->ContourValues->SetNumberOfContours(number);}
00222 
00224 
00225 inline int vtkImageMarchingCubes::GetNumberOfContours()
00226 {return this->ContourValues->GetNumberOfContours();}
00228 
00230 
00232 inline void vtkImageMarchingCubes::GenerateValues(int numContours, float range[2])
00233 {this->ContourValues->GenerateValues(numContours, range);}
00235 
00237 
00239 inline void vtkImageMarchingCubes::GenerateValues(int numContours, float
00240                                                  rangeStart, float rangeEnd)
00241 {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);}
00243 
00244 #endif
00245 
00246 
00247