Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class 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 
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: Carl.Horton@med.ge.com
00027 
00028      for more information.
00029 
00030 =========================================================================*/
00057 #ifndef __vtkImageMarchingCubes_h
00058 #define __vtkImageMarchingCubes_h
00059 
00060 #include "vtkPolyDataSource.h"
00061 
00062 #include "vtkContourValues.h" // Needed for direct access to ContourValues
00063 
00064 class vtkCellArray;
00065 class vtkFloatArray;
00066 class vtkImageData;
00067 class vtkPoints;
00068 
00069 class VTK_PATENTED_EXPORT vtkImageMarchingCubes : public vtkPolyDataSource
00070 {
00071 public:
00072   static vtkImageMarchingCubes *New();
00073   vtkTypeRevisionMacro(vtkImageMarchingCubes,vtkPolyDataSource);
00074   void PrintSelf(ostream& os, vtkIndent indent);
00075   
00077 
00078   void SetInput(vtkImageData *input);
00079   vtkImageData *GetInput();
00081   
00082   // Methods to set contour values
00083   void SetValue(int i, double value);
00084   double GetValue(int i);
00085   double *GetValues();
00086   void GetValues(double *contourValues);
00087   void SetNumberOfContours(int number);
00088   int GetNumberOfContours();
00089   void GenerateValues(int numContours, double range[2]);
00090   void GenerateValues(int numContours, double rangeStart, double rangeEnd);
00091 
00092   // Because we delegate to vtkContourValues & refer to vtkImplicitFunction
00093   unsigned long int GetMTime();
00094 
00096 
00097   vtkSetMacro(ComputeScalars, int);
00098   vtkGetMacro(ComputeScalars, int);
00099   vtkBooleanMacro(ComputeScalars, int);
00101   
00103 
00107   vtkSetMacro(ComputeNormals, int);
00108   vtkGetMacro(ComputeNormals, int);
00109   vtkBooleanMacro(ComputeNormals, int);
00111   
00113 
00119   vtkSetMacro(ComputeGradients, int);
00120   vtkGetMacro(ComputeGradients, int);
00121   vtkBooleanMacro(ComputeGradients, int);
00123   
00124   // Should be protected, but the templated functions need these
00125   int ComputeScalars;
00126   int ComputeNormals;
00127   int ComputeGradients;
00128   int NeedGradients;
00129 
00130   vtkCellArray *Triangles;
00131   vtkFloatArray *Scalars;
00132   vtkPoints *Points;
00133   vtkFloatArray *Normals;
00134   vtkFloatArray *Gradients;
00135   
00136   int GetLocatorPoint(int cellX, int cellY, int edge);
00137   void AddLocatorPoint(int cellX, int cellY, int edge, int ptId);
00138   void IncrementLocatorZ();
00139 
00140   void Update();
00141   
00143 
00146   vtkSetMacro(InputMemoryLimit, int);
00147   vtkGetMacro(InputMemoryLimit, int);
00149 
00150 protected:
00151   vtkImageMarchingCubes();
00152   ~vtkImageMarchingCubes();
00153 
00154   int NumberOfSlicesPerChunk;
00155   int InputMemoryLimit;
00156 
00157   vtkContourValues *ContourValues;
00158    
00159   int *LocatorPointIds;
00160   int LocatorDimX;
00161   int LocatorDimY;
00162   int LocatorMinX;
00163   int LocatorMinY;
00164   
00165   void Execute();
00166 
00167   void March(vtkImageData *inData, int chunkMin, int chunkMax,
00168              int numContours, double *values);
00169   void InitializeLocator(int min0, int max0, int min1, int max1);
00170   void DeleteLocator();
00171   int *GetLocatorPointer(int cellX, int cellY, int edge);
00172 private:
00173   vtkImageMarchingCubes(const vtkImageMarchingCubes&);  // Not implemented.
00174   void operator=(const vtkImageMarchingCubes&);  // Not implemented.
00175 };
00176 
00179 inline void vtkImageMarchingCubes::SetValue(int i, double value)
00180 {this->ContourValues->SetValue(i,value);}
00181 
00183 
00184 inline double vtkImageMarchingCubes::GetValue(int i)
00185 {return this->ContourValues->GetValue(i);}
00187 
00189 
00191 inline double *vtkImageMarchingCubes::GetValues()
00192 {return this->ContourValues->GetValues();}
00194 
00198 inline void vtkImageMarchingCubes::GetValues(double *contourValues)
00199 {this->ContourValues->GetValues(contourValues);}
00200 
00204 inline void vtkImageMarchingCubes::SetNumberOfContours(int number)
00205 {this->ContourValues->SetNumberOfContours(number);}
00206 
00208 
00209 inline int vtkImageMarchingCubes::GetNumberOfContours()
00210 {return this->ContourValues->GetNumberOfContours();}
00212 
00214 
00216 inline void vtkImageMarchingCubes::GenerateValues(int numContours, double range[2])
00217 {this->ContourValues->GenerateValues(numContours, range);}
00219 
00221 
00223 inline void vtkImageMarchingCubes::GenerateValues(int numContours, double
00224                                                  rangeStart, double rangeEnd)
00225 {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);}
00227 
00228 #endif
00229 
00230 
00231