66 #ifndef __vtkImageToPolyDataFilter_h
67 #define __vtkImageToPolyDataFilter_h
69 #include "vtkFiltersHybridModule.h"
70 #include "vtkPolyDataAlgorithm.h"
72 #define VTK_STYLE_PIXELIZE 0
73 #define VTK_STYLE_POLYGONALIZE 1
74 #define VTK_STYLE_RUN_LENGTH 2
76 #define VTK_COLOR_MODE_LUT 0
77 #define VTK_COLOR_MODE_LINEAR_256 1
84 class vtkScalarsToColors;
85 class vtkStructuredPoints;
87 class vtkUnsignedCharArray;
93 void PrintSelf(ostream& os, vtkIndent indent);
106 vtkGetMacro(OutputStyle,
int);
118 vtkGetMacro(ColorMode,
int);
128 virtual void SetLookupTable(vtkScalarsToColors*);
129 vtkGetObjectMacro(LookupTable,vtkScalarsToColors);
135 vtkSetMacro(Smoothing,
int);
136 vtkGetMacro(Smoothing,
int);
137 vtkBooleanMacro(Smoothing,
int);
143 vtkSetClampMacro(NumberOfSmoothingIterations,
int,0,VTK_INT_MAX);
144 vtkGetMacro(NumberOfSmoothingIterations,
int);
150 vtkSetMacro(Decimation,
int);
151 vtkGetMacro(Decimation,
int);
152 vtkBooleanMacro(Decimation,
int);
160 vtkSetClampMacro(DecimationError,
double,0.0,VTK_DOUBLE_MAX);
161 vtkGetMacro(DecimationError,
double);
168 vtkSetClampMacro(Error,
int,0,VTK_INT_MAX);
169 vtkGetMacro(Error,
int);
178 vtkSetClampMacro(SubImageSize,
int,10,VTK_INT_MAX);
179 vtkGetMacro(SubImageSize,
int);
186 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
187 virtual int FillInputPortInformation(
int port, vtkInformation *info);
199 virtual void PixelizeImage(vtkUnsignedCharArray *pixels,
int dims[3],
200 double origin[3],
double spacing[3],
201 vtkPolyData *output);
202 virtual void PolygonalizeImage(vtkUnsignedCharArray *pixels,
int dims[3],
203 double origin[3],
double spacing[3],
204 vtkPolyData *output);
205 virtual void RunLengthImage(vtkUnsignedCharArray *pixels,
int dims[3],
206 double origin[3],
double spacing[3],
207 vtkPolyData *output);
209 vtkUnsignedCharArray *Table;
210 vtkTimeStamp TableMTime;
212 vtkUnsignedCharArray *PolyColors;
213 vtkEdgeTable *EdgeTable;
214 vtkEdgeTable *EdgeUseTable;
215 vtkIntArray *EdgeUses;
220 void BuildTable(
unsigned char *inPixels);
221 vtkUnsignedCharArray *QuantizeImage(vtkDataArray *inScalars,
int numComp,
222 int type,
int dims[3],
int ext[4]);
223 int ProcessImage(vtkUnsignedCharArray *pixels,
int dims[2]);
224 int BuildEdges(vtkUnsignedCharArray *pixels,
int dims[3],
double origin[3],
225 double spacing[3], vtkUnsignedCharArray *pointDescr,
227 void BuildPolygons(vtkUnsignedCharArray *pointDescr, vtkPolyData *
edges,
228 int numPolys, vtkUnsignedCharArray *polyColors);
229 void SmoothEdges(vtkUnsignedCharArray *pointDescr, vtkPolyData *
edges);
230 void DecimateEdges(vtkPolyData *
edges, vtkUnsignedCharArray *pointDescr,
232 void GeneratePolygons(vtkPolyData *
edges,
int numPolys, vtkPolyData *output,
233 vtkUnsignedCharArray *polyColors,
234 vtkUnsignedCharArray *pointDescr);
236 int GetNeighbors(
unsigned char *ptr,
int &i,
int &j,
int dims[3],
237 unsigned char *neighbors[4],
int mode);
239 void GetIJ(
int id,
int &i,
int &j,
int dims[3]);
240 unsigned char *GetColor(
unsigned char *rgb);
241 int IsSameColor(
unsigned char *p1,
unsigned char *p2);
generate linear primitives (vtkPolyData) from an image
#define VTK_STYLE_RUN_LENGTH
vtksys_stl::pair< boost::graph_traits< vtkGraph * >::edge_iterator, boost::graph_traits< vtkGraph * >::edge_iterator > edges(vtkGraph *g)
#define VTK_STYLE_PIXELIZE
void SetColorModeToLinear256()
appends one or more polygonal datasets together
int NumberOfSmoothingIterations
void SetOutputStyleToRunLength()
#define VTK_STYLE_POLYGONALIZE
void SetOutputStyleToPixelize()
#define VTK_COLOR_MODE_LINEAR_256
#define VTK_COLOR_MODE_LUT
void SetOutputStyleToPolygonalize()
vtkScalarsToColors * LookupTable