VTK
vtkDataObjectToDataSetFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDataObjectToDataSetFilter.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
70 #ifndef vtkDataObjectToDataSetFilter_h
71 #define vtkDataObjectToDataSetFilter_h
72 
73 #include "vtkFiltersCoreModule.h" // For export macro
74 #include "vtkDataSetAlgorithm.h"
75 
76 class vtkCellArray;
77 class vtkDataArray;
78 class vtkDataSet;
79 class vtkPointSet;
80 class vtkPolyData;
81 class vtkRectilinearGrid;
82 class vtkStructuredGrid;
85 
87 {
88 public:
91  void PrintSelf(ostream& os, vtkIndent indent);
92 
95 
97 
98  void SetDataSetType(int);
99  vtkGetMacro(DataSetType,int);
101  this->SetDataSetType(VTK_POLY_DATA);};
103  this->SetDataSetType(VTK_STRUCTURED_POINTS);};
105  this->SetDataSetType(VTK_STRUCTURED_GRID);};
107  this->SetDataSetType(VTK_RECTILINEAR_GRID);};
109  this->SetDataSetType(VTK_UNSTRUCTURED_GRID);};
111 
113 
119  vtkDataSet *GetOutput(int idx);
126 
128 
139  void SetPointComponent(int comp, char *arrayName, int arrayComp,
140  int min, int max, int normalize);
141  void SetPointComponent(int comp, char *arrayName, int arrayComp)
142  {this->SetPointComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
143  const char *GetPointComponentArrayName(int comp);
144  int GetPointComponentArrayComponent(int comp);
145  int GetPointComponentMinRange(int comp);
146  int GetPointComponentMaxRange(int comp);
147  int GetPointComponentNormailzeFlag(int comp);
149 
151 
158  void SetVertsComponent(char *arrayName, int arrayComp, int min, int max);
159  void SetVertsComponent(char *arrayName, int arrayComp)
160  {this->SetVertsComponent(arrayName, arrayComp, -1, -1);};
161  const char *GetVertsComponentArrayName();
162  int GetVertsComponentArrayComponent();
163  int GetVertsComponentMinRange();
164  int GetVertsComponentMaxRange();
165  void SetLinesComponent(char *arrayName, int arrayComp, int min, int max);
166  void SetLinesComponent(char *arrayName, int arrayComp)
167  {this->SetLinesComponent(arrayName, arrayComp, -1, -1);};
168  const char *GetLinesComponentArrayName();
169  int GetLinesComponentArrayComponent();
170  int GetLinesComponentMinRange();
171  int GetLinesComponentMaxRange();
172  void SetPolysComponent(char *arrayName, int arrayComp, int min, int max);
173  void SetPolysComponent(char *arrayName, int arrayComp)
174  {this->SetPolysComponent(arrayName, arrayComp, -1, -1);};
175  const char *GetPolysComponentArrayName();
176  int GetPolysComponentArrayComponent();
177  int GetPolysComponentMinRange();
178  int GetPolysComponentMaxRange();
179  void SetStripsComponent(char *arrayName, int arrayComp, int min, int max);
180  void SetStripsComponent(char *arrayName, int arrayComp)
181  {this->SetStripsComponent(arrayName, arrayComp, -1, -1);};
182  const char *GetStripsComponentArrayName();
183  int GetStripsComponentArrayComponent();
184  int GetStripsComponentMinRange();
185  int GetStripsComponentMaxRange();
187 
189 
196  void SetCellTypeComponent(char *arrayName, int arrayComp,
197  int min, int max);
198  void SetCellTypeComponent(char *arrayName, int arrayComp)
199  {this->SetCellTypeComponent(arrayName, arrayComp, -1, -1);};
200  const char *GetCellTypeComponentArrayName();
201  int GetCellTypeComponentArrayComponent();
202  int GetCellTypeComponentMinRange();
203  int GetCellTypeComponentMaxRange();
204  void SetCellConnectivityComponent(char *arrayName, int arrayComp,
205  int min, int max);
206  void SetCellConnectivityComponent(char *arrayName, int arrayComp)
207  {this->SetCellConnectivityComponent(arrayName, arrayComp, -1, -1);};
208  const char *GetCellConnectivityComponentArrayName();
209  int GetCellConnectivityComponentArrayComponent();
210  int GetCellConnectivityComponentMinRange();
211  int GetCellConnectivityComponentMaxRange();
213 
215 
217  vtkSetMacro(DefaultNormalize,int);
218  vtkGetMacro(DefaultNormalize,int);
219  vtkBooleanMacro(DefaultNormalize,int);
221 
223 
226  vtkSetVector3Macro(Dimensions,int);
227  vtkGetVectorMacro(Dimensions,int,3);
229 
231 
233  vtkSetVector3Macro(Origin,double);
234  vtkGetVectorMacro(Origin,double,3);
236 
238 
240  vtkSetVector3Macro(Spacing,double);
241  vtkGetVectorMacro(Spacing,double,3);
243 
245 
250  void SetDimensionsComponent(char *arrayName, int arrayComp, int min, int max);
251  void SetDimensionsComponent(char *arrayName, int arrayComp)
252  {this->SetDimensionsComponent(arrayName, arrayComp, -1, -1);};
253  void SetSpacingComponent(char *arrayName, int arrayComp, int min, int max);
254  void SetSpacingComponent(char *arrayName, int arrayComp)
255  {this->SetSpacingComponent(arrayName, arrayComp, -1, -1);};
256  void SetOriginComponent(char *arrayName, int arrayComp, int min, int max);
257  void SetOriginComponent(char *arrayName, int arrayComp)
258  {this->SetOriginComponent(arrayName, arrayComp, -1, -1);};
260 
261 protected:
264 
265  virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); //generate output data
271 
272  char Updating;
273 
274  // control flags used to generate the output dataset
275  int DataSetType; //the type of dataset to generate
276 
277  // Support definition of points
278  char *PointArrays[3]; //the name of the arrays
279  int PointArrayComponents[3]; //the array components used for x-y-z
280  vtkIdType PointComponentRange[3][2]; //the range of the components to use
281  int PointNormalize[3]; //flags control normalization
282 
283  // These define cells for vtkPolyData
284  char *VertsArray; //the name of the array
285  int VertsArrayComponent; //the array component
286  vtkIdType VertsComponentRange[2]; //the range of the components to use
287 
288  char *LinesArray; //the name of the array
289  int LinesArrayComponent; //the array component used for cell types
290  vtkIdType LinesComponentRange[2]; //the range of the components to use
291 
292  char *PolysArray; //the name of the array
293  int PolysArrayComponent; //the array component
294  vtkIdType PolysComponentRange[2]; //the range of the components to use
295 
296  char *StripsArray; //the name of the array
297  int StripsArrayComponent; //the array component
298  vtkIdType StripsComponentRange[2]; //the range of the components to use
299 
300  // Used to define vtkUnstructuredGrid datasets
301  char *CellTypeArray; //the name of the array
302  int CellTypeArrayComponent; //the array component used for cell types
303  vtkIdType CellTypeComponentRange[2]; //the range of the components to use
304 
305  char *CellConnectivityArray; //the name of the array
306  int CellConnectivityArrayComponent; //the array components used for cell connectivity
307  vtkIdType CellConnectivityComponentRange[2]; //the range of the components to use
308 
309  // helper methods (and attributes) to construct datasets
310  void SetArrayName(char* &name, char *newName);
311  vtkIdType ConstructPoints(vtkDataObject *input, vtkPointSet *ps);
312  vtkIdType ConstructPoints(vtkDataObject *input, vtkRectilinearGrid *rg);
313  int ConstructCells(vtkDataObject *input, vtkPolyData *pd);
314  int ConstructCells(vtkDataObject *input, vtkUnstructuredGrid *ug);
315  vtkCellArray *ConstructCellArray(vtkDataArray *da, int comp,
316  vtkIdType compRange[2]);
317 
318  // Default value for normalization
320 
321  // Couple of different ways to specify dimensions, spacing, and origin.
322  int Dimensions[3];
323  double Origin[3];
324  double Spacing[3];
325 
326  char *DimensionsArray; //the name of the array
327  int DimensionsArrayComponent; //the component of the array used for dimensions
328  vtkIdType DimensionsComponentRange[2]; //the ComponentRange of the array for the dimensions
329 
330  char *OriginArray; //the name of the array
331  int OriginArrayComponent; //the component of the array used for Origins
332  vtkIdType OriginComponentRange[2]; //the ComponentRange of the array for the Origins
333 
334  char *SpacingArray; //the name of the array
335  int SpacingArrayComponent; //the component of the array used for Spacings
336  vtkIdType SpacingComponentRange[2]; //the ComponentRange of the array for the Spacings
337 
338  void ConstructDimensions(vtkDataObject *input);
339  void ConstructSpacing(vtkDataObject *input);
340  void ConstructOrigin(vtkDataObject *input);
341 
342 private:
344  void operator=(const vtkDataObjectToDataSetFilter&); // Not implemented.
345 };
346 
347 #endif
virtual int FillInputPortInformation(int port, vtkInformation *info)
vtkStructuredGrid * GetStructuredGridOutput()
a dataset that is topologically regular with variable spacing in the three coordinate directions ...
void SetVertsComponent(char *arrayName, int arrayComp)
#define VTK_RECTILINEAR_GRID
Definition: vtkType.h:69
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:61
void SetCellConnectivityComponent(char *arrayName, int arrayComp)
vtkRectilinearGrid * GetRectilinearGridOutput()
#define VTKFILTERSCORE_EXPORT
void SetStripsComponent(char *arrayName, int arrayComp)
vtkUnstructuredGrid * GetUnstructuredGridOutput()
abstract class for specifying dataset behavior
Definition: vtkPointSet.h:44
int vtkIdType
Definition: vtkType.h:275
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:83
#define VTK_STRUCTURED_POINTS
Definition: vtkType.h:67
void SetPointComponent(int comp, char *arrayName, int arrayComp)
void SetOriginComponent(char *arrayName, int arrayComp)
map field data to concrete dataset
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkDataSet * GetOutput()
vtkDataObject * GetInput()
dataset represents arbitrary combinations of all possible cell types
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
void SetLinesComponent(char *arrayName, int arrayComp)
object to represent cell connectivity
Definition: vtkCellArray.h:49
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
vtkStructuredPoints * GetStructuredPointsOutput()
A subclass of ImageData.
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
topologically regular array of data
void SetCellTypeComponent(char *arrayName, int arrayComp)
void SetSpacingComponent(char *arrayName, int arrayComp)
Store zero or more vtkInformation instances.
void SetDimensionsComponent(char *arrayName, int arrayComp)
void PrintSelf(ostream &os, vtkIndent indent)
Superclass for algorithms that produce output of the same type as input.
virtual int RequestDataObject(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
#define VTK_POLY_DATA
Definition: vtkType.h:66
general representation of visualization data
Definition: vtkDataObject.h:64
static vtkDataSetAlgorithm * New()
void SetPolysComponent(char *arrayName, int arrayComp)
#define VTK_STRUCTURED_GRID
Definition: vtkType.h:68
#define max(a, b)
#define VTK_UNSTRUCTURED_GRID
Definition: vtkType.h:70
vtkPolyData * GetPolyDataOutput()