VolumeMapper.h
1 /*
2  * Medical Image Registration ToolKit (MIRTK)
3  *
4  * Copyright 2015-2016 Imperial College London
5  * Copyright 2015-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_VolumeMapper_H
21 #define MIRTK_VolumeMapper_H
22 
23 #include "mirtk/Object.h"
24 
25 #include "mirtk/Mapping.h"
26 
27 #include "vtkSmartPointer.h"
28 #include "vtkPointSet.h"
29 #include "vtkPolyData.h"
30 #include "vtkDataArray.h"
31 
32 
33 namespace mirtk {
34 
35 
36 /**
37  * Base class of volumetric map solvers
38  *
39  * Subclasses implement solvers for the computation of a volumetric map given
40  * map values on the boundary surface of the volume as boundary conditions.
41  * Whether additional interior constraints are allowed depends on the respective
42  * solver implementation.
43  */
44 class VolumeMapper : public Object
45 {
46  mirtkAbstractMacro(VolumeMapper);
47 
48  // ---------------------------------------------------------------------------
49  // Attributes
50 
51  /// Input point set (e.g., surface mesh or tetrahedral mesh)
52  mirtkPublicAttributeMacro(vtkSmartPointer<vtkPointSet>, InputSet);
53 
54  /// Input boundary map
55  mirtkPublicAttributeMacro(vtkSmartPointer<vtkDataArray>, InputMap);
56 
57  /// Boundary surface of input point set
58  mirtkAttributeMacro(vtkSmartPointer<vtkPolyData>, Boundary);
59 
60  /// Boundary surface map
61  mirtkAttributeMacro(vtkSmartPointer<vtkDataArray>, BoundaryMap);
62 
63  /// Volumetric map
64  ///
65  /// \note The output map is uninitialized! Mapping::Initialize must be
66  /// called before this map can be evaluated at map domain points.
67  mirtkReadOnlyAttributeMacro(SharedPtr<Mapping>, Output);
68 
69  /// Copy attributes of this class from another instance
70  void CopyAttributes(const VolumeMapper &);
71 
72  // ---------------------------------------------------------------------------
73  // Construction/Destruction
74 
75 protected:
76 
77  /// Default constructor
78  VolumeMapper();
79 
80  /// Copy constructor
81  VolumeMapper(const VolumeMapper &);
82 
83  /// Assignment operator
85 
86 public:
87 
88  /// Destructor
89  virtual ~VolumeMapper();
90 
91  // ---------------------------------------------------------------------------
92  // Auxiliaries
93 
94  /// Dimension of codomain of volumetric map
95  int NumberOfComponents() const;
96 
97  // ---------------------------------------------------------------------------
98  // Execution
99 
100  /// Parameterize interior of input data set
101  void Run();
102 
103 protected:
104 
105  /// Initialize filter after input and parameters are set
106  virtual void Initialize();
107 
108  /// Initialize boundary surface with corresponding boundary map as point data
109  virtual void InitializeBoundary(vtkPointSet *, vtkDataArray *);
110 
111  /// Compute map value at free points
112  virtual void Solve() = 0;
113 
114  /// Finalize filter execution
115  virtual void Finalize();
116 
117 };
118 
119 ////////////////////////////////////////////////////////////////////////////////
120 // Inline definitions
121 ////////////////////////////////////////////////////////////////////////////////
122 
123 // -----------------------------------------------------------------------------
125 {
126  return _InputMap ? static_cast<int>(_InputMap->GetNumberOfComponents()) : 0;
127 }
128 
129 
130 } // namespace mirtk
131 
132 #endif // MIRTK_VolumeMapper_H
virtual void Solve()=0
Compute map value at free points.
VolumeMapper()
Default constructor.
virtual void Finalize()
Finalize filter execution.
virtual ~VolumeMapper()
Destructor.
Definition: IOConfig.h:41
virtual void Initialize()
Initialize filter after input and parameters are set.
void Run()
Parameterize interior of input data set.
VolumeMapper & operator=(const VolumeMapper &)
Assignment operator.
virtual void InitializeBoundary(vtkPointSet *, vtkDataArray *)
Initialize boundary surface with corresponding boundary map as point data.
int NumberOfComponents() const
Dimension of codomain of volumetric map.
Definition: VolumeMapper.h:124