CellDataFilter.h
1 /*
2  * Medical Image Registration ToolKit (MIRTK)
3  *
4  * Copyright 2016 Imperial College London
5  * Copyright 2016 Andreas Schuh
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 #ifndef MIRTK_CellDataFilter_H
21 #define MIRTK_CellDataFilter_H
22 
23 #include "mirtk/MeshFilter.h"
24 
25 #include "mirtk/Memory.h"
26 #include "mirtk/SparseMatrix.h"
27 
28 #include "vtkSmartPointer.h"
29 #include "vtkDataArray.h"
30 #include "vtkCellData.h"
31 
32 
33 namespace mirtk {
34 
35 
36 /**
37  * Filter for mesh cell data
38  */
39 class CellDataFilter : public MeshFilter
40 {
41  mirtkAbstractMacro(CellDataFilter);
42 
43  // ---------------------------------------------------------------------------
44  // Attributes
45 
46  /// Name of (input and) output cell data array
47  ///
48  /// When an input _DataArray is given, this name is assigned to the respective
49  /// output cell data array. Otherwise, the name of the input data array must
50  /// be set and is used also for the output data array. When no input _DataArray
51  /// is given, the name of the cell data array of the input mesh must be set.
52  mirtkPublicAttributeMacro(string, DataName);
53 
54  /// Input cell data array
55  mirtkPublicAttributeMacro(vtkSmartPointer<vtkDataArray>, InputData);
56 
57  /// Output cell data array
58  mirtkPublicAttributeMacro(vtkSmartPointer<vtkDataArray>, OutputData);
59 
60  /// Copy attributes of this filter from another instance
61  void CopyAttributes(const CellDataFilter &);
62 
63  // ---------------------------------------------------------------------------
64  // Construction/Destruction
65 
66 protected:
67 
68  /// Default constructor
70 
71  /// Copy constructor
73 
74  /// Assignment operator
76 
77  /// Destructor
78  virtual ~CellDataFilter();
79 
80  // ---------------------------------------------------------------------------
81  // Execution
82 
83 protected:
84 
85  /// Initialize filter after input and parameters are set
86  virtual void Initialize();
87 
88 public:
89 
90  /// Get cell neighbors sharing a node with the specified cell
91  void GetNodeNeighbors(int, UnorderedSet<int> &) const;
92 
93  /// Get cell neighbors sharing an edge with the specified cell
94  void GetEdgeNeighbors(int, UnorderedSet<int> &) const;
95 
96 };
97 
98 
99 } // namespace mirtk
100 
101 #endif // MIRTK_CellDataFilter_H
virtual void Initialize()
Initialize filter after input and parameters are set.
void GetEdgeNeighbors(int, UnorderedSet< int > &) const
Get cell neighbors sharing an edge with the specified cell.
void GetNodeNeighbors(int, UnorderedSet< int > &) const
Get cell neighbors sharing a node with the specified cell.
Definition: IOConfig.h:41
CellDataFilter & operator=(const CellDataFilter &)
Assignment operator.
CellDataFilter()
Default constructor.
virtual ~CellDataFilter()
Destructor.