VTK  9.3.1
vtkDataObjectToDataSetFilter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
56 #ifndef vtkDataObjectToDataSetFilter_h
57 #define vtkDataObjectToDataSetFilter_h
58 
59 #include "vtkDataSetAlgorithm.h"
60 #include "vtkFiltersCoreModule.h" // For export macro
61 
62 VTK_ABI_NAMESPACE_BEGIN
63 class vtkCellArray;
64 class vtkDataArray;
65 class vtkDataSet;
66 class vtkPointSet;
67 class vtkPolyData;
68 class vtkRectilinearGrid;
69 class vtkStructuredGrid;
72 
73 class VTKFILTERSCORE_EXPORT vtkDataObjectToDataSetFilter : public vtkDataSetAlgorithm
74 {
75 public:
78  void PrintSelf(ostream& os, vtkIndent indent) override;
79 
84 
86 
89  void SetDataSetType(int);
90  vtkGetMacro(DataSetType, int);
91  void SetDataSetTypeToPolyData() { this->SetDataSetType(VTK_POLY_DATA); }
92  void SetDataSetTypeToStructuredPoints() { this->SetDataSetType(VTK_STRUCTURED_POINTS); }
93  void SetDataSetTypeToStructuredGrid() { this->SetDataSetType(VTK_STRUCTURED_GRID); }
94  void SetDataSetTypeToRectilinearGrid() { this->SetDataSetType(VTK_RECTILINEAR_GRID); }
95  void SetDataSetTypeToUnstructuredGrid() { this->SetDataSetType(VTK_UNSTRUCTURED_GRID); }
97 
99 
107  vtkDataSet* GetOutput(int idx);
114 
116 
128  void SetPointComponent(
129  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
130  void SetPointComponent(int comp, const char* arrayName, int arrayComp)
131  {
132  this->SetPointComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
133  }
134  const char* GetPointComponentArrayName(int comp);
135  int GetPointComponentArrayComponent(int comp);
136  int GetPointComponentMinRange(int comp);
137  int GetPointComponentMaxRange(int comp);
138  int GetPointComponentNormailzeFlag(int comp);
140 
142 
151  void SetVertsComponent(const char* arrayName, int arrayComp, int min, int max);
152  void SetVertsComponent(const char* arrayName, int arrayComp)
153  {
154  this->SetVertsComponent(arrayName, arrayComp, -1, -1);
155  }
156  const char* GetVertsComponentArrayName();
157  int GetVertsComponentArrayComponent();
158  int GetVertsComponentMinRange();
159  int GetVertsComponentMaxRange();
160  void SetLinesComponent(const char* arrayName, int arrayComp, int min, int max);
161  void SetLinesComponent(const char* arrayName, int arrayComp)
162  {
163  this->SetLinesComponent(arrayName, arrayComp, -1, -1);
164  }
165  const char* GetLinesComponentArrayName();
166  int GetLinesComponentArrayComponent();
167  int GetLinesComponentMinRange();
168  int GetLinesComponentMaxRange();
169  void SetPolysComponent(const char* arrayName, int arrayComp, int min, int max);
170  void SetPolysComponent(const char* arrayName, int arrayComp)
171  {
172  this->SetPolysComponent(arrayName, arrayComp, -1, -1);
173  }
174  const char* GetPolysComponentArrayName();
175  int GetPolysComponentArrayComponent();
176  int GetPolysComponentMinRange();
177  int GetPolysComponentMaxRange();
178  void SetStripsComponent(const char* arrayName, int arrayComp, int min, int max);
179  void SetStripsComponent(const char* arrayName, int arrayComp)
180  {
181  this->SetStripsComponent(arrayName, arrayComp, -1, -1);
182  }
183  const char* GetStripsComponentArrayName();
184  int GetStripsComponentArrayComponent();
185  int GetStripsComponentMinRange();
186  int GetStripsComponentMaxRange();
188 
190 
199  void SetCellTypeComponent(const char* arrayName, int arrayComp, int min, int max);
200  void SetCellTypeComponent(const char* arrayName, int arrayComp)
201  {
202  this->SetCellTypeComponent(arrayName, arrayComp, -1, -1);
203  }
204  const char* GetCellTypeComponentArrayName();
205  int GetCellTypeComponentArrayComponent();
206  int GetCellTypeComponentMinRange();
207  int GetCellTypeComponentMaxRange();
208  void SetCellConnectivityComponent(const char* arrayName, int arrayComp, int min, int max);
209  void SetCellConnectivityComponent(const char* arrayName, int arrayComp)
210  {
211  this->SetCellConnectivityComponent(arrayName, arrayComp, -1, -1);
212  }
213  const char* GetCellConnectivityComponentArrayName();
214  int GetCellConnectivityComponentArrayComponent();
215  int GetCellConnectivityComponentMinRange();
216  int GetCellConnectivityComponentMaxRange();
218 
220 
224  vtkSetMacro(DefaultNormalize, vtkTypeBool);
225  vtkGetMacro(DefaultNormalize, vtkTypeBool);
226  vtkBooleanMacro(DefaultNormalize, vtkTypeBool);
228 
230 
235  vtkSetVector3Macro(Dimensions, int);
236  vtkGetVectorMacro(Dimensions, int, 3);
238 
240 
244  vtkSetVector3Macro(Origin, double);
245  vtkGetVectorMacro(Origin, double, 3);
247 
249 
253  vtkSetVector3Macro(Spacing, double);
254  vtkGetVectorMacro(Spacing, double, 3);
256 
258 
264  void SetDimensionsComponent(const char* arrayName, int arrayComp, int min, int max);
265  void SetDimensionsComponent(const char* arrayName, int arrayComp)
266  {
267  this->SetDimensionsComponent(arrayName, arrayComp, -1, -1);
268  }
269  void SetSpacingComponent(const char* arrayName, int arrayComp, int min, int max);
270  void SetSpacingComponent(const char* arrayName, int arrayComp)
271  {
272  this->SetSpacingComponent(arrayName, arrayComp, -1, -1);
273  }
274  void SetOriginComponent(const char* arrayName, int arrayComp, int min, int max);
275  void SetOriginComponent(const char* arrayName, int arrayComp)
276  {
277  this->SetOriginComponent(arrayName, arrayComp, -1, -1);
278  }
280 
281 protected:
283  ~vtkDataObjectToDataSetFilter() override;
284 
286  vtkInformationVector*) override; // generate output data
289  int FillInputPortInformation(int port, vtkInformation* info) override;
291 
292  char Updating;
293 
294  // control flags used to generate the output dataset
295  int DataSetType; // the type of dataset to generate
296 
297  // Support definition of points
298  char* PointArrays[3]; // the name of the arrays
299  int PointArrayComponents[3]; // the array components used for x-y-z
300  vtkIdType PointComponentRange[3][2]; // the range of the components to use
301  int PointNormalize[3]; // flags control normalization
302 
303  // These define cells for vtkPolyData
304  char* VertsArray; // the name of the array
305  int VertsArrayComponent; // the array component
306  vtkIdType VertsComponentRange[2]; // the range of the components to use
307 
308  char* LinesArray; // the name of the array
309  int LinesArrayComponent; // the array component used for cell types
310  vtkIdType LinesComponentRange[2]; // the range of the components to use
311 
312  char* PolysArray; // the name of the array
313  int PolysArrayComponent; // the array component
314  vtkIdType PolysComponentRange[2]; // the range of the components to use
315 
316  char* StripsArray; // the name of the array
317  int StripsArrayComponent; // the array component
318  vtkIdType StripsComponentRange[2]; // the range of the components to use
319 
320  // Used to define vtkUnstructuredGrid datasets
321  char* CellTypeArray; // the name of the array
322  int CellTypeArrayComponent; // the array component used for cell types
323  vtkIdType CellTypeComponentRange[2]; // the range of the components to use
324 
325  char* CellConnectivityArray; // the name of the array
326  int CellConnectivityArrayComponent; // the array components used for cell connectivity
327  vtkIdType CellConnectivityComponentRange[2]; // the range of the components to use
328 
329  // helper methods (and attributes) to construct datasets
330  void SetArrayName(char*& name, char* newName);
331  vtkIdType ConstructPoints(vtkDataObject* input, vtkPointSet* ps);
332  vtkIdType ConstructPoints(vtkDataObject* input, vtkRectilinearGrid* rg);
333  int ConstructCells(vtkDataObject* input, vtkPolyData* pd);
334  int ConstructCells(vtkDataObject* input, vtkUnstructuredGrid* ug);
335  vtkCellArray* ConstructCellArray(vtkDataArray* da, int comp, vtkIdType compRange[2]);
336 
337  // Default value for normalization
339 
340  // Couple of different ways to specify dimensions, spacing, and origin.
341  int Dimensions[3];
342  double Origin[3];
343  double Spacing[3];
344 
345  char* DimensionsArray; // the name of the array
346  int DimensionsArrayComponent; // the component of the array used for dimensions
347  vtkIdType DimensionsComponentRange[2]; // the ComponentRange of the array for the dimensions
348 
349  char* OriginArray; // the name of the array
350  int OriginArrayComponent; // the component of the array used for Origins
351  vtkIdType OriginComponentRange[2]; // the ComponentRange of the array for the Origins
352 
353  char* SpacingArray; // the name of the array
354  int SpacingArrayComponent; // the component of the array used for Spacings
355  vtkIdType SpacingComponentRange[2]; // the ComponentRange of the array for the Spacings
356 
357  void ConstructDimensions(vtkDataObject* input);
358  void ConstructSpacing(vtkDataObject* input);
359  void ConstructOrigin(vtkDataObject* input);
360 
361 private:
363  void operator=(const vtkDataObjectToDataSetFilter&) = delete;
364 };
365 
366 VTK_ABI_NAMESPACE_END
367 #endif
vtkStructuredGrid * GetStructuredGridOutput()
Get the output as vtkStructuredGrid.
a dataset that is topologically regular with variable spacing in the three coordinate directions ...
#define VTK_RECTILINEAR_GRID
Definition: vtkType.h:68
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:52
void SetCellConnectivityComponent(const char *arrayName, int arrayComp)
Define cell types and cell connectivity when creating unstructured grid data.
vtkRectilinearGrid * GetRectilinearGridOutput()
Get the output as vtkRectilinearGrid.
vtkUnstructuredGrid * GetUnstructuredGridOutput()
Get the output as vtkUnstructuredGrid.
concrete class for storing a set of points
Definition: vtkPointSet.h:58
int vtkIdType
Definition: vtkType.h:315
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
#define VTK_STRUCTURED_POINTS
Definition: vtkType.h:66
void SetStripsComponent(const char *arrayName, int arrayComp)
Define cell connectivity when creating vtkPolyData.
void SetDimensionsComponent(const char *arrayName, int arrayComp)
Alternative methods to specify the dimensions, spacing, and origin for those datasets requiring this ...
int vtkTypeBool
Definition: vtkABI.h:64
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:28
vtkDataSet * GetOutput()
Get the output data object for a port on this algorithm.
vtkDataObject * GetInput()
Get the input data object.
void SetSpacingComponent(const char *arrayName, int arrayComp)
Alternative methods to specify the dimensions, spacing, and origin for those datasets requiring this ...
dataset represents arbitrary combinations of all possible cell types
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when a request asks the algorithm to do its work.
void SetDataSetTypeToUnstructuredGrid()
Control what type of data is generated for output.
void SetVertsComponent(const char *arrayName, int arrayComp)
Define cell connectivity when creating vtkPolyData.
void SetPointComponent(int comp, const char *arrayName, int arrayComp)
Define the component of the field to be used for the x, y, and z values of the points.
object to represent cell connectivity
Definition: vtkCellArray.h:175
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 SetDataSetTypeToStructuredPoints()
Control what type of data is generated for output.
void SetPolysComponent(const char *arrayName, int arrayComp)
Define cell connectivity when creating vtkPolyData.
void SetDataSetTypeToPolyData()
Control what type of data is generated for output.
Store zero or more vtkInformation instances.
Superclass for algorithms that produce output of the same type as input.
virtual int RequestDataObject(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called within ProcessRequest when a request asks the algorithm to create empty output data ob...
void SetOriginComponent(const char *arrayName, int arrayComp)
Alternative methods to specify the dimensions, spacing, and origin for those datasets requiring this ...
#define VTK_POLY_DATA
Definition: vtkType.h:65
general representation of visualization data
Definition: vtkDataObject.h:54
static vtkDataSetAlgorithm * New()
void SetCellTypeComponent(const char *arrayName, int arrayComp)
Define cell types and cell connectivity when creating unstructured grid data.
void SetLinesComponent(const char *arrayName, int arrayComp)
Define cell connectivity when creating vtkPolyData.
#define VTK_STRUCTURED_GRID
Definition: vtkType.h:67
#define max(a, b)
#define VTK_UNSTRUCTURED_GRID
Definition: vtkType.h:69
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkPolyData * GetPolyDataOutput()
Get the output as vtkPolyData.