VTK  9.2.6
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 =========================================================================*/
68 #ifndef vtkDataObjectToDataSetFilter_h
69 #define vtkDataObjectToDataSetFilter_h
70 
71 #include "vtkDataSetAlgorithm.h"
72 #include "vtkFiltersCoreModule.h" // For export macro
73 
74 class vtkCellArray;
75 class vtkDataArray;
76 class vtkDataSet;
77 class vtkPointSet;
78 class vtkPolyData;
79 class vtkRectilinearGrid;
80 class vtkStructuredGrid;
83 
84 class VTKFILTERSCORE_EXPORT vtkDataObjectToDataSetFilter : public vtkDataSetAlgorithm
85 {
86 public:
89  void PrintSelf(ostream& os, vtkIndent indent) override;
90 
95 
97 
100  void SetDataSetType(int);
101  vtkGetMacro(DataSetType, int);
102  void SetDataSetTypeToPolyData() { this->SetDataSetType(VTK_POLY_DATA); }
103  void SetDataSetTypeToStructuredPoints() { this->SetDataSetType(VTK_STRUCTURED_POINTS); }
104  void SetDataSetTypeToStructuredGrid() { this->SetDataSetType(VTK_STRUCTURED_GRID); }
105  void SetDataSetTypeToRectilinearGrid() { this->SetDataSetType(VTK_RECTILINEAR_GRID); }
106  void SetDataSetTypeToUnstructuredGrid() { this->SetDataSetType(VTK_UNSTRUCTURED_GRID); }
108 
110 
118  vtkDataSet* GetOutput(int idx);
125 
127 
139  void SetPointComponent(
140  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
141  void SetPointComponent(int comp, const char* arrayName, int arrayComp)
142  {
143  this->SetPointComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
144  }
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(const char* arrayName, int arrayComp, int min, int max);
163  void SetVertsComponent(const char* arrayName, int arrayComp)
164  {
165  this->SetVertsComponent(arrayName, arrayComp, -1, -1);
166  }
167  const char* GetVertsComponentArrayName();
168  int GetVertsComponentArrayComponent();
169  int GetVertsComponentMinRange();
170  int GetVertsComponentMaxRange();
171  void SetLinesComponent(const char* arrayName, int arrayComp, int min, int max);
172  void SetLinesComponent(const char* arrayName, int arrayComp)
173  {
174  this->SetLinesComponent(arrayName, arrayComp, -1, -1);
175  }
176  const char* GetLinesComponentArrayName();
177  int GetLinesComponentArrayComponent();
178  int GetLinesComponentMinRange();
179  int GetLinesComponentMaxRange();
180  void SetPolysComponent(const char* arrayName, int arrayComp, int min, int max);
181  void SetPolysComponent(const char* arrayName, int arrayComp)
182  {
183  this->SetPolysComponent(arrayName, arrayComp, -1, -1);
184  }
185  const char* GetPolysComponentArrayName();
186  int GetPolysComponentArrayComponent();
187  int GetPolysComponentMinRange();
188  int GetPolysComponentMaxRange();
189  void SetStripsComponent(const char* arrayName, int arrayComp, int min, int max);
190  void SetStripsComponent(const char* arrayName, int arrayComp)
191  {
192  this->SetStripsComponent(arrayName, arrayComp, -1, -1);
193  }
194  const char* GetStripsComponentArrayName();
195  int GetStripsComponentArrayComponent();
196  int GetStripsComponentMinRange();
197  int GetStripsComponentMaxRange();
199 
201 
210  void SetCellTypeComponent(const char* arrayName, int arrayComp, int min, int max);
211  void SetCellTypeComponent(const char* arrayName, int arrayComp)
212  {
213  this->SetCellTypeComponent(arrayName, arrayComp, -1, -1);
214  }
215  const char* GetCellTypeComponentArrayName();
216  int GetCellTypeComponentArrayComponent();
217  int GetCellTypeComponentMinRange();
218  int GetCellTypeComponentMaxRange();
219  void SetCellConnectivityComponent(const char* arrayName, int arrayComp, int min, int max);
220  void SetCellConnectivityComponent(const char* arrayName, int arrayComp)
221  {
222  this->SetCellConnectivityComponent(arrayName, arrayComp, -1, -1);
223  }
224  const char* GetCellConnectivityComponentArrayName();
225  int GetCellConnectivityComponentArrayComponent();
226  int GetCellConnectivityComponentMinRange();
227  int GetCellConnectivityComponentMaxRange();
229 
231 
235  vtkSetMacro(DefaultNormalize, vtkTypeBool);
236  vtkGetMacro(DefaultNormalize, vtkTypeBool);
237  vtkBooleanMacro(DefaultNormalize, vtkTypeBool);
239 
241 
246  vtkSetVector3Macro(Dimensions, int);
247  vtkGetVectorMacro(Dimensions, int, 3);
249 
251 
255  vtkSetVector3Macro(Origin, double);
256  vtkGetVectorMacro(Origin, double, 3);
258 
260 
264  vtkSetVector3Macro(Spacing, double);
265  vtkGetVectorMacro(Spacing, double, 3);
267 
269 
275  void SetDimensionsComponent(const char* arrayName, int arrayComp, int min, int max);
276  void SetDimensionsComponent(const char* arrayName, int arrayComp)
277  {
278  this->SetDimensionsComponent(arrayName, arrayComp, -1, -1);
279  }
280  void SetSpacingComponent(const char* arrayName, int arrayComp, int min, int max);
281  void SetSpacingComponent(const char* arrayName, int arrayComp)
282  {
283  this->SetSpacingComponent(arrayName, arrayComp, -1, -1);
284  }
285  void SetOriginComponent(const char* arrayName, int arrayComp, int min, int max);
286  void SetOriginComponent(const char* arrayName, int arrayComp)
287  {
288  this->SetOriginComponent(arrayName, arrayComp, -1, -1);
289  }
291 
292 protected:
294  ~vtkDataObjectToDataSetFilter() override;
295 
297  vtkInformationVector*) override; // generate output data
300  int FillInputPortInformation(int port, vtkInformation* info) override;
302 
303  char Updating;
304 
305  // control flags used to generate the output dataset
306  int DataSetType; // the type of dataset to generate
307 
308  // Support definition of points
309  char* PointArrays[3]; // the name of the arrays
310  int PointArrayComponents[3]; // the array components used for x-y-z
311  vtkIdType PointComponentRange[3][2]; // the range of the components to use
312  int PointNormalize[3]; // flags control normalization
313 
314  // These define cells for vtkPolyData
315  char* VertsArray; // the name of the array
316  int VertsArrayComponent; // the array component
317  vtkIdType VertsComponentRange[2]; // the range of the components to use
318 
319  char* LinesArray; // the name of the array
320  int LinesArrayComponent; // the array component used for cell types
321  vtkIdType LinesComponentRange[2]; // the range of the components to use
322 
323  char* PolysArray; // the name of the array
324  int PolysArrayComponent; // the array component
325  vtkIdType PolysComponentRange[2]; // the range of the components to use
326 
327  char* StripsArray; // the name of the array
328  int StripsArrayComponent; // the array component
329  vtkIdType StripsComponentRange[2]; // the range of the components to use
330 
331  // Used to define vtkUnstructuredGrid datasets
332  char* CellTypeArray; // the name of the array
333  int CellTypeArrayComponent; // the array component used for cell types
334  vtkIdType CellTypeComponentRange[2]; // the range of the components to use
335 
336  char* CellConnectivityArray; // the name of the array
337  int CellConnectivityArrayComponent; // the array components used for cell connectivity
338  vtkIdType CellConnectivityComponentRange[2]; // the range of the components to use
339 
340  // helper methods (and attributes) to construct datasets
341  void SetArrayName(char*& name, char* newName);
342  vtkIdType ConstructPoints(vtkDataObject* input, vtkPointSet* ps);
343  vtkIdType ConstructPoints(vtkDataObject* input, vtkRectilinearGrid* rg);
344  int ConstructCells(vtkDataObject* input, vtkPolyData* pd);
345  int ConstructCells(vtkDataObject* input, vtkUnstructuredGrid* ug);
346  vtkCellArray* ConstructCellArray(vtkDataArray* da, int comp, vtkIdType compRange[2]);
347 
348  // Default value for normalization
350 
351  // Couple of different ways to specify dimensions, spacing, and origin.
352  int Dimensions[3];
353  double Origin[3];
354  double Spacing[3];
355 
356  char* DimensionsArray; // the name of the array
357  int DimensionsArrayComponent; // the component of the array used for dimensions
358  vtkIdType DimensionsComponentRange[2]; // the ComponentRange of the array for the dimensions
359 
360  char* OriginArray; // the name of the array
361  int OriginArrayComponent; // the component of the array used for Origins
362  vtkIdType OriginComponentRange[2]; // the ComponentRange of the array for the Origins
363 
364  char* SpacingArray; // the name of the array
365  int SpacingArrayComponent; // the component of the array used for Spacings
366  vtkIdType SpacingComponentRange[2]; // the ComponentRange of the array for the Spacings
367 
368  void ConstructDimensions(vtkDataObject* input);
369  void ConstructSpacing(vtkDataObject* input);
370  void ConstructOrigin(vtkDataObject* input);
371 
372 private:
374  void operator=(const vtkDataObjectToDataSetFilter&) = delete;
375 };
376 
377 #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:80
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
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:69
int vtkIdType
Definition: vtkType.h:332
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:90
#define VTK_STRUCTURED_POINTS
Definition: vtkType.h:78
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:69
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.
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:55
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:186
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:77
general representation of visualization data
Definition: vtkDataObject.h:65
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:79
#define max(a, b)
#define VTK_UNSTRUCTURED_GRID
Definition: vtkType.h:81
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkPolyData * GetPolyDataOutput()
Get the output as vtkPolyData.