VTK
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 "vtkFiltersCoreModule.h" // For export macro
69 #include "vtkDataSetAlgorithm.h"
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);
100  this->SetDataSetType(VTK_POLY_DATA);};
102  this->SetDataSetType(VTK_STRUCTURED_POINTS);};
104  this->SetDataSetType(VTK_STRUCTURED_GRID);};
106  this->SetDataSetType(VTK_RECTILINEAR_GRID);};
108  this->SetDataSetType(VTK_UNSTRUCTURED_GRID);};
110 
112 
120  vtkDataSet *GetOutput(int idx);
127 
129 
141  void SetPointComponent(int comp, const char *arrayName, int arrayComp,
142  int min, int max, int normalize);
143  void SetPointComponent(int comp, const char *arrayName, int arrayComp)
144  {this->SetPointComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
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  {this->SetVertsComponent(arrayName, arrayComp, -1, -1);};
165  const char *GetVertsComponentArrayName();
166  int GetVertsComponentArrayComponent();
167  int GetVertsComponentMinRange();
168  int GetVertsComponentMaxRange();
169  void SetLinesComponent(const char *arrayName, int arrayComp, int min, int max);
170  void SetLinesComponent(const char *arrayName, int arrayComp)
171  {this->SetLinesComponent(arrayName, arrayComp, -1, -1);};
172  const char *GetLinesComponentArrayName();
173  int GetLinesComponentArrayComponent();
174  int GetLinesComponentMinRange();
175  int GetLinesComponentMaxRange();
176  void SetPolysComponent(const char *arrayName, int arrayComp, int min, int max);
177  void SetPolysComponent(const char *arrayName, int arrayComp)
178  {this->SetPolysComponent(arrayName, arrayComp, -1, -1);};
179  const char *GetPolysComponentArrayName();
180  int GetPolysComponentArrayComponent();
181  int GetPolysComponentMinRange();
182  int GetPolysComponentMaxRange();
183  void SetStripsComponent(const char *arrayName, int arrayComp, int min, int max);
184  void SetStripsComponent(const char *arrayName, int arrayComp)
185  {this->SetStripsComponent(arrayName, arrayComp, -1, -1);};
186  const char *GetStripsComponentArrayName();
187  int GetStripsComponentArrayComponent();
188  int GetStripsComponentMinRange();
189  int GetStripsComponentMaxRange();
191 
193 
202  void SetCellTypeComponent(const char *arrayName, int arrayComp,
203  int min, int max);
204  void SetCellTypeComponent(const char *arrayName, int arrayComp)
205  {this->SetCellTypeComponent(arrayName, arrayComp, -1, -1);};
206  const char *GetCellTypeComponentArrayName();
207  int GetCellTypeComponentArrayComponent();
208  int GetCellTypeComponentMinRange();
209  int GetCellTypeComponentMaxRange();
210  void SetCellConnectivityComponent(const char *arrayName, int arrayComp,
211  int min, int max);
212  void SetCellConnectivityComponent(const char *arrayName, int arrayComp)
213  {this->SetCellConnectivityComponent(arrayName, arrayComp, -1, -1);};
214  const char *GetCellConnectivityComponentArrayName();
215  int GetCellConnectivityComponentArrayComponent();
216  int GetCellConnectivityComponentMinRange();
217  int GetCellConnectivityComponentMaxRange();
219 
221 
225  vtkSetMacro(DefaultNormalize,vtkTypeBool);
226  vtkGetMacro(DefaultNormalize,vtkTypeBool);
227  vtkBooleanMacro(DefaultNormalize,vtkTypeBool);
229 
231 
236  vtkSetVector3Macro(Dimensions,int);
237  vtkGetVectorMacro(Dimensions,int,3);
239 
241 
245  vtkSetVector3Macro(Origin,double);
246  vtkGetVectorMacro(Origin,double,3);
248 
250 
254  vtkSetVector3Macro(Spacing,double);
255  vtkGetVectorMacro(Spacing,double,3);
257 
259 
265  void SetDimensionsComponent(const char *arrayName, int arrayComp, int min, int max);
266  void SetDimensionsComponent(const char *arrayName, int arrayComp)
267  {this->SetDimensionsComponent(arrayName, arrayComp, -1, -1);};
268  void SetSpacingComponent(const char *arrayName, int arrayComp, int min, int max);
269  void SetSpacingComponent(const char *arrayName, int arrayComp)
270  {this->SetSpacingComponent(arrayName, arrayComp, -1, -1);};
271  void SetOriginComponent(const char *arrayName, int arrayComp, int min, int max);
272  void SetOriginComponent(const char *arrayName, int arrayComp)
273  {this->SetOriginComponent(arrayName, arrayComp, -1, -1);};
275 
276 protected:
278  ~vtkDataObjectToDataSetFilter() override;
279 
280  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override; //generate output data
283  int FillInputPortInformation(int port, vtkInformation *info) override;
285  vtkInformationVector *) override;
286 
287  char Updating;
288 
289  // control flags used to generate the output dataset
290  int DataSetType; //the type of dataset to generate
291 
292  // Support definition of points
293  char *PointArrays[3]; //the name of the arrays
294  int PointArrayComponents[3]; //the array components used for x-y-z
295  vtkIdType PointComponentRange[3][2]; //the range of the components to use
296  int PointNormalize[3]; //flags control normalization
297 
298  // These define cells for vtkPolyData
299  char *VertsArray; //the name of the array
300  int VertsArrayComponent; //the array component
301  vtkIdType VertsComponentRange[2]; //the range of the components to use
302 
303  char *LinesArray; //the name of the array
304  int LinesArrayComponent; //the array component used for cell types
305  vtkIdType LinesComponentRange[2]; //the range of the components to use
306 
307  char *PolysArray; //the name of the array
308  int PolysArrayComponent; //the array component
309  vtkIdType PolysComponentRange[2]; //the range of the components to use
310 
311  char *StripsArray; //the name of the array
312  int StripsArrayComponent; //the array component
313  vtkIdType StripsComponentRange[2]; //the range of the components to use
314 
315  // Used to define vtkUnstructuredGrid datasets
316  char *CellTypeArray; //the name of the array
317  int CellTypeArrayComponent; //the array component used for cell types
318  vtkIdType CellTypeComponentRange[2]; //the range of the components to use
319 
320  char *CellConnectivityArray; //the name of the array
321  int CellConnectivityArrayComponent; //the array components used for cell connectivity
322  vtkIdType CellConnectivityComponentRange[2]; //the range of the components to use
323 
324  // helper methods (and attributes) to construct datasets
325  void SetArrayName(char* &name, char *newName);
326  vtkIdType ConstructPoints(vtkDataObject *input, vtkPointSet *ps);
327  vtkIdType ConstructPoints(vtkDataObject *input, vtkRectilinearGrid *rg);
328  int ConstructCells(vtkDataObject *input, vtkPolyData *pd);
329  int ConstructCells(vtkDataObject *input, vtkUnstructuredGrid *ug);
330  vtkCellArray *ConstructCellArray(vtkDataArray *da, int comp,
331  vtkIdType compRange[2]);
332 
333  // Default value for normalization
335 
336  // Couple of different ways to specify dimensions, spacing, and origin.
337  int Dimensions[3];
338  double Origin[3];
339  double Spacing[3];
340 
341  char *DimensionsArray; //the name of the array
342  int DimensionsArrayComponent; //the component of the array used for dimensions
343  vtkIdType DimensionsComponentRange[2]; //the ComponentRange of the array for the dimensions
344 
345  char *OriginArray; //the name of the array
346  int OriginArrayComponent; //the component of the array used for Origins
347  vtkIdType OriginComponentRange[2]; //the ComponentRange of the array for the Origins
348 
349  char *SpacingArray; //the name of the array
350  int SpacingArrayComponent; //the component of the array used for Spacings
351  vtkIdType SpacingComponentRange[2]; //the ComponentRange of the array for the Spacings
352 
353  void ConstructDimensions(vtkDataObject *input);
354  void ConstructSpacing(vtkDataObject *input);
355  void ConstructOrigin(vtkDataObject *input);
356 
357 private:
359  void operator=(const vtkDataObjectToDataSetFilter&) = delete;
360 };
361 
362 #endif
vtkDataObjectToDataSetFilter
map field data to concrete dataset
Definition: vtkDataObjectToDataSetFilter.h:81
vtkDataObjectToDataSetFilter::LinesArrayComponent
int LinesArrayComponent
Definition: vtkDataObjectToDataSetFilter.h:304
vtkStructuredPoints
A subclass of ImageData.
Definition: vtkStructuredPoints.h:36
vtkDataObjectToDataSetFilter::SetDimensionsComponent
void SetDimensionsComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:266
vtkDataSetAlgorithm::GetRectilinearGridOutput
vtkRectilinearGrid * GetRectilinearGridOutput()
Get the output as vtkRectilinearGrid.
vtkDataObjectToDataSetFilter::SetCellTypeComponent
void SetCellTypeComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:204
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkDataObjectToDataSetFilter::DefaultNormalize
vtkTypeBool DefaultNormalize
Definition: vtkDataObjectToDataSetFilter.h:334
vtkDataObjectToDataSetFilter::VertsArray
char * VertsArray
Definition: vtkDataObjectToDataSetFilter.h:299
vtkDataObjectToDataSetFilter::SetCellConnectivityComponent
void SetCellConnectivityComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:212
vtkRectilinearGrid
a dataset that is topologically regular with variable spacing in the three coordinate directions
Definition: vtkRectilinearGrid.h:50
vtkDataObjectToDataSetFilter::VertsArrayComponent
int VertsArrayComponent
Definition: vtkDataObjectToDataSetFilter.h:300
vtkDataObjectToDataSetFilter::LinesArray
char * LinesArray
Definition: vtkDataObjectToDataSetFilter.h:303
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkDataObjectToDataSetFilter::OriginArrayComponent
int OriginArrayComponent
Definition: vtkDataObjectToDataSetFilter.h:346
vtkDataSetAlgorithm::GetStructuredPointsOutput
vtkStructuredPoints * GetStructuredPointsOutput()
Get the output as vtkStructuredPoints.
vtkDataObjectToDataSetFilter::SetDataSetTypeToRectilinearGrid
void SetDataSetTypeToRectilinearGrid()
Definition: vtkDataObjectToDataSetFilter.h:105
vtkStructuredGrid
topologically regular array of data
Definition: vtkStructuredGrid.h:57
vtkDataObjectToDataSetFilter::PolysArrayComponent
int PolysArrayComponent
Definition: vtkDataObjectToDataSetFilter.h:308
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:180
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
vtkDataObjectToDataSetFilter::SetOriginComponent
void SetOriginComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:272
VTK_STRUCTURED_POINTS
#define VTK_STRUCTURED_POINTS
Definition: vtkType.h:92
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:269
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
Definition: vtkX3D.h:447
vtkDataObjectToDataSetFilter::SpacingArrayComponent
int SpacingArrayComponent
Definition: vtkDataObjectToDataSetFilter.h:350
vtkDataObjectToDataSetFilter::SetDataSetTypeToStructuredGrid
void SetDataSetTypeToStructuredGrid()
Definition: vtkDataObjectToDataSetFilter.h:103
vtkDataObjectToDataSetFilter::SetPointComponent
void SetPointComponent(int comp, const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:143
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:317
vtkDataSetAlgorithm::GetPolyDataOutput
vtkPolyData * GetPolyDataOutput()
Get the output as vtkPolyData.
vtkDataObjectToDataSetFilter::SetVertsComponent
void SetVertsComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:163
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:44
vtkDataSetAlgorithm::New
static vtkDataSetAlgorithm * New()
vtkDataObjectToDataSetFilter::StripsArray
char * StripsArray
Definition: vtkDataObjectToDataSetFilter.h:311
vtkDataObjectToDataSetFilter::StripsArrayComponent
int StripsArrayComponent
Definition: vtkDataObjectToDataSetFilter.h:312
vtkDataObjectToDataSetFilter::SetLinesComponent
void SetLinesComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:170
vtkX3D::name
Definition: vtkX3D.h:219
vtkDataObjectToDataSetFilter::CellConnectivityArray
char * CellConnectivityArray
Definition: vtkDataObjectToDataSetFilter.h:320
vtkDataObjectToDataSetFilter::SetDataSetTypeToUnstructuredGrid
void SetDataSetTypeToUnstructuredGrid()
Definition: vtkDataObjectToDataSetFilter.h:107
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:80
vtkX3D::info
Definition: vtkX3D.h:376
vtkDataSetAlgorithm.h
vtkDataObjectToDataSetFilter::PolysArray
char * PolysArray
Definition: vtkDataObjectToDataSetFilter.h:307
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:39
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
vtkDataObjectToDataSetFilter::SetStripsComponent
void SetStripsComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:184
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:287
vtkUnstructuredGrid
dataset represents arbitrary combinations of all possible cell types
Definition: vtkUnstructuredGrid.h:81
vtkDataObjectToDataSetFilter::CellConnectivityArrayComponent
int CellConnectivityArrayComponent
Definition: vtkDataObjectToDataSetFilter.h:321
vtkDataObjectToDataSetFilter::SetDataSetTypeToStructuredPoints
void SetDataSetTypeToStructuredPoints()
Definition: vtkDataObjectToDataSetFilter.h:101
VTK_UNSTRUCTURED_GRID
#define VTK_UNSTRUCTURED_GRID
Definition: vtkType.h:95
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:58
vtkDataObjectToDataSetFilter::DimensionsArray
char * DimensionsArray
Definition: vtkDataObjectToDataSetFilter.h:341
vtkDataObjectToDataSetFilter::SetPolysComponent
void SetPolysComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:177
VTK_POLY_DATA
#define VTK_POLY_DATA
Definition: vtkType.h:91
vtkDataObjectToDataSetFilter::SpacingArray
char * SpacingArray
Definition: vtkDataObjectToDataSetFilter.h:349
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
VTK_RECTILINEAR_GRID
#define VTK_RECTILINEAR_GRID
Definition: vtkType.h:94
vtkDataObjectToDataSetFilter::OriginArray
char * OriginArray
Definition: vtkDataObjectToDataSetFilter.h:345
vtkDataObjectToDataSetFilter::DataSetType
int DataSetType
Definition: vtkDataObjectToDataSetFilter.h:290
vtkDataObjectToDataSetFilter::DimensionsArrayComponent
int DimensionsArrayComponent
Definition: vtkDataObjectToDataSetFilter.h:342
vtkDataSetAlgorithm::RequestInformation
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when a request asks for Information.
Definition: vtkDataSetAlgorithm.h:141
vtkDataSetAlgorithm::GetInput
vtkDataObject * GetInput()
Get the input data object.
VTK_STRUCTURED_GRID
#define VTK_STRUCTURED_GRID
Definition: vtkType.h:93
vtkDataObjectToDataSetFilter::CellTypeArray
char * CellTypeArray
Definition: vtkDataObjectToDataSetFilter.h:316