VTK  9.0.1
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 "vtkDataSetAlgorithm.h"
69 #include "vtkFiltersCoreModule.h" // For export macro
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) override;
87 
92 
94 
97  void SetDataSetType(int);
98  vtkGetMacro(DataSetType, int);
99  void SetDataSetTypeToPolyData() { this->SetDataSetType(VTK_POLY_DATA); }
100  void SetDataSetTypeToStructuredPoints() { this->SetDataSetType(VTK_STRUCTURED_POINTS); }
101  void SetDataSetTypeToStructuredGrid() { this->SetDataSetType(VTK_STRUCTURED_GRID); }
102  void SetDataSetTypeToRectilinearGrid() { this->SetDataSetType(VTK_RECTILINEAR_GRID); }
103  void SetDataSetTypeToUnstructuredGrid() { this->SetDataSetType(VTK_UNSTRUCTURED_GRID); }
105 
107 
115  vtkDataSet* GetOutput(int idx);
122 
124 
136  void SetPointComponent(
137  int comp, const char* arrayName, int arrayComp, int min, int max, int normalize);
138  void SetPointComponent(int comp, const char* arrayName, int arrayComp)
139  {
140  this->SetPointComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);
141  }
142  const char* GetPointComponentArrayName(int comp);
143  int GetPointComponentArrayComponent(int comp);
144  int GetPointComponentMinRange(int comp);
145  int GetPointComponentMaxRange(int comp);
146  int GetPointComponentNormailzeFlag(int comp);
148 
150 
159  void SetVertsComponent(const char* arrayName, int arrayComp, int min, int max);
160  void SetVertsComponent(const char* arrayName, int arrayComp)
161  {
162  this->SetVertsComponent(arrayName, arrayComp, -1, -1);
163  }
164  const char* GetVertsComponentArrayName();
165  int GetVertsComponentArrayComponent();
166  int GetVertsComponentMinRange();
167  int GetVertsComponentMaxRange();
168  void SetLinesComponent(const char* arrayName, int arrayComp, int min, int max);
169  void SetLinesComponent(const char* arrayName, int arrayComp)
170  {
171  this->SetLinesComponent(arrayName, arrayComp, -1, -1);
172  }
173  const char* GetLinesComponentArrayName();
174  int GetLinesComponentArrayComponent();
175  int GetLinesComponentMinRange();
176  int GetLinesComponentMaxRange();
177  void SetPolysComponent(const char* arrayName, int arrayComp, int min, int max);
178  void SetPolysComponent(const char* arrayName, int arrayComp)
179  {
180  this->SetPolysComponent(arrayName, arrayComp, -1, -1);
181  }
182  const char* GetPolysComponentArrayName();
183  int GetPolysComponentArrayComponent();
184  int GetPolysComponentMinRange();
185  int GetPolysComponentMaxRange();
186  void SetStripsComponent(const char* arrayName, int arrayComp, int min, int max);
187  void SetStripsComponent(const char* arrayName, int arrayComp)
188  {
189  this->SetStripsComponent(arrayName, arrayComp, -1, -1);
190  }
191  const char* GetStripsComponentArrayName();
192  int GetStripsComponentArrayComponent();
193  int GetStripsComponentMinRange();
194  int GetStripsComponentMaxRange();
196 
198 
207  void SetCellTypeComponent(const char* arrayName, int arrayComp, int min, int max);
208  void SetCellTypeComponent(const char* arrayName, int arrayComp)
209  {
210  this->SetCellTypeComponent(arrayName, arrayComp, -1, -1);
211  }
212  const char* GetCellTypeComponentArrayName();
213  int GetCellTypeComponentArrayComponent();
214  int GetCellTypeComponentMinRange();
215  int GetCellTypeComponentMaxRange();
216  void SetCellConnectivityComponent(const char* arrayName, int arrayComp, int min, int max);
217  void SetCellConnectivityComponent(const char* arrayName, int arrayComp)
218  {
219  this->SetCellConnectivityComponent(arrayName, arrayComp, -1, -1);
220  }
221  const char* GetCellConnectivityComponentArrayName();
222  int GetCellConnectivityComponentArrayComponent();
223  int GetCellConnectivityComponentMinRange();
224  int GetCellConnectivityComponentMaxRange();
226 
228 
232  vtkSetMacro(DefaultNormalize, vtkTypeBool);
233  vtkGetMacro(DefaultNormalize, vtkTypeBool);
234  vtkBooleanMacro(DefaultNormalize, vtkTypeBool);
236 
238 
243  vtkSetVector3Macro(Dimensions, int);
244  vtkGetVectorMacro(Dimensions, int, 3);
246 
248 
252  vtkSetVector3Macro(Origin, double);
253  vtkGetVectorMacro(Origin, double, 3);
255 
257 
261  vtkSetVector3Macro(Spacing, double);
262  vtkGetVectorMacro(Spacing, double, 3);
264 
266 
272  void SetDimensionsComponent(const char* arrayName, int arrayComp, int min, int max);
273  void SetDimensionsComponent(const char* arrayName, int arrayComp)
274  {
275  this->SetDimensionsComponent(arrayName, arrayComp, -1, -1);
276  }
277  void SetSpacingComponent(const char* arrayName, int arrayComp, int min, int max);
278  void SetSpacingComponent(const char* arrayName, int arrayComp)
279  {
280  this->SetSpacingComponent(arrayName, arrayComp, -1, -1);
281  }
282  void SetOriginComponent(const char* arrayName, int arrayComp, int min, int max);
283  void SetOriginComponent(const char* arrayName, int arrayComp)
284  {
285  this->SetOriginComponent(arrayName, arrayComp, -1, -1);
286  }
288 
289 protected:
291  ~vtkDataObjectToDataSetFilter() override;
292 
294  vtkInformationVector*) override; // generate output data
297  int FillInputPortInformation(int port, vtkInformation* info) override;
299 
300  char Updating;
301 
302  // control flags used to generate the output dataset
303  int DataSetType; // the type of dataset to generate
304 
305  // Support definition of points
306  char* PointArrays[3]; // the name of the arrays
307  int PointArrayComponents[3]; // the array components used for x-y-z
308  vtkIdType PointComponentRange[3][2]; // the range of the components to use
309  int PointNormalize[3]; // flags control normalization
310 
311  // These define cells for vtkPolyData
312  char* VertsArray; // the name of the array
313  int VertsArrayComponent; // the array component
314  vtkIdType VertsComponentRange[2]; // the range of the components to use
315 
316  char* LinesArray; // the name of the array
317  int LinesArrayComponent; // the array component used for cell types
318  vtkIdType LinesComponentRange[2]; // the range of the components to use
319 
320  char* PolysArray; // the name of the array
321  int PolysArrayComponent; // the array component
322  vtkIdType PolysComponentRange[2]; // the range of the components to use
323 
324  char* StripsArray; // the name of the array
325  int StripsArrayComponent; // the array component
326  vtkIdType StripsComponentRange[2]; // the range of the components to use
327 
328  // Used to define vtkUnstructuredGrid datasets
329  char* CellTypeArray; // the name of the array
330  int CellTypeArrayComponent; // the array component used for cell types
331  vtkIdType CellTypeComponentRange[2]; // the range of the components to use
332 
333  char* CellConnectivityArray; // the name of the array
334  int CellConnectivityArrayComponent; // the array components used for cell connectivity
335  vtkIdType CellConnectivityComponentRange[2]; // the range of the components to use
336 
337  // helper methods (and attributes) to construct datasets
338  void SetArrayName(char*& name, char* newName);
339  vtkIdType ConstructPoints(vtkDataObject* input, vtkPointSet* ps);
340  vtkIdType ConstructPoints(vtkDataObject* input, vtkRectilinearGrid* rg);
341  int ConstructCells(vtkDataObject* input, vtkPolyData* pd);
342  int ConstructCells(vtkDataObject* input, vtkUnstructuredGrid* ug);
343  vtkCellArray* ConstructCellArray(vtkDataArray* da, int comp, vtkIdType compRange[2]);
344 
345  // Default value for normalization
347 
348  // Couple of different ways to specify dimensions, spacing, and origin.
349  int Dimensions[3];
350  double Origin[3];
351  double Spacing[3];
352 
353  char* DimensionsArray; // the name of the array
354  int DimensionsArrayComponent; // the component of the array used for dimensions
355  vtkIdType DimensionsComponentRange[2]; // the ComponentRange of the array for the dimensions
356 
357  char* OriginArray; // the name of the array
358  int OriginArrayComponent; // the component of the array used for Origins
359  vtkIdType OriginComponentRange[2]; // the ComponentRange of the array for the Origins
360 
361  char* SpacingArray; // the name of the array
362  int SpacingArrayComponent; // the component of the array used for Spacings
363  vtkIdType SpacingComponentRange[2]; // the ComponentRange of the array for the Spacings
364 
365  void ConstructDimensions(vtkDataObject* input);
366  void ConstructSpacing(vtkDataObject* input);
367  void ConstructOrigin(vtkDataObject* input);
368 
369 private:
371  void operator=(const vtkDataObjectToDataSetFilter&) = delete;
372 };
373 
374 #endif
vtkDataObjectToDataSetFilter
map field data to concrete dataset
Definition: vtkDataObjectToDataSetFilter.h:81
vtkDataObjectToDataSetFilter::LinesArrayComponent
int LinesArrayComponent
Definition: vtkDataObjectToDataSetFilter.h:317
vtkStructuredPoints
A subclass of ImageData.
Definition: vtkStructuredPoints.h:35
vtkDataObjectToDataSetFilter::SetDimensionsComponent
void SetDimensionsComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:273
vtkDataSetAlgorithm::GetRectilinearGridOutput
vtkRectilinearGrid * GetRectilinearGridOutput()
Get the output as vtkRectilinearGrid.
vtkDataObjectToDataSetFilter::SetCellTypeComponent
void SetCellTypeComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:208
vtx::types::DataSetType
DataSetType
Definition: VTXTypes.h:41
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkDataObjectToDataSetFilter::DefaultNormalize
vtkTypeBool DefaultNormalize
Definition: vtkDataObjectToDataSetFilter.h:346
vtkDataObjectToDataSetFilter::VertsArray
char * VertsArray
Definition: vtkDataObjectToDataSetFilter.h:312
vtkDataObjectToDataSetFilter::SetCellConnectivityComponent
void SetCellConnectivityComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:217
vtkRectilinearGrid
a dataset that is topologically regular with variable spacing in the three coordinate directions
Definition: vtkRectilinearGrid.h:51
vtkDataObjectToDataSetFilter::VertsArrayComponent
int VertsArrayComponent
Definition: vtkDataObjectToDataSetFilter.h:313
vtkDataObjectToDataSetFilter::LinesArray
char * LinesArray
Definition: vtkDataObjectToDataSetFilter.h:316
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkDataObjectToDataSetFilter::OriginArrayComponent
int OriginArrayComponent
Definition: vtkDataObjectToDataSetFilter.h:358
vtkDataSetAlgorithm::GetStructuredPointsOutput
vtkStructuredPoints * GetStructuredPointsOutput()
Get the output as vtkStructuredPoints.
vtkDataObjectToDataSetFilter::SetDataSetTypeToRectilinearGrid
void SetDataSetTypeToRectilinearGrid()
Definition: vtkDataObjectToDataSetFilter.h:102
vtkStructuredGrid
topologically regular array of data
Definition: vtkStructuredGrid.h:57
vtkDataObjectToDataSetFilter::PolysArrayComponent
int PolysArrayComponent
Definition: vtkDataObjectToDataSetFilter.h:321
vtkDataSetAlgorithm::RequestData
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when a request asks the algorithm to do its work.
Definition: vtkDataSetAlgorithm.h:176
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
vtkDataObjectToDataSetFilter::SetOriginComponent
void SetOriginComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:283
VTK_STRUCTURED_POINTS
#define VTK_STRUCTURED_POINTS
Definition: vtkType.h:86
vtkDataSetAlgorithm::RequestDataObject
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...
vtkDataObjectToDataSetFilter::SetSpacingComponent
void SetSpacingComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:278
max
#define max(a, b)
Definition: vtkX3DExporterFIWriterHelper.h:31
vtkDataSetAlgorithm::GetStructuredGridOutput
vtkStructuredGrid * GetStructuredGridOutput()
Get the output as vtkStructuredGrid.
vtkDataSetAlgorithm::GetOutput
vtkDataSet * GetOutput()
Get the output data object for a port on this algorithm.
vtkDataSetAlgorithm::GetUnstructuredGridOutput
vtkUnstructuredGrid * GetUnstructuredGridOutput()
Get the output as vtkUnstructuredGrid.
vtkDataSetAlgorithm
Superclass for algorithms that produce output of the same type as input.
Definition: vtkDataSetAlgorithm.h:48
vtkX3D::port
@ port
Definition: vtkX3D.h:453
vtkDataObjectToDataSetFilter::SpacingArrayComponent
int SpacingArrayComponent
Definition: vtkDataObjectToDataSetFilter.h:362
vtkDataObjectToDataSetFilter::SetDataSetTypeToStructuredGrid
void SetDataSetTypeToStructuredGrid()
Definition: vtkDataObjectToDataSetFilter.h:101
vtkDataObjectToDataSetFilter::SetPointComponent
void SetPointComponent(int comp, const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:138
vtkDataSetAlgorithm::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkDataObjectToDataSetFilter::CellTypeArrayComponent
int CellTypeArrayComponent
Definition: vtkDataObjectToDataSetFilter.h:330
vtkDataSetAlgorithm::GetPolyDataOutput
vtkPolyData * GetPolyDataOutput()
Get the output as vtkPolyData.
vtkDataObjectToDataSetFilter::SetVertsComponent
void SetVertsComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:160
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:179
vtkDataSetAlgorithm::New
static vtkDataSetAlgorithm * New()
vtkDataObjectToDataSetFilter::StripsArray
char * StripsArray
Definition: vtkDataObjectToDataSetFilter.h:324
vtkDataObjectToDataSetFilter::StripsArrayComponent
int StripsArrayComponent
Definition: vtkDataObjectToDataSetFilter.h:325
vtkDataObjectToDataSetFilter::SetLinesComponent
void SetLinesComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:169
vtkX3D::name
@ name
Definition: vtkX3D.h:225
vtkDataObjectToDataSetFilter::CellConnectivityArray
char * CellConnectivityArray
Definition: vtkDataObjectToDataSetFilter.h:333
vtkDataObjectToDataSetFilter::SetDataSetTypeToUnstructuredGrid
void SetDataSetTypeToUnstructuredGrid()
Definition: vtkDataObjectToDataSetFilter.h:103
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
vtkX3D::info
@ info
Definition: vtkX3D.h:382
vtkDataSetAlgorithm.h
vtkDataObjectToDataSetFilter::PolysArray
char * PolysArray
Definition: vtkDataObjectToDataSetFilter.h:320
vtkDataObjectToDataSetFilter::SetDataSetTypeToPolyData
void SetDataSetTypeToPolyData()
Definition: vtkDataObjectToDataSetFilter.h:99
vtkDataSetAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkPointSet
abstract class for specifying dataset behavior
Definition: vtkPointSet.h:62
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
vtkDataObjectToDataSetFilter::SetStripsComponent
void SetStripsComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:187
vtkDataSetAlgorithm::RequestUpdateExtent
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when each filter in the pipeline decides what portion of its inp...
Definition: vtkDataSetAlgorithm.h:152
vtkDataObjectToDataSetFilter::Updating
char Updating
Definition: vtkDataObjectToDataSetFilter.h:300
vtkUnstructuredGrid
dataset represents arbitrary combinations of all possible cell types
Definition: vtkUnstructuredGrid.h:92
vtkDataObjectToDataSetFilter::CellConnectivityArrayComponent
int CellConnectivityArrayComponent
Definition: vtkDataObjectToDataSetFilter.h:334
vtkDataObjectToDataSetFilter::SetDataSetTypeToStructuredPoints
void SetDataSetTypeToStructuredPoints()
Definition: vtkDataObjectToDataSetFilter.h:100
VTK_UNSTRUCTURED_GRID
#define VTK_UNSTRUCTURED_GRID
Definition: vtkType.h:89
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:59
vtkDataObjectToDataSetFilter::DimensionsArray
char * DimensionsArray
Definition: vtkDataObjectToDataSetFilter.h:353
vtkDataObjectToDataSetFilter::SetPolysComponent
void SetPolysComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:178
VTK_POLY_DATA
#define VTK_POLY_DATA
Definition: vtkType.h:85
vtkDataObjectToDataSetFilter::SpacingArray
char * SpacingArray
Definition: vtkDataObjectToDataSetFilter.h:361
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
VTK_RECTILINEAR_GRID
#define VTK_RECTILINEAR_GRID
Definition: vtkType.h:88
vtkDataObjectToDataSetFilter::OriginArray
char * OriginArray
Definition: vtkDataObjectToDataSetFilter.h:357
vtkDataObjectToDataSetFilter::DataSetType
int DataSetType
Definition: vtkDataObjectToDataSetFilter.h:303
vtkDataObjectToDataSetFilter::DimensionsArrayComponent
int DimensionsArrayComponent
Definition: vtkDataObjectToDataSetFilter.h:354
vtkDataSetAlgorithm::RequestInformation
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when a request asks for Information.
Definition: vtkDataSetAlgorithm.h:140
vtkDataSetAlgorithm::GetInput
vtkDataObject * GetInput()
Get the input data object.
VTK_STRUCTURED_GRID
#define VTK_STRUCTURED_GRID
Definition: vtkType.h:87
vtkDataObjectToDataSetFilter::CellTypeArray
char * CellTypeArray
Definition: vtkDataObjectToDataSetFilter.h:329