Isis 3.0 Programmer Reference
Back | Home
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 "SmtkStack.h"
31 #include "Gruen.h"
32 #include "SmtkPoint.h"
33 
34 #include "GSLUtility.h"
35 #include <gsl/gsl_rng.h>
36 
37 
38 namespace Isis {
39 
56 class SmtkMatcher {
57  public:
58  SmtkMatcher();
59  SmtkMatcher(const QString &regdef);
60  SmtkMatcher(const QString &regdef, Cube *lhImage, Cube *rhImage);
61  SmtkMatcher(Cube *lhImage, Cube *rhImage);
62  ~SmtkMatcher();
63 
64  void setImages(Cube *lhImage, Cube *rhImage);
65  void setGruenDef(const QString &regdef);
66 
67  bool isValid(const Coordinate &pnt);
68  bool isValid(const SmtkPoint &spnt);
69 
71  Chip *PatternChip() const {
72  validate();
73  return (m_gruen->PatternChip());
74  }
75 
77  Chip *SearchChip() const {
78  validate();
79  return (m_gruen->SearchChip());
80  }
81 
83  Chip *FitChip() const {
84  validate();
85  return (m_gruen->FitChip());
86  }
87 
88  void setWriteSubsearchChipPattern(const QString &fileptrn = "SmtkMatcher");
89 
90  SmtkQStackIter FindSmallestEV(SmtkQStack &stack);
91  SmtkQStackIter FindExpDistEV(SmtkQStack &stack, const double &seedsample,
92  const double &minEV, const double &maxEV);
93 
94  SmtkPoint Register(const Coordinate &lpnt,
95  const AffineRadio &affrad = AffineRadio());
96  SmtkPoint Register(const PointPair &pnts,
97  const AffineRadio &affrad = AffineRadio());
98  SmtkPoint Register(const SmtkPoint &spnt,
99  const AffineRadio &affrad = AffineRadio());
100  SmtkPoint Register(const PointGeometry &lpg, const PointGeometry &rpg,
101  const AffineRadio &affrad = AffineRadio());
102 
103  SmtkPoint Create(const Coordinate &left, const Coordinate &right);
104  SmtkPoint Clone(const SmtkPoint &point, const Coordinate &left);
105 
106  inline BigInt OffImageErrorCount() const { return (m_offImage); }
107  inline BigInt SpiceErrorCount() const { return (m_spiceErr); }
108 
110  PvlGroup RegTemplate() { return (m_gruen->RegTemplate()); }
112  Pvl RegistrationStatistics() { return (m_gruen->RegistrationStatistics()); }
113 
114  private:
115  SmtkMatcher &operator=(const SmtkMatcher &matcher); // Assignment disabled
116  SmtkMatcher(const SmtkMatcher &matcher); // Copy const disabled
117 
118  Cube *m_lhCube; // Left image cube (not owned)
119  Cube *m_rhCube; // Right image cube (not owned)
120  std::auto_ptr<Gruen> m_gruen; // Gruen matcher
121  BigInt m_offImage; // Offimage counter
122  BigInt m_spiceErr; // SPICE distance error
123  bool m_useAutoReg; // Select AutoReg features
124  const gsl_rng_type * T; // GSL random number type
125  gsl_rng * r; // GSL random number generator
126 
127  void randomNumberSetup();
128  bool validate(const bool &throwError = true) const;
129 
130  inline Camera &lhCamera() { return (*m_lhCube->camera()); }
131  inline Camera &rhCamera() { return (*m_rhCube->camera()); }
132 
133  Coordinate getLineSample(Camera &camera, const Coordinate &geom);
134  Coordinate getLatLon(Camera &camera, const Coordinate &pnt);
135 
136  bool inCube(const Camera &camera, const Coordinate &point) const;
137 
138  SmtkPoint makeRegisteredPoint(const PointGeometry &left,
139  const PointGeometry &right, Gruen *gruen);
140 };
141 } // namespace Isis
142 
143 #endif
Pvl RegistrationStatistics()
Return Gruen registration statistics.
Definition: SmtkMatcher.h:112
SmtkPoint Clone(const SmtkPoint &point, const Coordinate &left)
Clone a point set from a nearby (left image) point and Gruen affine.
SmtkQStackIter FindExpDistEV(SmtkQStack &stack, const double &seedsample, const double &minEV, const double &maxEV)
Find the best eigen value using exponential distribution formula.
Chip * SearchChip() const
Return search chip.
Definition: SmtkMatcher.h:77
Define a generic Y/X container.
Definition: GruenTypes.h:69
Camera * camera()
Return a camera associated with the cube.
Definition: Cube.cpp:1118
A small chip of data used for pattern matching.
Definition: Chip.h:101
void setImages(Cube *lhImage, Cube *rhImage)
Assign cubes for matching.
Definition: SmtkMatcher.cpp:75
Chip * FitChip() const
Returns the fit chip.
Definition: SmtkMatcher.h:83
SmtkPoint Create(const Coordinate &left, const Coordinate &right)
Create a valid, unregistered SmtkPoint.
Define a point set of left, right and geometry at that location.
Definition: GruenTypes.h:187
SmtkMatcher()
Construct default matcher.
Definition: SmtkMatcher.cpp:40
Coordinate getLineSample(Camera &camera, const Coordinate &geom)
Compute line,sample from latitude, longitude.
Container for a point and its geometry.
Definition: SmtkPoint.h:41
SmtkPoint makeRegisteredPoint(const PointGeometry &left, const PointGeometry &right, Gruen *gruen)
Create an SmtkPoint from Gruen match result.
void setGruenDef(const QString &regdef)
Initialize Gruen algorithm with definitions in Pvl file provided.
Definition: SmtkMatcher.cpp:93
Chip * PatternChip() const
Return pattern chip.
Definition: SmtkMatcher.h:71
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
Coordinate getLatLon(Camera &camera, const Coordinate &pnt)
Compute latitude, longitude from line,sample.
Container for cube-like labels.
Definition: Pvl.h:135
Container for affine and radiometric parameters.
Definition: GruenTypes.h:258
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...
bool inCube(const Camera &camera, const Coordinate &point) const
Determines if the line/sample is within physical cube boundaries.
SmtkQStackIter FindSmallestEV(SmtkQStack &stack)
Find the smallest eigen value on the given stack.
void setWriteSubsearchChipPattern(const QString &fileptrn="SmtkMatcher")
Set file pattern for output subsearch chips.
PvlGroup RegTemplate()
Return Gruen template parameters.
Definition: SmtkMatcher.h:110
Workhorse of stereo matcher.
Definition: SmtkMatcher.h:56
~SmtkMatcher()
Free random number generator in destructor.
Definition: SmtkMatcher.cpp:69
bool validate(const bool &throwError=true) const
Validates the state of the Camera and Gruen algoritm.
void randomNumberSetup()
Initialize the random number generator.
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.
IO Handler for Isis Cubes.
Definition: Cube.h:158

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:29:18