MeshlessHarmonicMap.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_MeshlessHarmonicMap_H
21 #define MIRTK_MeshlessHarmonicMap_H
22 
23 #include "mirtk/MeshlessMap.h"
24 
25 #include "mirtk/Math.h"
26 #include "mirtk/PointSet.h"
27 #include "mirtk/Vector.h"
28 
29 
30 namespace mirtk {
31 
32 
33 /**
34  * Harmonic map computed with the method of fundamental solutions (MFS)
35  *
36  * Li et al. (2009). Meshless harmonic volumetric mapping using fundamental solution methods.
37  * IEEE Transactions on Automation Science and Engineering, 6(3), 409–422.
38  */
40 {
41  mirtkObjectMacro(MeshlessHarmonicMap);
42 
43 public:
44 
45  // ---------------------------------------------------------------------------
46  // Auxiliaries
47 
48  /// Harmonic kernel function
49  ///
50  /// \param[in] d Distance of point to source point.
51  ///
52  /// \returns Harmonic kernel function value.
53  static double H(double d);
54 
55  // ---------------------------------------------------------------------------
56  // Construction/Destruction
57 
58  /// Default constructor
60 
61  /// Copy constructor
63 
64  /// Assignment operator
66 
67  /// Make deep copy of this volumetric map
68  virtual Mapping *NewCopy() const;
69 
70  /// Destructor
71  virtual ~MeshlessHarmonicMap();
72 
73  // ---------------------------------------------------------------------------
74  // Evaluation
75 
76  // Import other overloads
78 
79  /// Evaluate map at a given point
80  ///
81  /// \param[out] v Map value.
82  /// \param[in] x Coordinate of point along x axis at which to evaluate map.
83  /// \param[in] y Coordinate of point along y axis at which to evaluate map.
84  /// \param[in] z Coordinate of point along z axis at which to evaluate map.
85  ///
86  /// \returns Whether input point is inside map domain.
87  virtual bool Evaluate(double *v, double x, double y, double z = .0) const;
88 
89  /// Evaluate map at a given point
90  ///
91  /// \param[in] x Coordinate of point along x axis at which to evaluate map.
92  /// \param[in] y Coordinate of point along y axis at which to evaluate map.
93  /// \param[in] z Coordinate of point along z axis at which to evaluate map.
94  /// \param[in] l Index of map value component.
95  ///
96  /// \returns The l-th component of the map value evaluated at the given point
97  /// or the \c OutsideValue when input point is outside the map domain.
98  virtual double Evaluate(double x, double y, double z = .0, int l = 0) const;
99 
100 };
101 
102 ////////////////////////////////////////////////////////////////////////////////
103 // Inline definitions
104 ////////////////////////////////////////////////////////////////////////////////
105 
106 // -----------------------------------------------------------------------------
107 inline double MeshlessHarmonicMap::H(double d)
108 {
109  return .25 / (d * pi);
110 }
111 
112 
113 } // namespace mirtk
114 
115 #endif // MIRTK_MeshlessHarmonicMap_H
virtual bool Evaluate(double *v, double x, double y, double z=0) const =0
MeshlessHarmonicMap & operator=(const MeshlessHarmonicMap &)
Assignment operator.
MIRTK_Common_EXPORT const double pi
Constant value of .
Definition: IOConfig.h:41
virtual bool Evaluate(double *v, double x, double y, double z=.0) const
MeshlessHarmonicMap()
Default constructor.
virtual ~MeshlessHarmonicMap()
Destructor.
static double H(double d)
virtual Mapping * NewCopy() const
Make deep copy of this volumetric map.