ClosestCell.h
1 /*
2  * Medical Image Registration ToolKit (MIRTK)
3  *
4  * Copyright 2013-2015 Imperial College London
5  * Copyright 2013-2015 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_ClosestCell_H
21 #define MIRTK_ClosestCell_H
22 
23 #include "mirtk/PointCorrespondence.h"
24 
25 #include "mirtk/Array.h"
26 #include "mirtk/PointSet.h"
27 
28 
29 namespace mirtk {
30 
31 
32 /**
33  * Closest point on line/surface correspondence map
34  */
36 {
37  mirtkObjectMacro(ClosestCell);
38 
39  // ---------------------------------------------------------------------------
40  // Types
41 public:
42 
43  /// Enumeration value of supported cell locators
44  enum LocatorType { Default, CellTree, BSPTree, OBBTree };
45 
46  // ---------------------------------------------------------------------------
47  // Attributes
48 protected:
49 
50  /// Type of point locator
52 
53  /// Number of cells per node
54  mirtkPublicAttributeMacro(int, NumberOfCellsPerNode);
55 
56  /// Mark correspondences with distance greater than the mean distance plus
57  /// _Sigma times the standard deviation of the current point distances as outliers
58  mirtkPublicAttributeMacro(double, Sigma);
59 
60  /// Mark correspondences with distance greater than this as outliers
61  /// If _Sigma is positive, it is used to set this attribute automatically
62  mirtkPublicAttributeMacro(double, MaxDistance);
63 
64  /// Target points corresponding to source points
65  mirtkAttributeMacro(PointSet, TargetPoints);
66 
67  /// Distance of target points from source points
68  mirtkAttributeMacro(Array<double>, TargetDistance);
69 
70  /// Source points corresponding to target points
71  mirtkAttributeMacro(PointSet, SourcePoints);
72 
73  /// Distance of source points from target points
74  mirtkAttributeMacro(Array<double>, SourceDistance);
75 
76  // ---------------------------------------------------------------------------
77  // Construction/Destruction
78 public:
79 
80  /// Constructor
81  ClosestCell();
82 
83  /// Copy constructor
84  ClosestCell(const ClosestCell &);
85 
86  /// Copy construct a new instance
87  virtual PointCorrespondence *NewInstance() const;
88 
89  /// Destructor
90  virtual ~ClosestCell();
91 
92  /// Type enumeration value
93  virtual TypeId Type() const;
94 
95  // ---------------------------------------------------------------------------
96  // Parameters
97 
98  // Import other overloads
100 
101  /// Set parameter value from string
102  virtual bool Set(const char *, const char *);
103 
104  /// Get parameter key/value as string map
105  virtual ParameterList Parameter() const;
106 
107  // ---------------------------------------------------------------------------
108  // Correspondences
109 
110  /// Initialize correspondence map
111  virtual void Initialize();
112 
113  /// Update correspondence map
114  virtual void Update();
115 
116  /// Update correspondence map after convergence
117  virtual bool Upgrade();
118 
119  /// Get untransformed target point corresponding to i-th source (sample) point
120  virtual bool GetInputTargetPoint(int, Point &) const;
121 
122  /// Get untransformed source point corresponding to i-th target (sample) point
123  virtual bool GetInputSourcePoint(int, Point &) const;
124 
125  /// Get (transformed) target point corresponding to i-th source (sample) point
126  virtual bool GetTargetPoint(int, Point &) const;
127 
128  /// Get (transformed) source point corresponding to i-th target (sample) point
129  virtual bool GetSourcePoint(int, Point &) const;
130 
131 };
132 
133 
134 } // namespace mirtk
135 
136 #endif // MIRTK_ClosestCell_H
TypeId
Enumeration of available point correspondence maps.
virtual ParameterList Parameter() const
Get parameter key/value as string map.
virtual bool Set(const char *, const char *)
Set parameter value from string.
virtual void Initialize()
Initialize correspondence map.
virtual bool Upgrade()
Update correspondence map after convergence.
virtual ParameterList Parameter() const
Get parameter key/value as string map.
Array< Pair< string, string > > ParameterList
Ordered list of parameter name/value pairs.
Definition: Object.h:38
mirtkPublicAttributeMacro(enum LocatorType, LocatorType)
Type of point locator.
Definition: IOConfig.h:41
virtual bool GetSourcePoint(int, Point &) const
Get (transformed) source point corresponding to i-th target (sample) point.
virtual PointCorrespondence * NewInstance() const
Copy construct a new instance.
virtual ~ClosestCell()
Destructor.
LocatorType
Enumeration value of supported cell locators.
Definition: ClosestCell.h:44
virtual TypeId Type() const
Type enumeration value.
ClosestCell()
Constructor.
virtual bool GetTargetPoint(int, Point &) const
Get (transformed) target point corresponding to i-th source (sample) point.
virtual bool GetInputSourcePoint(int, Point &) const
Get untransformed source point corresponding to i-th target (sample) point.
mirtkAttributeMacro(PointSet, TargetPoints)
Target points corresponding to source points.
virtual bool GetInputTargetPoint(int, Point &) const
Get untransformed target point corresponding to i-th source (sample) point.
virtual void Update()
Update correspondence map.