MeshlessHarmonicVolumeMapper.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_MeshlessHarmonicVolumeMapper_H
21 #define MIRTK_MeshlessHarmonicVolumeMapper_H
22 
23 #include "mirtk/MeshlessVolumeMapper.h"
24 
25 #include "mirtk/Matrix.h"
26 
27 
28 namespace mirtk {
29 
30 
31 /**
32  * Harmonic volumetric map using the method of fundamental solutions (MFS)
33  *
34  * This class finds a harmonic volumetric map which maps each point of the
35  * input volume to a point in the target domain using the method of fundamental
36  * solutions (MFS).
37  *
38  * - Li et al. (2009). Meshless harmonic volumetric mapping using fundamental solution methods.
39  * IEEE Transactions on Automation Science and Engineering, 6(3), 409–422.
40  * - Li et al. (2010). Feature-aligned harmonic volumetric mapping using MFS.
41  * Computers and Graphics (Pergamon), 34(3), 242–251.
42  */
44 {
45  mirtkObjectMacro(MeshlessHarmonicVolumeMapper);
46 
47  // ---------------------------------------------------------------------------
48  // Attributes
49 
50  /// Precomputed kernel function values
51  mirtkAttributeMacro(Matrix, Kernel);
52 
53  /// Whether to use SVD to solve linear system
54  mirtkPublicAttributeMacro(bool, UseSVD);
55 
56  /// Copy attributes of this class from another instance
57  void CopyAttributes(const MeshlessHarmonicVolumeMapper &);
58 
59  // ---------------------------------------------------------------------------
60  // Construction/Destruction
61 
62 public:
63 
64  /// Default constructor
66 
67  /// Copy constructor
69 
70  /// Assignment operator
72 
73  /// Destructor
75 
76  // ---------------------------------------------------------------------------
77  // Execution
78 
79 protected:
80 
81  /// Initialize filter after input and parameters are set
82  virtual void Initialize();
83 
84  /// Add source point after filter initialization
85  ///
86  /// \param[in] q Source point coordinates.
87  ///
88  /// \returns Whether source point was added or too close to existing point.
89  virtual bool AddSourcePoint(double q[3]);
90 
91  /// Compute meshless map coefficients
92  virtual void Solve();
93 
94  // ---------------------------------------------------------------------------
95  // Linear system
96 
97  /// Get coefficients matrix corresponding to the least squares fitting term(s)
98  /// of the quadratic energy function at constraints points
99  ///
100  /// \param[in] k Index of source points subset.
101  /// \param[out] coeff Coefficients matrix.
102  virtual void GetCoefficients(int k, Matrix &coeff) const;
103 
104  /// Get right-hand side of linear system
105  ///
106  /// \param[in] k Index of source points subset.
107  /// \param[out] b Right-hand side of linear system.
108  virtual void GetConstraints(int k, Matrix &b) const;
109 
110  /// Add solution of linear system to weights of volumetric map
111  ///
112  /// \param[in] k Index of source points subset.
113  /// \param[in] w Solution of linear system.
114  virtual void AddWeights(int k, const Matrix &w);
115 
116 };
117 
118 
119 } // namespace mirtk
120 
121 #endif // MIRTK_MeshlessHarmonicVolumeMapper_H
virtual void Solve()
Compute meshless map coefficients.
MeshlessHarmonicVolumeMapper & operator=(const MeshlessHarmonicVolumeMapper &)
Assignment operator.
virtual void Initialize()
Initialize filter after input and parameters are set.
virtual bool AddSourcePoint(double q[3])
virtual ~MeshlessHarmonicVolumeMapper()
Destructor.
virtual void GetConstraints(int k, Matrix &b) const
Definition: IOConfig.h:41
virtual void AddWeights(int k, const Matrix &w)
MeshlessHarmonicVolumeMapper()
Default constructor.
virtual void GetCoefficients(int k, Matrix &coeff) const