OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I686LINUX / util / I686LINUX / include / vtk / vtkMarchingCubes.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkMarchingCubes.h,v $
5   Language:  C++
6   Date:      $Date: 2002/08/30 21:05:16 $
7   Version:   $Revision: 1.62 $
8
9   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
10   All rights reserved.
11   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
12
13      This software is distributed WITHOUT ANY WARRANTY; without even 
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15      PURPOSE.  See the above copyright notice for more information.
16
17      THIS CLASS IS PATENTED UNDER UNITED STATES PATENT NUMBER 4,710,876
18      "System and Method for the Display of Surface Structures Contained
19      Within the Interior Region of a Solid Body".
20      Application of this software for commercial purposes requires 
21      a license grant from GE. Contact:
22
23          Carl B. Horton
24          Sr. Counsel, Intellectual Property
25          3000 N. Grandview Blvd., W-710
26          Waukesha, WI  53188
27          Phone:  (262) 513-4022
28          E-Mail: Carl.Horton@med.ge.com
29
30      for more information.
31
32 =========================================================================*/
33 // .NAME vtkMarchingCubes - generate isosurface(s) from volume
34 // .SECTION Description
35 // vtkMarchingCubes is a filter that takes as input a volume (e.g., 3D
36 // structured point set) and generates on output one or more isosurfaces.
37 // One or more contour values must be specified to generate the isosurfaces.
38 // Alternatively, you can specify a min/max scalar range and the number of
39 // contours to generate a series of evenly spaced contour values.
40
41 // .SECTION Caveats
42 // This filter is specialized to volumes. If you are interested in 
43 // contouring other types of data, use the general vtkContourFilter. If you
44 // want to contour an image (i.e., a volume slice), use vtkMarchingSquares.
45 // .SECTION See Also
46 // vtkContourFilter vtkSliceCubes vtkMarchingSquares vtkDividingCubes
47
48 #ifndef __vtkMarchingCubes_h
49 #define __vtkMarchingCubes_h
50
51 #include "vtkStructuredPointsToPolyDataFilter.h"
52
53 #include "vtkContourValues.h" // Needed for direct access to ContourValues
54
55 class vtkPointLocator;
56
57 class VTK_PATENTED_EXPORT vtkMarchingCubes : public vtkStructuredPointsToPolyDataFilter
58 {
59 public:
60   static vtkMarchingCubes *New();
61   vtkTypeRevisionMacro(vtkMarchingCubes,vtkStructuredPointsToPolyDataFilter);
62   void PrintSelf(ostream& os, vtkIndent indent);
63
64   // Methods to set contour values
65   void SetValue(int i, float value);
66   float GetValue(int i);
67   float *GetValues();
68   void GetValues(float *contourValues);
69   void SetNumberOfContours(int number);
70   int GetNumberOfContours();
71   void GenerateValues(int numContours, float range[2]);
72   void GenerateValues(int numContours, float rangeStart, float rangeEnd);
73
74   // Because we delegate to vtkContourValues
75   unsigned long int GetMTime();
76
77   // Description:
78   // Set/Get the computation of normals. Normal computation is fairly
79   // expensive in both time and storage. If the output data will be
80   // processed by filters that modify topology or geometry, it may be
81   // wise to turn Normals and Gradients off.
82   vtkSetMacro(ComputeNormals,int);
83   vtkGetMacro(ComputeNormals,int);
84   vtkBooleanMacro(ComputeNormals,int);
85
86   // Description:
87   // Set/Get the computation of gradients. Gradient computation is
88   // fairly expensive in both time and storage. Note that if
89   // ComputeNormals is on, gradients will have to be calculated, but
90   // will not be stored in the output dataset.  If the output data
91   // will be processed by filters that modify topology or geometry, it
92   // may be wise to turn Normals and Gradients off.
93   vtkSetMacro(ComputeGradients,int);
94   vtkGetMacro(ComputeGradients,int);
95   vtkBooleanMacro(ComputeGradients,int);
96
97   // Description:
98   // Set/Get the computation of scalars.
99   vtkSetMacro(ComputeScalars,int);
100   vtkGetMacro(ComputeScalars,int);
101   vtkBooleanMacro(ComputeScalars,int);
102
103   // Description:
104   // Overide the default locator.  Useful for changing the number of
105   // bins for performance or specifying a more aggressive locator.
106   void SetLocator(vtkPointLocator *locator);
107   vtkGetObjectMacro(Locator,vtkPointLocator);
108
109   // Description:
110   // Create default locator. Used to create one when none is
111   // specified. The locator is used to merge coincident points.
112   void CreateDefaultLocator();
113
114 protected:
115   vtkMarchingCubes();
116   ~vtkMarchingCubes();
117
118   void Execute();
119
120   vtkContourValues *ContourValues;
121   int ComputeNormals;
122   int ComputeGradients;
123   int ComputeScalars;
124   vtkPointLocator *Locator;
125 private:
126   vtkMarchingCubes(const vtkMarchingCubes&);  // Not implemented.
127   void operator=(const vtkMarchingCubes&);  // Not implemented.
128 };
129
130 // Description:
131 // Set a particular contour value at contour number i. The index i ranges 
132 // between 0<=i<NumberOfContours.
133 inline void vtkMarchingCubes::SetValue(int i, float value)
134 {this->ContourValues->SetValue(i,value);}
135
136 // Description:
137 // Get the ith contour value.
138 inline float vtkMarchingCubes::GetValue(int i)
139 {return this->ContourValues->GetValue(i);}
140
141 // Description:
142 // Get a pointer to an array of contour values. There will be
143 // GetNumberOfContours() values in the list.
144 inline float *vtkMarchingCubes::GetValues()
145 {return this->ContourValues->GetValues();}
146
147 // Description:
148 // Fill a supplied list with contour values. There will be
149 // GetNumberOfContours() values in the list. Make sure you allocate
150 // enough memory to hold the list.
151 inline void vtkMarchingCubes::GetValues(float *contourValues)
152 {this->ContourValues->GetValues(contourValues);}
153
154 // Description:
155 // Set the number of contours to place into the list. You only really
156 // need to use this method to reduce list size. The method SetValue()
157 // will automatically increase list size as needed.
158 inline void vtkMarchingCubes::SetNumberOfContours(int number)
159 {this->ContourValues->SetNumberOfContours(number);}
160
161 // Description:
162 // Get the number of contours in the list of contour values.
163 inline int vtkMarchingCubes::GetNumberOfContours()
164 {return this->ContourValues->GetNumberOfContours();}
165
166 // Description:
167 // Generate numContours equally spaced contour values between specified
168 // range. Contour values will include min/max range values.
169 inline void vtkMarchingCubes::GenerateValues(int numContours, float range[2])
170 {this->ContourValues->GenerateValues(numContours, range);}
171
172 // Description:
173 // Generate numContours equally spaced contour values between specified
174 // range. Contour values will include min/max range values.
175 inline void vtkMarchingCubes::GenerateValues(int numContours, float
176                                              rangeStart, float rangeEnd)
177 {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);}
178
179 #endif
180
181