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 =========================================================================*/
65 #ifndef vtkDataObjectToDataSetFilter_h
66 #define vtkDataObjectToDataSetFilter_h
67 
68 #include "vtkFiltersCoreModule.h" // For export macro
69 #include "vtkDataSetAlgorithm.h"
70 
71 class vtkCellArray;
72 class vtkDataArray;
73 class vtkDataSet;
74 class vtkPointSet;
75 class vtkPolyData;
76 class vtkRectilinearGrid;
77 class vtkStructuredGrid;
80 
81 class VTKFILTERSCORE_EXPORT vtkDataObjectToDataSetFilter : public vtkDataSetAlgorithm
82 {
83 public:
86  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
87 
92 
94 
97  void SetDataSetType(int);
98  vtkGetMacro(DataSetType,int);
100  this->SetDataSetType(VTK_POLY_DATA);};
102  this->SetDataSetType(VTK_STRUCTURED_POINTS);};
104  this->SetDataSetType(VTK_STRUCTURED_GRID);};
106  this->SetDataSetType(VTK_RECTILINEAR_GRID);};
108  this->SetDataSetType(VTK_UNSTRUCTURED_GRID);};
110 
112 
120  vtkDataSet *GetOutput(int idx);
127 
129 
141  void SetPointComponent(int comp, char *arrayName, int arrayComp,
142  int min, int max, int normalize);
143  void SetPointComponent(int comp, char *arrayName, int arrayComp)
144  {this->SetPointComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
145  const char *GetPointComponentArrayName(int comp);
146  int GetPointComponentArrayComponent(int comp);
147  int GetPointComponentMinRange(int comp);
148  int GetPointComponentMaxRange(int comp);
149  int GetPointComponentNormailzeFlag(int comp);
151 
153 
162  void SetVertsComponent(char *arrayName, int arrayComp, int min, int max);
163  void SetVertsComponent(char *arrayName, int arrayComp)
164  {this->SetVertsComponent(arrayName, arrayComp, -1, -1);};
165  const char *GetVertsComponentArrayName();
166  int GetVertsComponentArrayComponent();
167  int GetVertsComponentMinRange();
168  int GetVertsComponentMaxRange();
169  void SetLinesComponent(char *arrayName, int arrayComp, int min, int max);
170  void SetLinesComponent(char *arrayName, int arrayComp)
171  {this->SetLinesComponent(arrayName, arrayComp, -1, -1);};
172  const char *GetLinesComponentArrayName();
173  int GetLinesComponentArrayComponent();
174  int GetLinesComponentMinRange();
175  int GetLinesComponentMaxRange();
176  void SetPolysComponent(char *arrayName, int arrayComp, int min, int max);
177  void SetPolysComponent(char *arrayName, int arrayComp)
178  {this->SetPolysComponent(arrayName, arrayComp, -1, -1);};
179  const char *GetPolysComponentArrayName();
180  int GetPolysComponentArrayComponent();
181  int GetPolysComponentMinRange();
182  int GetPolysComponentMaxRange();
183  void SetStripsComponent(char *arrayName, int arrayComp, int min, int max);
184  void SetStripsComponent(char *arrayName, int arrayComp)
185  {this->SetStripsComponent(arrayName, arrayComp, -1, -1);};
186  const char *GetStripsComponentArrayName();
187  int GetStripsComponentArrayComponent();
188  int GetStripsComponentMinRange();
189  int GetStripsComponentMaxRange();
191 
193 
202  void SetCellTypeComponent(char *arrayName, int arrayComp,
203  int min, int max);
204  void SetCellTypeComponent(char *arrayName, int arrayComp)
205  {this->SetCellTypeComponent(arrayName, arrayComp, -1, -1);};
206  const char *GetCellTypeComponentArrayName();
207  int GetCellTypeComponentArrayComponent();
208  int GetCellTypeComponentMinRange();
209  int GetCellTypeComponentMaxRange();
210  void SetCellConnectivityComponent(char *arrayName, int arrayComp,
211  int min, int max);
212  void SetCellConnectivityComponent(char *arrayName, int arrayComp)
213  {this->SetCellConnectivityComponent(arrayName, arrayComp, -1, -1);};
214  const char *GetCellConnectivityComponentArrayName();
215  int GetCellConnectivityComponentArrayComponent();
216  int GetCellConnectivityComponentMinRange();
217  int GetCellConnectivityComponentMaxRange();
219 
221 
225  vtkSetMacro(DefaultNormalize,int);
226  vtkGetMacro(DefaultNormalize,int);
227  vtkBooleanMacro(DefaultNormalize,int);
229 
231 
236  vtkSetVector3Macro(Dimensions,int);
237  vtkGetVectorMacro(Dimensions,int,3);
239 
241 
245  vtkSetVector3Macro(Origin,double);
246  vtkGetVectorMacro(Origin,double,3);
248 
250 
254  vtkSetVector3Macro(Spacing,double);
255  vtkGetVectorMacro(Spacing,double,3);
257 
259 
265  void SetDimensionsComponent(char *arrayName, int arrayComp, int min, int max);
266  void SetDimensionsComponent(char *arrayName, int arrayComp)
267  {this->SetDimensionsComponent(arrayName, arrayComp, -1, -1);};
268  void SetSpacingComponent(char *arrayName, int arrayComp, int min, int max);
269  void SetSpacingComponent(char *arrayName, int arrayComp)
270  {this->SetSpacingComponent(arrayName, arrayComp, -1, -1);};
271  void SetOriginComponent(char *arrayName, int arrayComp, int min, int max);
272  void SetOriginComponent(char *arrayName, int arrayComp)
273  {this->SetOriginComponent(arrayName, arrayComp, -1, -1);};
275 
276 protected:
278  ~vtkDataObjectToDataSetFilter() VTK_OVERRIDE;
279 
280  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE; //generate output data
283  int FillInputPortInformation(int port, vtkInformation *info) VTK_OVERRIDE;
285  vtkInformationVector *) VTK_OVERRIDE;
286 
287  char Updating;
288 
289  // control flags used to generate the output dataset
290  int DataSetType; //the type of dataset to generate
291 
292  // Support definition of points
293  char *PointArrays[3]; //the name of the arrays
294  int PointArrayComponents[3]; //the array components used for x-y-z
295  vtkIdType PointComponentRange[3][2]; //the range of the components to use
296  int PointNormalize[3]; //flags control normalization
297 
298  // These define cells for vtkPolyData
299  char *VertsArray; //the name of the array
300  int VertsArrayComponent; //the array component
301  vtkIdType VertsComponentRange[2]; //the range of the components to use
302 
303  char *LinesArray; //the name of the array
304  int LinesArrayComponent; //the array component used for cell types
305  vtkIdType LinesComponentRange[2]; //the range of the components to use
306 
307  char *PolysArray; //the name of the array
308  int PolysArrayComponent; //the array component
309  vtkIdType PolysComponentRange[2]; //the range of the components to use
310 
311  char *StripsArray; //the name of the array
312  int StripsArrayComponent; //the array component
313  vtkIdType StripsComponentRange[2]; //the range of the components to use
314 
315  // Used to define vtkUnstructuredGrid datasets
316  char *CellTypeArray; //the name of the array
317  int CellTypeArrayComponent; //the array component used for cell types
318  vtkIdType CellTypeComponentRange[2]; //the range of the components to use
319 
320  char *CellConnectivityArray; //the name of the array
321  int CellConnectivityArrayComponent; //the array components used for cell connectivity
322  vtkIdType CellConnectivityComponentRange[2]; //the range of the components to use
323 
324  // helper methods (and attributes) to construct datasets
325  void SetArrayName(char* &name, char *newName);
326  vtkIdType ConstructPoints(vtkDataObject *input, vtkPointSet *ps);
327  vtkIdType ConstructPoints(vtkDataObject *input, vtkRectilinearGrid *rg);
328  int ConstructCells(vtkDataObject *input, vtkPolyData *pd);
329  int ConstructCells(vtkDataObject *input, vtkUnstructuredGrid *ug);
330  vtkCellArray *ConstructCellArray(vtkDataArray *da, int comp,
331  vtkIdType compRange[2]);
332 
333  // Default value for normalization
335 
336  // Couple of different ways to specify dimensions, spacing, and origin.
337  int Dimensions[3];
338  double Origin[3];
339  double Spacing[3];
340 
341  char *DimensionsArray; //the name of the array
342  int DimensionsArrayComponent; //the component of the array used for dimensions
343  vtkIdType DimensionsComponentRange[2]; //the ComponentRange of the array for the dimensions
344 
345  char *OriginArray; //the name of the array
346  int OriginArrayComponent; //the component of the array used for Origins
347  vtkIdType OriginComponentRange[2]; //the ComponentRange of the array for the Origins
348 
349  char *SpacingArray; //the name of the array
350  int SpacingArrayComponent; //the component of the array used for Spacings
351  vtkIdType SpacingComponentRange[2]; //the ComponentRange of the array for the Spacings
352 
353  void ConstructDimensions(vtkDataObject *input);
354  void ConstructSpacing(vtkDataObject *input);
355  void ConstructOrigin(vtkDataObject *input);
356 
357 private:
359  void operator=(const vtkDataObjectToDataSetFilter&) VTK_DELETE_FUNCTION;
360 };
361 
362 #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:94
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
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:39
int vtkIdType
Definition: vtkType.h:345
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
#define VTK_STRUCTURED_POINTS
Definition: vtkType.h:92
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:33
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:48
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when a request asks the algorithm to do its work.
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:44
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when each filter in the pipeline decides what portion of its inp...
vtkStructuredPoints * GetStructuredPointsOutput()
Get the output as vtkStructuredPoints.
A subclass of ImageData.
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when a request asks for Information.
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.
virtual int RequestDataObject(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called within ProcessRequest to when a request asks the algorithm to create empty output data...
#define VTK_POLY_DATA
Definition: vtkType.h:91
general representation of visualization data
Definition: vtkDataObject.h:58
static vtkDataSetAlgorithm * New()
void SetPolysComponent(char *arrayName, int arrayComp)
Define cell connectivity when creating vtkPolyData.
#define VTK_STRUCTURED_GRID
Definition: vtkType.h:93
#define max(a, b)
#define VTK_UNSTRUCTURED_GRID
Definition: vtkType.h:95
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkPolyData * GetPolyDataOutput()
Get the output as vtkPolyData.