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 =========================================================================*/
87 #ifndef vtkDataObjectToDataSetFilter_h
88 #define vtkDataObjectToDataSetFilter_h
89 
90 #include "vtkDataSetAlgorithm.h"
91 #include "vtkFiltersCoreModule.h" // For export macro
92 
93 class vtkCellArray;
94 class vtkDataArray;
95 class vtkDataSet;
96 class vtkPointSet;
97 class vtkPolyData;
98 class vtkRectilinearGrid;
99 class vtkStructuredGrid;
100 class vtkStructuredPoints;
101 class vtkUnstructuredGrid;
102 
103 class VTKFILTERSCORE_EXPORT vtkDataObjectToDataSetFilter : public vtkDataSetAlgorithm
104 {
105 public:
108  void PrintSelf(ostream& os, vtkIndent indent) override;
109 
114 
116 
119  void SetDataSetType(int);
120  vtkGetMacro(DataSetType, int);
121  void SetDataSetTypeToPolyData() { this->SetDataSetType(VTK_POLY_DATA); }
122  void SetDataSetTypeToStructuredPoints() { this->SetDataSetType(VTK_STRUCTURED_POINTS); }
123  void SetDataSetTypeToStructuredGrid() { this->SetDataSetType(VTK_STRUCTURED_GRID); }
124  void SetDataSetTypeToRectilinearGrid() { this->SetDataSetType(VTK_RECTILINEAR_GRID); }
125  void SetDataSetTypeToUnstructuredGrid() { this->SetDataSetType(VTK_UNSTRUCTURED_GRID); }
127 
129 
144 
146 
159  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
160  void SetPointComponent(int comp, const char* arrayName, int arrayComp)
161  {
162  this->SetPointComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
163  }
164  const char* GetPointComponentArrayName(int comp);
170 
172 
181  void SetVertsComponent(const char* arrayName, int arrayComp, int min, int max);
182  void SetVertsComponent(const char* arrayName, int arrayComp)
183  {
184  this->SetVertsComponent(arrayName, arrayComp, -1, -1);
185  }
190  void SetLinesComponent(const char* arrayName, int arrayComp, int min, int max);
191  void SetLinesComponent(const char* arrayName, int arrayComp)
192  {
193  this->SetLinesComponent(arrayName, arrayComp, -1, -1);
194  }
199  void SetPolysComponent(const char* arrayName, int arrayComp, int min, int max);
200  void SetPolysComponent(const char* arrayName, int arrayComp)
201  {
202  this->SetPolysComponent(arrayName, arrayComp, -1, -1);
203  }
208  void SetStripsComponent(const char* arrayName, int arrayComp, int min, int max);
209  void SetStripsComponent(const char* arrayName, int arrayComp)
210  {
211  this->SetStripsComponent(arrayName, arrayComp, -1, -1);
212  }
218 
220 
229  void SetCellTypeComponent(const char* arrayName, int arrayComp, int min, int max);
230  void SetCellTypeComponent(const char* arrayName, int arrayComp)
231  {
232  this->SetCellTypeComponent(arrayName, arrayComp, -1, -1);
233  }
238  void SetCellConnectivityComponent(const char* arrayName, int arrayComp, int min, int max);
239  void SetCellConnectivityComponent(const char* arrayName, int arrayComp)
240  {
241  this->SetCellConnectivityComponent(arrayName, arrayComp, -1, -1);
242  }
248 
250 
254  vtkSetMacro(DefaultNormalize, vtkTypeBool);
255  vtkGetMacro(DefaultNormalize, vtkTypeBool);
256  vtkBooleanMacro(DefaultNormalize, vtkTypeBool);
258 
260 
265  vtkSetVector3Macro(Dimensions, int);
266  vtkGetVectorMacro(Dimensions, int, 3);
268 
270 
274  vtkSetVector3Macro(Origin, double);
275  vtkGetVectorMacro(Origin, double, 3);
277 
279 
283  vtkSetVector3Macro(Spacing, double);
284  vtkGetVectorMacro(Spacing, double, 3);
286 
288 
294  void SetDimensionsComponent(const char* arrayName, int arrayComp, int min, int max);
295  void SetDimensionsComponent(const char* arrayName, int arrayComp)
296  {
297  this->SetDimensionsComponent(arrayName, arrayComp, -1, -1);
298  }
299  void SetSpacingComponent(const char* arrayName, int arrayComp, int min, int max);
300  void SetSpacingComponent(const char* arrayName, int arrayComp)
301  {
302  this->SetSpacingComponent(arrayName, arrayComp, -1, -1);
303  }
304  void SetOriginComponent(const char* arrayName, int arrayComp, int min, int max);
305  void SetOriginComponent(const char* arrayName, int arrayComp)
306  {
307  this->SetOriginComponent(arrayName, arrayComp, -1, -1);
308  }
310 
311 protected:
314 
316  vtkInformationVector*) override; // generate output data
321 
322  char Updating;
323 
324  // control flags used to generate the output dataset
325  int DataSetType; // the type of dataset to generate
326 
327  // Support definition of points
328  char* PointArrays[3]; // the name of the arrays
329  int PointArrayComponents[3]; // the array components used for x-y-z
330  vtkIdType PointComponentRange[3][2]; // the range of the components to use
331  int PointNormalize[3]; // flags control normalization
332 
333  // These define cells for vtkPolyData
334  char* VertsArray; // the name of the array
335  int VertsArrayComponent; // the array component
336  vtkIdType VertsComponentRange[2]; // the range of the components to use
337 
338  char* LinesArray; // the name of the array
339  int LinesArrayComponent; // the array component used for cell types
340  vtkIdType LinesComponentRange[2]; // the range of the components to use
341 
342  char* PolysArray; // the name of the array
343  int PolysArrayComponent; // the array component
344  vtkIdType PolysComponentRange[2]; // the range of the components to use
345 
346  char* StripsArray; // the name of the array
347  int StripsArrayComponent; // the array component
348  vtkIdType StripsComponentRange[2]; // the range of the components to use
349 
350  // Used to define vtkUnstructuredGrid datasets
351  char* CellTypeArray; // the name of the array
352  int CellTypeArrayComponent; // the array component used for cell types
353  vtkIdType CellTypeComponentRange[2]; // the range of the components to use
354 
355  char* CellConnectivityArray; // the name of the array
356  int CellConnectivityArrayComponent; // the array components used for cell connectivity
357  vtkIdType CellConnectivityComponentRange[2]; // the range of the components to use
358 
359  // helper methods (and attributes) to construct datasets
360  void SetArrayName(char*& name, char* newName);
365  vtkCellArray* ConstructCellArray(vtkDataArray* da, int comp, vtkIdType compRange[2]);
366 
367  // Default value for normalization
369 
370  // Couple of different ways to specify dimensions, spacing, and origin.
371  int Dimensions[3];
372  double Origin[3];
373  double Spacing[3];
374 
375  char* DimensionsArray; // the name of the array
376  int DimensionsArrayComponent; // the component of the array used for dimensions
377  vtkIdType DimensionsComponentRange[2]; // the ComponentRange of the array for the dimensions
378 
379  char* OriginArray; // the name of the array
380  int OriginArrayComponent; // the component of the array used for Origins
381  vtkIdType OriginComponentRange[2]; // the ComponentRange of the array for the Origins
382 
383  char* SpacingArray; // the name of the array
384  int SpacingArrayComponent; // the component of the array used for Spacings
385  vtkIdType SpacingComponentRange[2]; // the ComponentRange of the array for the Spacings
386 
390 
391 private:
393  void operator=(const vtkDataObjectToDataSetFilter&) = delete;
394 };
395 
396 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:296
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:165
map field data to concrete dataset
void SetCellTypeComponent(const char *arrayName, int arrayComp, int min, int max)
Define cell types and cell connectivity when creating unstructured grid data.
int GetPointComponentMaxRange(int comp)
Define the component of the field to be used for the x, y, and z values of the points.
void SetLinesComponent(const char *arrayName, int arrayComp)
Define cell connectivity when creating vtkPolyData.
static vtkDataObjectToDataSetFilter * New()
void SetStripsComponent(const char *arrayName, int arrayComp)
Define cell connectivity when creating vtkPolyData.
void SetArrayName(char *&name, char *newName)
void SetCellConnectivityComponent(const char *arrayName, int arrayComp)
Define cell types and cell connectivity when creating unstructured grid data.
vtkRectilinearGrid * GetRectilinearGridOutput()
Get the output in different forms.
int GetCellConnectivityComponentMinRange()
Define cell types and cell connectivity when creating unstructured grid data.
const char * GetPointComponentArrayName(int comp)
Define the component of the field to be used for the x, y, and z values of the points.
void SetPointComponent(int comp, const char *arrayName, int arrayComp, int min, int max, int normalize)
Define the component of the field to be used for the x, y, and z values of the points.
int GetLinesComponentArrayComponent()
Define cell connectivity when creating vtkPolyData.
int GetPointComponentNormailzeFlag(int comp)
Define the component of the field to be used for the x, y, and z values of the points.
int GetCellConnectivityComponentMaxRange()
Define cell types and cell connectivity when creating unstructured grid data.
void SetOriginComponent(const char *arrayName, int arrayComp, int min, int max)
Alternative methods to specify the dimensions, spacing, and origin for those datasets requiring this ...
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when a request asks the algorithm to do its work.
void SetDataSetTypeToRectilinearGrid()
Control what type of data is generated for output.
int GetStripsComponentMinRange()
Define cell connectivity when creating vtkPolyData.
int GetStripsComponentArrayComponent()
Define cell connectivity when creating vtkPolyData.
const char * GetStripsComponentArrayName()
Define cell connectivity when creating vtkPolyData.
int GetPointComponentArrayComponent(int comp)
Define the component of the field to be used for the x, y, and z values of the points.
int ConstructCells(vtkDataObject *input, vtkPolyData *pd)
int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when a request asks the algorithm to create empty output data ob...
void SetSpacingComponent(const char *arrayName, int arrayComp)
Alternative methods to specify the dimensions, spacing, and origin for those datasets requiring this ...
void SetStripsComponent(const char *arrayName, int arrayComp, int min, int max)
Define cell connectivity when creating vtkPolyData.
int GetStripsComponentMaxRange()
Define cell connectivity when creating vtkPolyData.
int GetLinesComponentMinRange()
Define cell connectivity when creating vtkPolyData.
void SetDimensionsComponent(const char *arrayName, int arrayComp, int min, int max)
Alternative methods to specify the dimensions, spacing, and origin for those datasets requiring this ...
const char * GetCellTypeComponentArrayName()
Define cell types and cell connectivity when creating unstructured grid data.
void SetSpacingComponent(const char *arrayName, int arrayComp, int min, int max)
Alternative methods to specify the dimensions, spacing, and origin for those datasets requiring this ...
void SetDataSetTypeToUnstructuredGrid()
Control what type of data is generated for output.
void SetDataSetTypeToStructuredGrid()
Control what type of data is generated for output.
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when a request asks for Information.
~vtkDataObjectToDataSetFilter() override
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when each filter in the pipeline decides what portion of its inp...
void SetDataSetTypeToStructuredPoints()
Control what type of data is generated for output.
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.
int GetPolysComponentArrayComponent()
Define cell connectivity when creating vtkPolyData.
vtkStructuredPoints * GetStructuredPointsOutput()
Get the output in different forms.
vtkDataSet * GetOutput(int idx)
Get the output in different forms.
vtkIdType ConstructPoints(vtkDataObject *input, vtkPointSet *ps)
vtkUnstructuredGrid * GetUnstructuredGridOutput()
Get the output in different forms.
vtkDataSet * GetOutput()
Get the output in different forms.
const char * GetVertsComponentArrayName()
Define cell connectivity when creating vtkPolyData.
void SetCellConnectivityComponent(const char *arrayName, int arrayComp, int min, int max)
Define cell types and cell connectivity when creating unstructured grid data.
void SetCellTypeComponent(const char *arrayName, int arrayComp)
Define cell types and cell connectivity when creating unstructured grid data.
int GetPointComponentMinRange(int comp)
Define the component of the field to be used for the x, y, and z values of the points.
const char * GetLinesComponentArrayName()
Define cell connectivity when creating vtkPolyData.
void ConstructOrigin(vtkDataObject *input)
void ConstructSpacing(vtkDataObject *input)
int GetCellTypeComponentArrayComponent()
Define cell types and cell connectivity when creating unstructured grid data.
int GetVertsComponentMinRange()
Define cell connectivity when creating vtkPolyData.
int GetCellTypeComponentMinRange()
Define cell types and cell connectivity when creating unstructured grid data.
vtkCellArray * ConstructCellArray(vtkDataArray *da, int comp, vtkIdType compRange[2])
void SetLinesComponent(const char *arrayName, int arrayComp, int min, int max)
Define cell connectivity when creating vtkPolyData.
int GetPolysComponentMaxRange()
Define cell connectivity when creating vtkPolyData.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
void SetDataSetTypeToPolyData()
Control what type of data is generated for output.
void SetVertsComponent(const char *arrayName, int arrayComp)
Define cell connectivity when creating vtkPolyData.
vtkDataObject * GetInput()
Get the input to the filter.
int ConstructCells(vtkDataObject *input, vtkUnstructuredGrid *ug)
const char * GetPolysComponentArrayName()
Define cell connectivity when creating vtkPolyData.
int GetLinesComponentMaxRange()
Define cell connectivity when creating vtkPolyData.
void SetPolysComponent(const char *arrayName, int arrayComp, int min, int max)
Define cell connectivity when creating vtkPolyData.
int GetPolysComponentMinRange()
Define cell connectivity when creating vtkPolyData.
void SetPolysComponent(const char *arrayName, int arrayComp)
Define cell connectivity when creating vtkPolyData.
vtkPolyData * GetPolyDataOutput()
Get the output in different forms.
void ConstructDimensions(vtkDataObject *input)
int GetCellTypeComponentMaxRange()
Define cell types and cell connectivity when creating unstructured grid data.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIdType ConstructPoints(vtkDataObject *input, vtkRectilinearGrid *rg)
void SetOriginComponent(const char *arrayName, int arrayComp)
Alternative methods to specify the dimensions, spacing, and origin for those datasets requiring this ...
void SetVertsComponent(const char *arrayName, int arrayComp, int min, int max)
Define cell connectivity when creating vtkPolyData.
void SetDataSetType(int)
Control what type of data is generated for output.
int GetVertsComponentMaxRange()
Define cell connectivity when creating vtkPolyData.
int GetVertsComponentArrayComponent()
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 ...
const char * GetCellConnectivityComponentArrayName()
Define cell types and cell connectivity when creating unstructured grid data.
int GetCellConnectivityComponentArrayComponent()
Define cell types and cell connectivity when creating unstructured grid data.
vtkStructuredGrid * GetStructuredGridOutput()
Get the output in different forms.
general representation of visualization data
Superclass for algorithms that produce output of the same type as input.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:172
a simple class to control print indentation
Definition: vtkIndent.h:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
concrete class for storing a set of points
Definition: vtkPointSet.h:109
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:200
a dataset that is topologically regular with variable spacing in the three coordinate directions
topologically regular array of data
A subclass of ImageData.
dataset represents arbitrary combinations of all possible cell types
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
@ name
Definition: vtkX3D.h:225
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:332
#define VTK_RECTILINEAR_GRID
Definition: vtkType.h:80
#define VTK_UNSTRUCTURED_GRID
Definition: vtkType.h:81
#define VTK_STRUCTURED_GRID
Definition: vtkType.h:79
#define VTK_POLY_DATA
Definition: vtkType.h:77
#define VTK_STRUCTURED_POINTS
Definition: vtkType.h:78
#define max(a, b)