LinearTetrahedralMeshMapper.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_LinearTetrahedralMeshMapper_H
21 #define MIRTK_LinearTetrahedralMeshMapper_H
22 
23 #include "mirtk/TetrahedralMeshMapper.h"
24 
25 #include "mirtk/Array.h"
26 
27 
28 namespace mirtk {
29 
30 
31 // Forward declarations
32 class Matrix3x3;
33 
34 
35 /**
36  * Base class of volumetric map solvers based on discrete linear operators
37  *
38  * The volumetric map is the solution of a system of linear equations.
39  * The codomain of the volumetric map is currently restricted to 3D.
40  * This should not be a practical limitation because these filters are mainly
41  * used to parameterize a 3D volume, i.e., to map a point from one 3D domain
42  * to another 3D domain.
43  */
45 {
46  mirtkAbstractMacro(LinearTetrahedralMeshMapper);
47 
48  // ---------------------------------------------------------------------------
49  // Attributes
50 
51  /// Maximum number of linear solver iterations
52  mirtkPublicAttributeMacro(int, NumberOfIterations);
53 
54  /// Linear solver tolerance
55  mirtkPublicAttributeMacro(double, Tolerance);
56 
57  /// Relaxation factor
58  mirtkPublicAttributeMacro(double, RelaxationFactor);
59 
60  /// Original ID of n-th interior point
61  mirtkReadOnlyAttributeMacro(Array<int>, InteriorPointId);
62 
63  /// Variable/linear equation offset of n-th interior point
64  mirtkReadOnlyAttributeMacro(Array<int>, InteriorPointPos);
65 
66  /// Copy attributes of this class from another instance
67  void CopyAttributes(const LinearTetrahedralMeshMapper &);
68 
69  // ---------------------------------------------------------------------------
70  // Construction/Destruction
71 
72 protected:
73 
74  /// Default constructor
76 
77  /// Copy constructor
79 
80  /// Assignment operator
82 
83 public:
84 
85  /// Destructor
87 
88  // ---------------------------------------------------------------------------
89  // Execution
90 
91 protected:
92 
93  /// Initialize filter after input and parameters are set
94  virtual void Initialize();
95 
96  /// Parameterize interior points
97  virtual void Solve();
98 
99  /// Solve linear system with operator weights computed using the passed object
100  void Solve(const LinearTetrahedralMeshMapper *);
101 
102  // ---------------------------------------------------------------------------
103  // Auxiliary functions
104 
105 public:
106 
107  /// Calculate operator weight for given tetrahadron
108  ///
109  /// \param[in] cellId ID of tetrahedron.
110  /// \param[in] v0 First vertex/point of tetrahedron.
111  /// \param[in] v1 Second vertex/point of tetrahedron.
112  /// \param[in] v2 Third vertex/point of tetrahedron.
113  /// \param[in] v3 Fourth vertex/point of tetrahedron.
114  /// \param[in] volume Volume of tetrahedron.
115  ///
116  /// \return Operator weight contribution of tetrahedron.
117  virtual Matrix3x3 GetWeight(vtkIdType cellId,
118  const double v0[3],
119  const double v1[3],
120  const double v2[3],
121  const double v3[3],
122  double volume) const = 0;
123 
124 };
125 
126 
127 } // namespace mirtk
128 
129 #endif // MIRTK_LinearTetrahedralMeshMapper_H
LinearTetrahedralMeshMapper & operator=(const LinearTetrahedralMeshMapper &)
Assignment operator.
LinearTetrahedralMeshMapper()
Default constructor.
Definition: IOConfig.h:41
virtual void Solve()
Parameterize interior points.
virtual ~LinearTetrahedralMeshMapper()
Destructor.
virtual void Initialize()
Initialize filter after input and parameters are set.
virtual Matrix3x3 GetWeight(vtkIdType cellId, const double v0[3], const double v1[3], const double v2[3], const double v3[3], double volume) const =0