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) VTK_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, char *arrayName, int arrayComp,
148  int min, int max, int normalize);
149  void SetPointComponent(int comp, 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(char *arrayName, int arrayComp, int min, int max);
169  void SetVertsComponent(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(char *arrayName, int arrayComp, int min, int max);
176  void SetLinesComponent(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(char *arrayName, int arrayComp, int min, int max);
183  void SetPolysComponent(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(char *arrayName, int arrayComp, int min, int max);
190  void SetStripsComponent(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(char *arrayName, int arrayComp,
209  int min, int max);
210  void SetCellTypeComponent(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(char *arrayName, int arrayComp,
217  int min, int max);
218  void SetCellConnectivityComponent(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,int);
232  vtkGetMacro(DefaultNormalize,int);
233  vtkBooleanMacro(DefaultNormalize,int);
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(char *arrayName, int arrayComp, int min, int max);
272  void SetDimensionsComponent(char *arrayName, int arrayComp)
273  {this->SetDimensionsComponent(arrayName, arrayComp, -1, -1);};
274  void SetSpacingComponent(char *arrayName, int arrayComp, int min, int max);
275  void SetSpacingComponent(char *arrayName, int arrayComp)
276  {this->SetSpacingComponent(arrayName, arrayComp, -1, -1);};
277  void SetOriginComponent(char *arrayName, int arrayComp, int min, int max);
278  void SetOriginComponent(char *arrayName, int arrayComp)
279  {this->SetOriginComponent(arrayName, arrayComp, -1, -1);};
281 
282 protected:
284  ~vtkDataObjectToDataSetFilter() VTK_OVERRIDE;
285 
286  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE; //generate output data
287  int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
288  int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
289  int FillInputPortInformation(int port, vtkInformation *info) VTK_OVERRIDE;
290  int RequestDataObject(vtkInformation *, vtkInformationVector **,
291  vtkInformationVector *) VTK_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
340  int DefaultNormalize;
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&) VTK_DELETE_FUNCTION;
366 };
367 
368 #endif
vtkDataObjectToDataSetFilter
map field data to concrete dataset
Definition: vtkDataObjectToDataSetFilter.h:87
vtkStructuredPoints
A subclass of ImageData.
Definition: vtkStructuredPoints.h:39
vtkDataSetAlgorithm::GetRectilinearGridOutput
vtkRectilinearGrid * GetRectilinearGridOutput()
Get the output as vtkRectilinearGrid.
vtkDataObjectToDataSetFilter::SetCellConnectivityComponent
void SetCellConnectivityComponent(char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:218
vtkDataObjectToDataSetFilter::SetSpacingComponent
void SetSpacingComponent(char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:275
vtkDataObjectToDataSetFilter::SetPolysComponent
void SetPolysComponent(char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:183
vtkIdType
int vtkIdType
Definition: vtkType.h:287
vtkRectilinearGrid
a dataset that is topologically regular with variable spacing in the three coordinate directions
Definition: vtkRectilinearGrid.h:56
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
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::SetVertsComponent
void SetVertsComponent(char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:169
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
VTK_STRUCTURED_POINTS
#define VTK_STRUCTURED_POINTS
Definition: vtkType.h:88
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:51
vtkDataObjectToDataSetFilter::SetStripsComponent
void SetStripsComponent(char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:190
vtkX3D::port
Definition: vtkX3D.h:447
vtkDataObjectToDataSetFilter::SetDataSetTypeToStructuredGrid
void SetDataSetTypeToStructuredGrid()
Definition: vtkDataObjectToDataSetFilter.h:109
vtkDataSetAlgorithm::GetPolyDataOutput
vtkPolyData * GetPolyDataOutput()
Get the output as vtkPolyData.
vtkDataObjectToDataSetFilter::SetPointComponent
void SetPointComponent(int comp, char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:149
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:50
vtkDataObjectToDataSetFilter::SetCellTypeComponent
void SetCellTypeComponent(char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:210
vtkDataObjectToDataSetFilter::SetLinesComponent
void SetLinesComponent(char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:176
vtkDataSetAlgorithm::New
static vtkDataSetAlgorithm * New()
vtkDataObjectToDataSetFilter::SetOriginComponent
void SetOriginComponent(char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:278
vtkX3D::name
Definition: vtkX3D.h:219
vtkDataObjectToDataSetFilter::SetDataSetTypeToUnstructuredGrid
void SetDataSetTypeToUnstructuredGrid()
Definition: vtkDataObjectToDataSetFilter.h:113
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkX3D::info
Definition: vtkX3D.h:376
vtkDataSetAlgorithm.h
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
vtkUnstructuredGrid
dataset represents arbitrary combinations of all possible cell types
Definition: vtkUnstructuredGrid.h:81
vtkDataObjectToDataSetFilter::SetDataSetTypeToStructuredPoints
void SetDataSetTypeToStructuredPoints()
Definition: vtkDataObjectToDataSetFilter.h:107
VTK_UNSTRUCTURED_GRID
#define VTK_UNSTRUCTURED_GRID
Definition: vtkType.h:91
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:64
VTK_POLY_DATA
#define VTK_POLY_DATA
Definition: vtkType.h:87
VTK_RECTILINEAR_GRID
#define VTK_RECTILINEAR_GRID
Definition: vtkType.h:90
vtkDataSetAlgorithm::GetInput
vtkDataObject * GetInput()
Get the input data object.
VTK_STRUCTURED_GRID
#define VTK_STRUCTURED_GRID
Definition: vtkType.h:89
vtkDataObjectToDataSetFilter::SetDimensionsComponent
void SetDimensionsComponent(char *arrayName, int arrayComp)
Definition: vtkDataObjectToDataSetFilter.h:272