FiducialMatch.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_FiducialMatch_H
21 #define MIRTK_FiducialMatch_H
22 
23 #include "mirtk/PointCorrespondence.h"
24 
25 #include "mirtk/Array.h"
26 
27 
28 namespace mirtk {
29 
30 
31 /**
32  * Point correspondence based on the fiducial indices
33  */
35 {
36  mirtkObjectMacro(FiducialMatch);
37 
38  /// Optional map of corresponding target point indices
39  mirtkPublicAttributeMacro(Array<int>, TargetIndex);
40 
41  /// Optional map of corresponding source point indices
42  mirtkPublicAttributeMacro(Array<int>, SourceIndex);
43 
44  /// Name of text file listing corresponding point indices
45  mirtkPublicAttributeMacro(string, CorrespondenceMap);
46 
47  // ---------------------------------------------------------------------------
48  // Construction/Destruction
49 public:
50 
51  /// Constructor
52  FiducialMatch();
53 
54  /// Copy constructor
56 
57  /// Copy construct a new instance
58  virtual PointCorrespondence *NewInstance() const;
59 
60  /// Destructor
61  virtual ~FiducialMatch();
62 
63  /// Type enumeration value
64  virtual TypeId Type() const;
65 
66  // ---------------------------------------------------------------------------
67  // Parameters
68 
69  // Import other overloads
71 
72  /// Set parameter value from string
73  virtual bool Set(const char *, const char *);
74 
75  /// Get parameter key/value as string map
76  virtual ParameterList Parameter() const;
77 
78  // ---------------------------------------------------------------------------
79  // Correspondences
80 protected:
81 
82  /// Check if correspondence map has a valid entry for every target point
84  const RegisteredPointSet *,
85  const Array<int> &,
86  const char * = NULL) const;
87 
88  /// Compute inverse correspondence map
90  const RegisteredPointSet *,
91  const Array<int> &, Array<int> &) const;
92 
93 public:
94 
95  /// Initialize correspondence map
96  virtual void Initialize();
97 
98  /// Get untransformed target point corresponding to i-th source (sample) point
99  virtual bool GetInputTargetPoint(int, Point &) const;
100 
101  /// Get untransformed source point corresponding to i-th target (sample) point
102  virtual bool GetInputSourcePoint(int, Point &) const;
103 
104  /// Get (transformed) target point corresponding to i-th source (sample) point
105  virtual bool GetTargetPoint(int, Point &) const;
106 
107  /// Get (transformed) source point corresponding to i-th target (sample) point
108  virtual bool GetSourcePoint(int, Point &) const;
109 
110  /// Get index of target point corresponding to i-th source (sample) point
111  ///
112  /// \returns Index of corresponding target point and -1 if point is an outlier
113  /// or its corresponding point is not a target vertex position.
114  virtual int GetTargetIndex(int) const;
115 
116  /// Get index of source point corresponding to i-th target (sample) point
117  ///
118  /// \returns Index of corresponding source point and -1 if point is an outlier
119  /// or its corresponding point is not a source vertex position.
120  virtual int GetSourceIndex(int) const;
121 
122 };
123 
124 
125 } // namespace mirtk
126 
127 #endif // MIRTK_FiducialMatch_H
TypeId
Enumeration of available point correspondence maps.
virtual bool GetTargetPoint(int, Point &) const
Get (transformed) target point corresponding to i-th source (sample) point.
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
void ValidateCorrespondenceMap(const RegisteredPointSet *, const RegisteredPointSet *, const Array< int > &, const char *=NULL) const
Check if correspondence map has a valid entry for every target point.
Definition: IOConfig.h:41
virtual int GetTargetIndex(int) const
virtual void Initialize()
Initialize correspondence map.
virtual TypeId Type() const
Type enumeration value.
virtual bool GetInputSourcePoint(int, Point &) const
Get untransformed source point corresponding to i-th target (sample) point.
virtual bool Set(const char *, const char *)
Set parameter value from string.
FiducialMatch()
Constructor.
virtual bool GetInputTargetPoint(int, Point &) const
Get untransformed target point corresponding to i-th source (sample) point.
virtual PointCorrespondence * NewInstance() const
Copy construct a new instance.
void InvertCorrespondenceMap(const RegisteredPointSet *, const RegisteredPointSet *, const Array< int > &, Array< int > &) const
Compute inverse correspondence map.
virtual ParameterList Parameter() const
Get parameter key/value as string map.
virtual bool GetSourcePoint(int, Point &) const
Get (transformed) source point corresponding to i-th target (sample) point.
virtual int GetSourceIndex(int) const
virtual ~FiducialMatch()
Destructor.