Isis 3 Developer Reference
SmtkMatcher.h
Go to the documentation of this file.
1 #ifndef SmtkMatcher_h
2 #define SmtkMatcher_h
3 
27 #include <memory>
28 
29 
30 #include <QSharedPointer>
31 #include "SmtkStack.h"
32 #include "Gruen.h"
33 #include "SmtkPoint.h"
34 
35 #include "GSLUtility.h"
36 #include <gsl/gsl_rng.h>
37 
38 
39 namespace Isis {
40 
61 class SmtkMatcher {
62  public:
63  SmtkMatcher();
64  SmtkMatcher(const QString &regdef);
65  SmtkMatcher(const QString &regdef, Cube *lhImage, Cube *rhImage);
66  SmtkMatcher(Cube *lhImage, Cube *rhImage);
67  ~SmtkMatcher();
68 
69  void setImages(Cube *lhImage, Cube *rhImage);
70  void setGruenDef(const QString &regdef);
71 
72  bool isValid(const Coordinate &pnt);
73  bool isValid(const SmtkPoint &spnt);
74 
76  Chip *PatternChip() const {
77  validate();
78  return (m_gruen->PatternChip());
79  }
80 
82  Chip *SearchChip() const {
83  validate();
84  return (m_gruen->SearchChip());
85  }
86 
88  Chip *FitChip() const {
89  validate();
90  return (m_gruen->FitChip());
91  }
92 
93  void setWriteSubsearchChipPattern(const QString &fileptrn = "SmtkMatcher");
94 
96  SmtkQStackIter FindExpDistEV(SmtkQStack &stack, const double &seedsample,
97  const double &minEV, const double &maxEV);
98 
99  SmtkPoint Register(const Coordinate &lpnt,
100  const AffineRadio &affrad = AffineRadio());
101  SmtkPoint Register(const PointPair &pnts,
102  const AffineRadio &affrad = AffineRadio());
103  SmtkPoint Register(const SmtkPoint &spnt,
104  const AffineRadio &affrad = AffineRadio());
105  SmtkPoint Register(const PointGeometry &lpg, const PointGeometry &rpg,
106  const AffineRadio &affrad = AffineRadio());
107 
108  SmtkPoint Create(const Coordinate &left, const Coordinate &right);
109  SmtkPoint Clone(const SmtkPoint &point, const Coordinate &left);
110 
111  inline BigInt OffImageErrorCount() const { return (m_offImage); }
112  inline BigInt SpiceErrorCount() const { return (m_spiceErr); }
113 
115  PvlGroup RegTemplate() { return (m_gruen->RegTemplate()); }
117  Pvl RegistrationStatistics() { return (m_gruen->RegistrationStatistics()); }
118 
119  private:
120  SmtkMatcher &operator=(const SmtkMatcher &matcher); // Assignment disabled
121  SmtkMatcher(const SmtkMatcher &matcher); // Copy const disabled
122 
123  Cube *m_lhCube; // Left image cube (not owned)
124  Cube *m_rhCube; // Right image cube (not owned)
125  QSharedPointer<Gruen> m_gruen; // Gruen matcher
126  BigInt m_offImage; // Offimage counter
127  BigInt m_spiceErr; // SPICE distance error
128  bool m_useAutoReg; // Select AutoReg features
129  const gsl_rng_type * T; // GSL random number type
130  gsl_rng * r; // GSL random number generator
131 
132  void randomNumberSetup();
133  bool validate(const bool &throwError = true) const;
134 
135  inline Camera &lhCamera() { return (*m_lhCube->camera()); }
136  inline Camera &rhCamera() { return (*m_rhCube->camera()); }
137 
138  Coordinate getLineSample(Camera &camera, const Coordinate &geom);
139  Coordinate getLatLon(Camera &camera, const Coordinate &pnt);
140 
141  bool inCube(const Camera &camera, const Coordinate &point) const;
142 
143  SmtkPoint makeRegisteredPoint(const PointGeometry &left,
144  const PointGeometry &right, Gruen *gruen);
145 };
146 } // namespace Isis
147 
148 #endif
long long int BigInt
Big int.
Definition: Constants.h:65
Pvl RegistrationStatistics()
Return Gruen registration statistics.
Definition: SmtkMatcher.h:117
SmtkPoint Clone(const SmtkPoint &point, const Coordinate &left)
Clone a point set from a nearby (left image) point and Gruen affine.
Definition: SmtkMatcher.cpp:484
SmtkQStackIter FindExpDistEV(SmtkQStack &stack, const double &seedsample, const double &minEV, const double &maxEV)
Find the best eigen value using exponential distribution formula.
Definition: SmtkMatcher.cpp:199
SmtkQStack::iterator SmtkQStackIter
Definition: SmtkStack.h:36
Define a generic Y/X container.
Definition: GruenTypes.h:69
Camera * camera()
Return a camera associated with the cube.
Definition: Cube.cpp:1166
A small chip of data used for pattern matching.
Definition: Chip.h:102
void setImages(Cube *lhImage, Cube *rhImage)
Assign cubes for matching.
Definition: SmtkMatcher.cpp:77
SmtkPoint Create(const Coordinate &left, const Coordinate &right)
Create a valid, unregistered SmtkPoint.
Definition: SmtkMatcher.cpp:444
Define a point set of left, right and geometry at that location.
Definition: GruenTypes.h:187
SmtkMatcher()
Construct default matcher.
Definition: SmtkMatcher.cpp:42
Container for a point and its geometry.
Definition: SmtkPoint.h:41
void setGruenDef(const QString &regdef)
Initialize Gruen algorithm with definitions in Pvl file provided.
Definition: SmtkMatcher.cpp:95
Definition: Camera.h:249
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
Chip * PatternChip() const
Return pattern chip.
Definition: SmtkMatcher.h:76
Chip * SearchChip() const
Return search chip.
Definition: SmtkMatcher.h:82
Definition: JigsawWorkOrder.h:28
Chip * FitChip() const
Returns the fit chip.
Definition: SmtkMatcher.h:88
Container for cube-like labels.
Definition: Pvl.h:135
Container for affine and radiometric parameters.
Definition: GruenTypes.h:258
BigInt SpiceErrorCount() const
Definition: SmtkMatcher.h:112
SmtkPoint Register(const Coordinate &lpnt, const AffineRadio &affrad=AffineRadio())
This method takes a sample, line from the left-hand image and tries to find the matching point in the...
Definition: SmtkMatcher.cpp:267
SmtkQStackIter FindSmallestEV(SmtkQStack &stack)
Find the smallest eigen value on the given stack.
Definition: SmtkMatcher.cpp:166
void setWriteSubsearchChipPattern(const QString &fileptrn="SmtkMatcher")
Set file pattern for output subsearch chips.
Definition: SmtkMatcher.cpp:149
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
PvlGroup RegTemplate()
Return Gruen template parameters.
Definition: SmtkMatcher.h:115
Workhorse of stereo matcher.
Definition: SmtkMatcher.h:61
BigInt OffImageErrorCount() const
Definition: SmtkMatcher.h:111
~SmtkMatcher()
Free random number generator in destructor.
Definition: SmtkMatcher.cpp:71
Definition: ControlNet.h:46
Container for SMTK match points
Definition: SmtkPoint.h:71
bool isValid(const Coordinate &pnt)
Determine if a point is valid in both left/right images.
Definition: SmtkMatcher.cpp:118
IO Handler for Isis Cubes.
Definition: Cube.h:170