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 =========================================================================*/
71 #ifndef vtkDataObjectToDataSetFilter_h
72 #define vtkDataObjectToDataSetFilter_h
73 
74 #include "vtkFiltersCoreModule.h" // For export macro
75 #include "vtkDataSetAlgorithm.h"
76 
77 class vtkCellArray;
78 class vtkDataArray;
79 class vtkDataSet;
80 class vtkPointSet;
81 class vtkPolyData;
82 class vtkRectilinearGrid;
83 class vtkStructuredGrid;
86 
87 class VTKFILTERSCORE_EXPORT vtkDataObjectToDataSetFilter : public vtkDataSetAlgorithm
88 {
89 public:
92  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
93 
98 
100 
103  void SetDataSetType(int);
104  vtkGetMacro(DataSetType,int);
106  this->SetDataSetType(VTK_POLY_DATA);};
108  this->SetDataSetType(VTK_STRUCTURED_POINTS);};
110  this->SetDataSetType(VTK_STRUCTURED_GRID);};
112  this->SetDataSetType(VTK_RECTILINEAR_GRID);};
114  this->SetDataSetType(VTK_UNSTRUCTURED_GRID);};
116 
118 
126  vtkDataSet *GetOutput(int idx);
133 
135 
147  void SetPointComponent(int comp, char *arrayName, int arrayComp,
148  int min, int max, int normalize);
149  void SetPointComponent(int comp, char *arrayName, int arrayComp)
150  {this->SetPointComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
151  const char *GetPointComponentArrayName(int comp);
152  int GetPointComponentArrayComponent(int comp);
153  int GetPointComponentMinRange(int comp);
154  int GetPointComponentMaxRange(int comp);
155  int GetPointComponentNormailzeFlag(int comp);
157 
159 
168  void SetVertsComponent(char *arrayName, int arrayComp, int min, int max);
169  void SetVertsComponent(char *arrayName, int arrayComp)
170  {this->SetVertsComponent(arrayName, arrayComp, -1, -1);};
171  const char *GetVertsComponentArrayName();
172  int GetVertsComponentArrayComponent();
173  int GetVertsComponentMinRange();
174  int GetVertsComponentMaxRange();
175  void SetLinesComponent(char *arrayName, int arrayComp, int min, int max);
176  void SetLinesComponent(char *arrayName, int arrayComp)
177  {this->SetLinesComponent(arrayName, arrayComp, -1, -1);};
178  const char *GetLinesComponentArrayName();
179  int GetLinesComponentArrayComponent();
180  int GetLinesComponentMinRange();
181  int GetLinesComponentMaxRange();
182  void SetPolysComponent(char *arrayName, int arrayComp, int min, int max);
183  void SetPolysComponent(char *arrayName, int arrayComp)
184  {this->SetPolysComponent(arrayName, arrayComp, -1, -1);};
185  const char *GetPolysComponentArrayName();
186  int GetPolysComponentArrayComponent();
187  int GetPolysComponentMinRange();
188  int GetPolysComponentMaxRange();
189  void SetStripsComponent(char *arrayName, int arrayComp, int min, int max);
190  void SetStripsComponent(char *arrayName, int arrayComp)
191  {this->SetStripsComponent(arrayName, arrayComp, -1, -1);};
192  const char *GetStripsComponentArrayName();
193  int GetStripsComponentArrayComponent();
194  int GetStripsComponentMinRange();
195  int GetStripsComponentMaxRange();
197 
199 
208  void SetCellTypeComponent(char *arrayName, int arrayComp,
209  int min, int max);
210  void SetCellTypeComponent(char *arrayName, int arrayComp)
211  {this->SetCellTypeComponent(arrayName, arrayComp, -1, -1);};
212  const char *GetCellTypeComponentArrayName();
213  int GetCellTypeComponentArrayComponent();
214  int GetCellTypeComponentMinRange();
215  int GetCellTypeComponentMaxRange();
216  void SetCellConnectivityComponent(char *arrayName, int arrayComp,
217  int min, int max);
218  void SetCellConnectivityComponent(char *arrayName, int arrayComp)
219  {this->SetCellConnectivityComponent(arrayName, arrayComp, -1, -1);};
220  const char *GetCellConnectivityComponentArrayName();
221  int GetCellConnectivityComponentArrayComponent();
222  int GetCellConnectivityComponentMinRange();
223  int GetCellConnectivityComponentMaxRange();
225 
227 
231  vtkSetMacro(DefaultNormalize,int);
232  vtkGetMacro(DefaultNormalize,int);
233  vtkBooleanMacro(DefaultNormalize,int);
235 
237 
242  vtkSetVector3Macro(Dimensions,int);
243  vtkGetVectorMacro(Dimensions,int,3);
245 
247 
251  vtkSetVector3Macro(Origin,double);
252  vtkGetVectorMacro(Origin,double,3);
254 
256 
260  vtkSetVector3Macro(Spacing,double);
261  vtkGetVectorMacro(Spacing,double,3);
263 
265 
271  void SetDimensionsComponent(char *arrayName, int arrayComp, int min, int max);
272  void SetDimensionsComponent(char *arrayName, int arrayComp)
273  {this->SetDimensionsComponent(arrayName, arrayComp, -1, -1);};
274  void SetSpacingComponent(char *arrayName, int arrayComp, int min, int max);
275  void SetSpacingComponent(char *arrayName, int arrayComp)
276  {this->SetSpacingComponent(arrayName, arrayComp, -1, -1);};
277  void SetOriginComponent(char *arrayName, int arrayComp, int min, int max);
278  void SetOriginComponent(char *arrayName, int arrayComp)
279  {this->SetOriginComponent(arrayName, arrayComp, -1, -1);};
281 
282 protected:
284  ~vtkDataObjectToDataSetFilter() VTK_OVERRIDE;
285 
286  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE; //generate output data
287  int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
288  int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
289  int FillInputPortInformation(int port, vtkInformation *info) VTK_OVERRIDE;
290  int RequestDataObject(vtkInformation *, vtkInformationVector **,
291  vtkInformationVector *) VTK_OVERRIDE;
292 
293  char Updating;
294 
295  // control flags used to generate the output dataset
296  int DataSetType; //the type of dataset to generate
297 
298  // Support definition of points
299  char *PointArrays[3]; //the name of the arrays
300  int PointArrayComponents[3]; //the array components used for x-y-z
301  vtkIdType PointComponentRange[3][2]; //the range of the components to use
302  int PointNormalize[3]; //flags control normalization
303 
304  // These define cells for vtkPolyData
305  char *VertsArray; //the name of the array
306  int VertsArrayComponent; //the array component
307  vtkIdType VertsComponentRange[2]; //the range of the components to use
308 
309  char *LinesArray; //the name of the array
310  int LinesArrayComponent; //the array component used for cell types
311  vtkIdType LinesComponentRange[2]; //the range of the components to use
312 
313  char *PolysArray; //the name of the array
314  int PolysArrayComponent; //the array component
315  vtkIdType PolysComponentRange[2]; //the range of the components to use
316 
317  char *StripsArray; //the name of the array
318  int StripsArrayComponent; //the array component
319  vtkIdType StripsComponentRange[2]; //the range of the components to use
320 
321  // Used to define vtkUnstructuredGrid datasets
322  char *CellTypeArray; //the name of the array
323  int CellTypeArrayComponent; //the array component used for cell types
324  vtkIdType CellTypeComponentRange[2]; //the range of the components to use
325 
326  char *CellConnectivityArray; //the name of the array
327  int CellConnectivityArrayComponent; //the array components used for cell connectivity
328  vtkIdType CellConnectivityComponentRange[2]; //the range of the components to use
329 
330  // helper methods (and attributes) to construct datasets
331  void SetArrayName(char* &name, char *newName);
332  vtkIdType ConstructPoints(vtkDataObject *input, vtkPointSet *ps);
333  vtkIdType ConstructPoints(vtkDataObject *input, vtkRectilinearGrid *rg);
334  int ConstructCells(vtkDataObject *input, vtkPolyData *pd);
335  int ConstructCells(vtkDataObject *input, vtkUnstructuredGrid *ug);
336  vtkCellArray *ConstructCellArray(vtkDataArray *da, int comp,
337  vtkIdType compRange[2]);
338 
339  // Default value for normalization
340  int DefaultNormalize;
341 
342  // Couple of different ways to specify dimensions, spacing, and origin.
343  int Dimensions[3];
344  double Origin[3];
345  double Spacing[3];
346 
347  char *DimensionsArray; //the name of the array
348  int DimensionsArrayComponent; //the component of the array used for dimensions
349  vtkIdType DimensionsComponentRange[2]; //the ComponentRange of the array for the dimensions
350 
351  char *OriginArray; //the name of the array
352  int OriginArrayComponent; //the component of the array used for Origins
353  vtkIdType OriginComponentRange[2]; //the ComponentRange of the array for the Origins
354 
355  char *SpacingArray; //the name of the array
356  int SpacingArrayComponent; //the component of the array used for Spacings
357  vtkIdType SpacingComponentRange[2]; //the ComponentRange of the array for the Spacings
358 
359  void ConstructDimensions(vtkDataObject *input);
360  void ConstructSpacing(vtkDataObject *input);
361  void ConstructOrigin(vtkDataObject *input);
362 
363 private:
365  void operator=(const vtkDataObjectToDataSetFilter&) VTK_DELETE_FUNCTION;
366 };
367 
368 #endif
vtkStructuredGrid * GetStructuredGridOutput()
Get the output as vtkStructuredGrid.
a dataset that is topologically regular with variable spacing in the three coordinate directions ...
void SetVertsComponent(char *arrayName, int arrayComp)
Define cell connectivity when creating vtkPolyData.
#define VTK_RECTILINEAR_GRID
Definition: vtkType.h:90
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
void SetCellConnectivityComponent(char *arrayName, int arrayComp)
Define cell types and cell connectivity when creating unstructured grid data.
vtkRectilinearGrid * GetRectilinearGridOutput()
Get the output as vtkRectilinearGrid.
void SetStripsComponent(char *arrayName, int arrayComp)
Define cell connectivity when creating vtkPolyData.
vtkUnstructuredGrid * GetUnstructuredGridOutput()
Get the output as vtkUnstructuredGrid.
abstract class for specifying dataset behavior
Definition: vtkPointSet.h:42
int vtkIdType
Definition: vtkType.h:287
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
#define VTK_STRUCTURED_POINTS
Definition: vtkType.h:88
void SetPointComponent(int comp, char *arrayName, int arrayComp)
Define the component of the field to be used for the x, y, and z values of the points.
void SetOriginComponent(char *arrayName, int arrayComp)
Alternative methods to specify the dimensions, spacing, and origin for those datasets requiring this ...
map field data to concrete dataset
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetDataSetTypeToStructuredGrid()
Control what type of data is generated for output.
void SetDataSetTypeToRectilinearGrid()
Control what type of data is generated for output.
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkDataSet * GetOutput()
Get the output data object for a port on this algorithm.
vtkDataObject * GetInput()
Get the input data object.
dataset represents arbitrary combinations of all possible cell types
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
void SetLinesComponent(char *arrayName, int arrayComp)
Define cell connectivity when creating vtkPolyData.
void SetDataSetTypeToUnstructuredGrid()
Control what type of data is generated for output.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
object to represent cell connectivity
Definition: vtkCellArray.h:50
vtkStructuredPoints * GetStructuredPointsOutput()
Get the output as vtkStructuredPoints.
A subclass of ImageData.
topologically regular array of data
void SetCellTypeComponent(char *arrayName, int arrayComp)
Define cell types and cell connectivity when creating unstructured grid data.
void SetSpacingComponent(char *arrayName, int arrayComp)
Alternative methods to specify the dimensions, spacing, and origin for those datasets requiring this ...
void SetDataSetTypeToStructuredPoints()
Control what type of data is generated for output.
void SetDataSetTypeToPolyData()
Control what type of data is generated for output.
Store zero or more vtkInformation instances.
void SetDimensionsComponent(char *arrayName, int arrayComp)
Alternative methods to specify the dimensions, spacing, and origin for those datasets requiring this ...
Superclass for algorithms that produce output of the same type as input.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
#define VTK_POLY_DATA
Definition: vtkType.h:87
general representation of visualization data
Definition: vtkDataObject.h:64
static vtkDataSetAlgorithm * New()
void SetPolysComponent(char *arrayName, int arrayComp)
Define cell connectivity when creating vtkPolyData.
#define VTK_STRUCTURED_GRID
Definition: vtkType.h:89
#define max(a, b)
#define VTK_UNSTRUCTURED_GRID
Definition: vtkType.h:91
vtkPolyData * GetPolyDataOutput()
Get the output as vtkPolyData.