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 =========================================================================*/
77 #ifndef vtkDataObjectToDataSetFilter_h
78 #define vtkDataObjectToDataSetFilter_h
79 
80 #include "vtkDataSetAlgorithm.h"
81 #include "vtkFiltersCoreModule.h" // For export macro
82 
83 class vtkCellArray;
84 class vtkDataArray;
85 class vtkDataSet;
86 class vtkPointSet;
87 class vtkPolyData;
88 class vtkRectilinearGrid;
89 class vtkStructuredGrid;
92 
93 class VTKFILTERSCORE_EXPORT vtkDataObjectToDataSetFilter : public vtkDataSetAlgorithm
94 {
95 public:
98  void PrintSelf(ostream& os, vtkIndent indent) override;
99 
104 
106 
109  void SetDataSetType(int);
110  vtkGetMacro(DataSetType, int);
111  void SetDataSetTypeToPolyData() { this->SetDataSetType(VTK_POLY_DATA); }
112  void SetDataSetTypeToStructuredPoints() { this->SetDataSetType(VTK_STRUCTURED_POINTS); }
113  void SetDataSetTypeToStructuredGrid() { this->SetDataSetType(VTK_STRUCTURED_GRID); }
114  void SetDataSetTypeToRectilinearGrid() { this->SetDataSetType(VTK_RECTILINEAR_GRID); }
115  void SetDataSetTypeToUnstructuredGrid() { this->SetDataSetType(VTK_UNSTRUCTURED_GRID); }
117 
119 
134 
136 
149  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
150  void SetPointComponent(int comp, const char* arrayName, int arrayComp)
151  {
152  this->SetPointComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
153  }
154  const char* GetPointComponentArrayName(int comp);
160 
162 
171  void SetVertsComponent(const char* arrayName, int arrayComp, int min, int max);
172  void SetVertsComponent(const char* arrayName, int arrayComp)
173  {
174  this->SetVertsComponent(arrayName, arrayComp, -1, -1);
175  }
180  void SetLinesComponent(const char* arrayName, int arrayComp, int min, int max);
181  void SetLinesComponent(const char* arrayName, int arrayComp)
182  {
183  this->SetLinesComponent(arrayName, arrayComp, -1, -1);
184  }
189  void SetPolysComponent(const char* arrayName, int arrayComp, int min, int max);
190  void SetPolysComponent(const char* arrayName, int arrayComp)
191  {
192  this->SetPolysComponent(arrayName, arrayComp, -1, -1);
193  }
198  void SetStripsComponent(const char* arrayName, int arrayComp, int min, int max);
199  void SetStripsComponent(const char* arrayName, int arrayComp)
200  {
201  this->SetStripsComponent(arrayName, arrayComp, -1, -1);
202  }
208 
210 
219  void SetCellTypeComponent(const char* arrayName, int arrayComp, int min, int max);
220  void SetCellTypeComponent(const char* arrayName, int arrayComp)
221  {
222  this->SetCellTypeComponent(arrayName, arrayComp, -1, -1);
223  }
228  void SetCellConnectivityComponent(const char* arrayName, int arrayComp, int min, int max);
229  void SetCellConnectivityComponent(const char* arrayName, int arrayComp)
230  {
231  this->SetCellConnectivityComponent(arrayName, arrayComp, -1, -1);
232  }
238 
240 
244  vtkSetMacro(DefaultNormalize, vtkTypeBool);
245  vtkGetMacro(DefaultNormalize, vtkTypeBool);
246  vtkBooleanMacro(DefaultNormalize, vtkTypeBool);
248 
250 
255  vtkSetVector3Macro(Dimensions, int);
256  vtkGetVectorMacro(Dimensions, int, 3);
258 
260 
264  vtkSetVector3Macro(Origin, double);
265  vtkGetVectorMacro(Origin, double, 3);
267 
269 
273  vtkSetVector3Macro(Spacing, double);
274  vtkGetVectorMacro(Spacing, double, 3);
276 
278 
284  void SetDimensionsComponent(const char* arrayName, int arrayComp, int min, int max);
285  void SetDimensionsComponent(const char* arrayName, int arrayComp)
286  {
287  this->SetDimensionsComponent(arrayName, arrayComp, -1, -1);
288  }
289  void SetSpacingComponent(const char* arrayName, int arrayComp, int min, int max);
290  void SetSpacingComponent(const char* arrayName, int arrayComp)
291  {
292  this->SetSpacingComponent(arrayName, arrayComp, -1, -1);
293  }
294  void SetOriginComponent(const char* arrayName, int arrayComp, int min, int max);
295  void SetOriginComponent(const char* arrayName, int arrayComp)
296  {
297  this->SetOriginComponent(arrayName, arrayComp, -1, -1);
298  }
300 
301 protected:
304 
306  vtkInformationVector*) override; // generate output data
311 
312  char Updating;
313 
314  // control flags used to generate the output dataset
315  int DataSetType; // the type of dataset to generate
316 
317  // Support definition of points
318  char* PointArrays[3]; // the name of the arrays
319  int PointArrayComponents[3]; // the array components used for x-y-z
320  vtkIdType PointComponentRange[3][2]; // the range of the components to use
321  int PointNormalize[3]; // flags control normalization
322 
323  // These define cells for vtkPolyData
324  char* VertsArray; // the name of the array
325  int VertsArrayComponent; // the array component
326  vtkIdType VertsComponentRange[2]; // the range of the components to use
327 
328  char* LinesArray; // the name of the array
329  int LinesArrayComponent; // the array component used for cell types
330  vtkIdType LinesComponentRange[2]; // the range of the components to use
331 
332  char* PolysArray; // the name of the array
333  int PolysArrayComponent; // the array component
334  vtkIdType PolysComponentRange[2]; // the range of the components to use
335 
336  char* StripsArray; // the name of the array
337  int StripsArrayComponent; // the array component
338  vtkIdType StripsComponentRange[2]; // the range of the components to use
339 
340  // Used to define vtkUnstructuredGrid datasets
341  char* CellTypeArray; // the name of the array
342  int CellTypeArrayComponent; // the array component used for cell types
343  vtkIdType CellTypeComponentRange[2]; // the range of the components to use
344 
345  char* CellConnectivityArray; // the name of the array
346  int CellConnectivityArrayComponent; // the array components used for cell connectivity
347  vtkIdType CellConnectivityComponentRange[2]; // the range of the components to use
348 
349  // helper methods (and attributes) to construct datasets
350  void SetArrayName(char*& name, char* newName);
355  vtkCellArray* ConstructCellArray(vtkDataArray* da, int comp, vtkIdType compRange[2]);
356 
357  // Default value for normalization
359 
360  // Couple of different ways to specify dimensions, spacing, and origin.
361  int Dimensions[3];
362  double Origin[3];
363  double Spacing[3];
364 
365  char* DimensionsArray; // the name of the array
366  int DimensionsArrayComponent; // the component of the array used for dimensions
367  vtkIdType DimensionsComponentRange[2]; // the ComponentRange of the array for the dimensions
368 
369  char* OriginArray; // the name of the array
370  int OriginArrayComponent; // the component of the array used for Origins
371  vtkIdType OriginComponentRange[2]; // the ComponentRange of the array for the Origins
372 
373  char* SpacingArray; // the name of the array
374  int SpacingArrayComponent; // the component of the array used for Spacings
375  vtkIdType SpacingComponentRange[2]; // the ComponentRange of the array for the Spacings
376 
380 
381 private:
383  void operator=(const vtkDataObjectToDataSetFilter&) = delete;
384 };
385 
386 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:196
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:65
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
Definition: vtkDataObject.h:75
Superclass for algorithms that produce output of the same type as input.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:72
a simple class to control print indentation
Definition: vtkIndent.h:49
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
concrete class for storing a set of points
Definition: vtkPointSet.h:79
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:100
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)