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 =========================================================================*/
71 #ifndef vtkDataObjectToDataSetFilter_h
72 #define vtkDataObjectToDataSetFilter_h
73 
74 #include "vtkFiltersCoreModule.h" // For export macro
75 #include "vtkDataSetAlgorithm.h"
76 
77 class vtkCellArray;
78 class vtkDataArray;
79 class vtkDataSet;
80 class vtkPointSet;
81 class vtkPolyData;
82 class vtkRectilinearGrid;
83 class vtkStructuredGrid;
86 
87 class VTKFILTERSCORE_EXPORT vtkDataObjectToDataSetFilter : public vtkDataSetAlgorithm
88 {
89 public:
92  void PrintSelf(ostream& os, vtkIndent indent) override;
93 
98 
100 
103  void SetDataSetType(int);
104  vtkGetMacro(DataSetType,int);
106  this->SetDataSetType(VTK_POLY_DATA);};
108  this->SetDataSetType(VTK_STRUCTURED_POINTS);};
110  this->SetDataSetType(VTK_STRUCTURED_GRID);};
112  this->SetDataSetType(VTK_RECTILINEAR_GRID);};
114  this->SetDataSetType(VTK_UNSTRUCTURED_GRID);};
116 
118 
126  vtkDataSet *GetOutput(int idx);
133 
135 
147  void SetPointComponent(int comp, const char *arrayName, int arrayComp,
148  int min, int max, int normalize);
149  void SetPointComponent(int comp, const char *arrayName, int arrayComp)
150  {this->SetPointComponent(comp, arrayName, arrayComp, -1, -1, this->DefaultNormalize);};
151  const char *GetPointComponentArrayName(int comp);
152  int GetPointComponentArrayComponent(int comp);
153  int GetPointComponentMinRange(int comp);
154  int GetPointComponentMaxRange(int comp);
155  int GetPointComponentNormailzeFlag(int comp);
157 
159 
168  void SetVertsComponent(const char *arrayName, int arrayComp, int min, int max);
169  void SetVertsComponent(const char *arrayName, int arrayComp)
170  {this->SetVertsComponent(arrayName, arrayComp, -1, -1);};
171  const char *GetVertsComponentArrayName();
172  int GetVertsComponentArrayComponent();
173  int GetVertsComponentMinRange();
174  int GetVertsComponentMaxRange();
175  void SetLinesComponent(const char *arrayName, int arrayComp, int min, int max);
176  void SetLinesComponent(const char *arrayName, int arrayComp)
177  {this->SetLinesComponent(arrayName, arrayComp, -1, -1);};
178  const char *GetLinesComponentArrayName();
179  int GetLinesComponentArrayComponent();
180  int GetLinesComponentMinRange();
181  int GetLinesComponentMaxRange();
182  void SetPolysComponent(const char *arrayName, int arrayComp, int min, int max);
183  void SetPolysComponent(const char *arrayName, int arrayComp)
184  {this->SetPolysComponent(arrayName, arrayComp, -1, -1);};
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  {this->SetStripsComponent(arrayName, arrayComp, -1, -1);};
192  const char *GetStripsComponentArrayName();
193  int GetStripsComponentArrayComponent();
194  int GetStripsComponentMinRange();
195  int GetStripsComponentMaxRange();
197 
199 
208  void SetCellTypeComponent(const char *arrayName, int arrayComp,
209  int min, int max);
210  void SetCellTypeComponent(const char *arrayName, int arrayComp)
211  {this->SetCellTypeComponent(arrayName, arrayComp, -1, -1);};
212  const char *GetCellTypeComponentArrayName();
213  int GetCellTypeComponentArrayComponent();
214  int GetCellTypeComponentMinRange();
215  int GetCellTypeComponentMaxRange();
216  void SetCellConnectivityComponent(const char *arrayName, int arrayComp,
217  int min, int max);
218  void SetCellConnectivityComponent(const char *arrayName, int arrayComp)
219  {this->SetCellConnectivityComponent(arrayName, arrayComp, -1, -1);};
220  const char *GetCellConnectivityComponentArrayName();
221  int GetCellConnectivityComponentArrayComponent();
222  int GetCellConnectivityComponentMinRange();
223  int GetCellConnectivityComponentMaxRange();
225 
227 
231  vtkSetMacro(DefaultNormalize,vtkTypeBool);
232  vtkGetMacro(DefaultNormalize,vtkTypeBool);
233  vtkBooleanMacro(DefaultNormalize,vtkTypeBool);
235 
237 
242  vtkSetVector3Macro(Dimensions,int);
243  vtkGetVectorMacro(Dimensions,int,3);
245 
247 
251  vtkSetVector3Macro(Origin,double);
252  vtkGetVectorMacro(Origin,double,3);
254 
256 
260  vtkSetVector3Macro(Spacing,double);
261  vtkGetVectorMacro(Spacing,double,3);
263 
265 
271  void SetDimensionsComponent(const char *arrayName, int arrayComp, int min, int max);
272  void SetDimensionsComponent(const char *arrayName, int arrayComp)
273  {this->SetDimensionsComponent(arrayName, arrayComp, -1, -1);};
274  void SetSpacingComponent(const char *arrayName, int arrayComp, int min, int max);
275  void SetSpacingComponent(const char *arrayName, int arrayComp)
276  {this->SetSpacingComponent(arrayName, arrayComp, -1, -1);};
277  void SetOriginComponent(const char *arrayName, int arrayComp, int min, int max);
278  void SetOriginComponent(const char *arrayName, int arrayComp)
279  {this->SetOriginComponent(arrayName, arrayComp, -1, -1);};
281 
282 protected:
284  ~vtkDataObjectToDataSetFilter() override;
285 
286  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override; //generate output data
289  int FillInputPortInformation(int port, vtkInformation *info) override;
291  vtkInformationVector *) override;
292 
293  char Updating;
294 
295  // control flags used to generate the output dataset
296  int DataSetType; //the type of dataset to generate
297 
298  // Support definition of points
299  char *PointArrays[3]; //the name of the arrays
300  int PointArrayComponents[3]; //the array components used for x-y-z
301  vtkIdType PointComponentRange[3][2]; //the range of the components to use
302  int PointNormalize[3]; //flags control normalization
303 
304  // These define cells for vtkPolyData
305  char *VertsArray; //the name of the array
306  int VertsArrayComponent; //the array component
307  vtkIdType VertsComponentRange[2]; //the range of the components to use
308 
309  char *LinesArray; //the name of the array
310  int LinesArrayComponent; //the array component used for cell types
311  vtkIdType LinesComponentRange[2]; //the range of the components to use
312 
313  char *PolysArray; //the name of the array
314  int PolysArrayComponent; //the array component
315  vtkIdType PolysComponentRange[2]; //the range of the components to use
316 
317  char *StripsArray; //the name of the array
318  int StripsArrayComponent; //the array component
319  vtkIdType StripsComponentRange[2]; //the range of the components to use
320 
321  // Used to define vtkUnstructuredGrid datasets
322  char *CellTypeArray; //the name of the array
323  int CellTypeArrayComponent; //the array component used for cell types
324  vtkIdType CellTypeComponentRange[2]; //the range of the components to use
325 
326  char *CellConnectivityArray; //the name of the array
327  int CellConnectivityArrayComponent; //the array components used for cell connectivity
328  vtkIdType CellConnectivityComponentRange[2]; //the range of the components to use
329 
330  // helper methods (and attributes) to construct datasets
331  void SetArrayName(char* &name, char *newName);
332  vtkIdType ConstructPoints(vtkDataObject *input, vtkPointSet *ps);
333  vtkIdType ConstructPoints(vtkDataObject *input, vtkRectilinearGrid *rg);
334  int ConstructCells(vtkDataObject *input, vtkPolyData *pd);
335  int ConstructCells(vtkDataObject *input, vtkUnstructuredGrid *ug);
336  vtkCellArray *ConstructCellArray(vtkDataArray *da, int comp,
337  vtkIdType compRange[2]);
338 
339  // Default value for normalization
341 
342  // Couple of different ways to specify dimensions, spacing, and origin.
343  int Dimensions[3];
344  double Origin[3];
345  double Spacing[3];
346 
347  char *DimensionsArray; //the name of the array
348  int DimensionsArrayComponent; //the component of the array used for dimensions
349  vtkIdType DimensionsComponentRange[2]; //the ComponentRange of the array for the dimensions
350 
351  char *OriginArray; //the name of the array
352  int OriginArrayComponent; //the component of the array used for Origins
353  vtkIdType OriginComponentRange[2]; //the ComponentRange of the array for the Origins
354 
355  char *SpacingArray; //the name of the array
356  int SpacingArrayComponent; //the component of the array used for Spacings
357  vtkIdType SpacingComponentRange[2]; //the ComponentRange of the array for the Spacings
358 
359  void ConstructDimensions(vtkDataObject *input);
360  void ConstructSpacing(vtkDataObject *input);
361  void ConstructOrigin(vtkDataObject *input);
362 
363 private:
365  void operator=(const vtkDataObjectToDataSetFilter&) = delete;
366 };
367 
368 #endif
vtkDataObjectToDataSetFilter
map field data to concrete dataset
Definition: vtkDataObjectToDataSetFilter.h:87
vtkDataObjectToDataSetFilter::LinesArrayComponent
int LinesArrayComponent
Definition: vtkDataObjectToDataSetFilter.h:310
vtkStructuredPoints
A subclass of ImageData.
Definition: vtkStructuredPoints.h:39
vtkDataObjectToDataSetFilter::SetDimensionsComponent
void SetDimensionsComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:272
vtkDataSetAlgorithm::GetRectilinearGridOutput
vtkRectilinearGrid * GetRectilinearGridOutput()
Get the output as vtkRectilinearGrid.
vtkDataObjectToDataSetFilter::SetCellTypeComponent
void SetCellTypeComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:210
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkDataObjectToDataSetFilter::DefaultNormalize
vtkTypeBool DefaultNormalize
Definition: vtkDataObjectToDataSetFilter.h:340
vtkDataObjectToDataSetFilter::VertsArray
char * VertsArray
Definition: vtkDataObjectToDataSetFilter.h:305
vtkDataObjectToDataSetFilter::SetCellConnectivityComponent
void SetCellConnectivityComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:218
vtkRectilinearGrid
a dataset that is topologically regular with variable spacing in the three coordinate directions
Definition: vtkRectilinearGrid.h:56
vtkDataObjectToDataSetFilter::VertsArrayComponent
int VertsArrayComponent
Definition: vtkDataObjectToDataSetFilter.h:306
vtkDataObjectToDataSetFilter::LinesArray
char * LinesArray
Definition: vtkDataObjectToDataSetFilter.h:309
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkDataObjectToDataSetFilter::OriginArrayComponent
int OriginArrayComponent
Definition: vtkDataObjectToDataSetFilter.h:352
vtkDataSetAlgorithm::GetStructuredPointsOutput
vtkStructuredPoints * GetStructuredPointsOutput()
Get the output as vtkStructuredPoints.
vtkDataObjectToDataSetFilter::SetDataSetTypeToRectilinearGrid
void SetDataSetTypeToRectilinearGrid()
Definition: vtkDataObjectToDataSetFilter.h:111
vtkStructuredGrid
topologically regular array of data
Definition: vtkStructuredGrid.h:63
vtkDataObjectToDataSetFilter::PolysArrayComponent
int PolysArrayComponent
Definition: vtkDataObjectToDataSetFilter.h:314
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:54
vtkDataObjectToDataSetFilter::SetOriginComponent
void SetOriginComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:278
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:275
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:356
vtkDataObjectToDataSetFilter::SetDataSetTypeToStructuredGrid
void SetDataSetTypeToStructuredGrid()
Definition: vtkDataObjectToDataSetFilter.h:109
vtkDataObjectToDataSetFilter::SetPointComponent
void SetPointComponent(int comp, const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:149
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:323
vtkDataSetAlgorithm::GetPolyDataOutput
vtkPolyData * GetPolyDataOutput()
Get the output as vtkPolyData.
vtkDataObjectToDataSetFilter::SetVertsComponent
void SetVertsComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:169
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:50
vtkDataSetAlgorithm::New
static vtkDataSetAlgorithm * New()
vtkDataObjectToDataSetFilter::StripsArray
char * StripsArray
Definition: vtkDataObjectToDataSetFilter.h:317
vtkDataObjectToDataSetFilter::StripsArrayComponent
int StripsArrayComponent
Definition: vtkDataObjectToDataSetFilter.h:318
vtkDataObjectToDataSetFilter::SetLinesComponent
void SetLinesComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:176
vtkX3D::name
Definition: vtkX3D.h:219
vtkDataObjectToDataSetFilter::CellConnectivityArray
char * CellConnectivityArray
Definition: vtkDataObjectToDataSetFilter.h:326
vtkDataObjectToDataSetFilter::SetDataSetTypeToUnstructuredGrid
void SetDataSetTypeToUnstructuredGrid()
Definition: vtkDataObjectToDataSetFilter.h:113
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkX3D::info
Definition: vtkX3D.h:376
vtkDataSetAlgorithm.h
vtkDataObjectToDataSetFilter::PolysArray
char * PolysArray
Definition: vtkDataObjectToDataSetFilter.h:313
vtkDataObjectToDataSetFilter::SetDataSetTypeToPolyData
void SetDataSetTypeToPolyData()
Definition: vtkDataObjectToDataSetFilter.h:105
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:42
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkDataObjectToDataSetFilter::SetStripsComponent
void SetStripsComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:190
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:293
vtkUnstructuredGrid
dataset represents arbitrary combinations of all possible cell types
Definition: vtkUnstructuredGrid.h:87
vtkDataObjectToDataSetFilter::CellConnectivityArrayComponent
int CellConnectivityArrayComponent
Definition: vtkDataObjectToDataSetFilter.h:327
vtkDataObjectToDataSetFilter::SetDataSetTypeToStructuredPoints
void SetDataSetTypeToStructuredPoints()
Definition: vtkDataObjectToDataSetFilter.h:107
VTK_UNSTRUCTURED_GRID
#define VTK_UNSTRUCTURED_GRID
Definition: vtkType.h:95
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:64
vtkDataObjectToDataSetFilter::DimensionsArray
char * DimensionsArray
Definition: vtkDataObjectToDataSetFilter.h:347
vtkDataObjectToDataSetFilter::SetPolysComponent
void SetPolysComponent(const char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:183
VTK_POLY_DATA
#define VTK_POLY_DATA
Definition: vtkType.h:91
vtkDataObjectToDataSetFilter::SpacingArray
char * SpacingArray
Definition: vtkDataObjectToDataSetFilter.h:355
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:351
vtkDataObjectToDataSetFilter::DataSetType
int DataSetType
Definition: vtkDataObjectToDataSetFilter.h:296
vtkDataObjectToDataSetFilter::DimensionsArrayComponent
int DimensionsArrayComponent
Definition: vtkDataObjectToDataSetFilter.h:348
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:322