14#include <QSharedPointer> 
   17#include "Projection.h" 
   18#include "SpecialPixel.h" 
   19#include "SmtkMatcher.h" 
   26                               m_offImage(0), m_spiceErr(0),
 
 
   44                           Cube *rhCube) : m_lhCube(lhCube),
 
   46                                           m_gruen(0), m_offImage(0),
 
 
   80    m_gruen = QSharedPointer<Gruen> (
new Gruen(reg));  
 
 
  104    if (pnt2.isValid()) {
 
  107    return (pnt2.isValid());
 
 
  134    m_gruen->WriteSubsearchChips(fileptrn);
 
 
  150    SmtkQStackIter best(stack.begin()), current(stack.begin());
 
  151    while ( current != stack.end() ) {
 
  152      if (current.value().GoodnessOfFit() < best.value().GoodnessOfFit() ) {
 
 
  183                                            const double &seedsample,
 
  185                                            const double &maxEV) {
 
  187    if (stack.isEmpty()) 
return (stack.end());
 
  188    SmtkQStackIter best(stack.begin()), current(stack.begin());
 
  191    double randNum = gsl_rng_uniform (r);
 
  192    double t1 = -std::log(1.0 - randNum *
 
  193                          (1.0 - std::exp(-seedsample)))/seedsample;
 
  194    double pt = minEV + t1*(maxEV-minEV);
 
  195    double best_ev(DBL_MAX);
 
  196    while ( current != stack.end() ) {
 
  197      double test_ev(std::fabs(current.value().GoodnessOfFit()-pt));
 
  198      if ( test_ev  < best_ev) {
 
 
  223    if (!spnt.isValid()) {
 
  224      std::cout << 
"Point status is invalid!\n";
 
  229    if (!
inCube(lhCamera(), spnt.getLeft())) {
 
  230      std::cout << 
"Left point (" << spnt.getLeft().getLine() << 
"," 
  231           << spnt.getLeft().getSample() << 
") is invalid!\n";
 
  236    if (!
inCube(rhCamera(), spnt.getRight())) {
 
  237      std::cout << 
"Right point (" << spnt.getRight().getLine() << 
"," 
  238           << spnt.getRight().getSample() << 
") is invalid!\n";
 
 
  298    if (spnt.isRegistered()) { 
return (spnt); }
 
  303    return (
Register(left, right, affrad));
 
 
  342    if (!lpg.getPoint().isValid()) {
 
  343      QString mess = 
"Left point is not defined which is required";
 
  351    if (!lgeom.isValid()) {
 
  357    if (!left.isValid()) {
 
  365    if ( !rpnt.isValid() ) {
 
  366      if (rgeom.isValid()) {
 
  374    else if (!rgeom.isValid() ){
 
  380    if (!right.isValid()) {
 
  387      m_gruen->PatternChip()->TackCube(lpnt.getSample(), lpnt.getLine());
 
  388      m_gruen->PatternChip()->Load(*m_lhCube);
 
  389      m_gruen->SearchChip()->TackCube(rpnt.getSample(), rpnt.getLine());
 
  390      m_gruen->SearchChip()->Load(*m_rhCube, *m_gruen->PatternChip(),
 
  399    m_gruen->setAffineRadio(affrad);
 
 
  432    if (!lgeom.isValid() ) {
 
  439    if (!rgeom.isValid() ) {
 
  446    spnt.m_matchpt.m_analysis.setZeroState();
 
  447    spnt.m_isValid = 
true;
 
 
  478    mpt.m_point = cpoint;
 
  482    spnt.m_registered = 
false;
 
  483    spnt.m_isValid = 
inCube(lhCamera(), left) && 
inCube(rhCamera(), right);
 
 
  500    r = gsl_rng_alloc (T);
 
 
  519    if (!m_lhCube) isGood = 
false;
 
  520    if (!m_rhCube) isGood = 
false;
 
  521    if (!m_gruen.data()) isGood = 
false;
 
  522    if ((!isGood) && throwError) {
 
  523      QString mess = 
"Images/match algorithm not initialized!";
 
 
  541    if (!pnt.isValid()) 
return (
false);
 
  542    if ( (pnt.getSample() < 0.5) || (pnt.getLine() < 0.5) ) 
return false;
 
  543    if ( (pnt.getSample() > (camera.
Samples() + 0.5)) ||
 
  544         (pnt.getLine()   > (camera.
Lines()   + 0.5)) ) {
 
 
  566      if (
inCube(camera, pnt)) {
 
  567        if ( camera.
SetImage(pnt.getSample(), pnt.getLine()) ) {
 
 
  626                         PointPair(left.getGeometry(), right.getGeometry())));
 
  644    if ( !rpoint.isValid() ) {
 
  646      spnt.m_isValid = 
false;
 
  650      double dist = (rcorr - right.getPoint()).getDistance();
 
  651      if (dist > gruen->getSpiceConstraint()) {
 
  653        spnt.m_isValid = 
false;
 
  656        spnt.m_isValid = match.isValid();
 
 
Container for affine and radiometric parameters.
@ SuccessSubPixel
Success registering to sub-pixel accuracy.
virtual double Line() const
Returns the current line number.
int Lines() const
Returns the number of lines in the image.
virtual double Sample() const
Returns the current sample number.
virtual bool SetImage(const double sample, const double line)
Sets the sample/line values of the image to get the lat/lon values.
bool InCube()
This returns true if the current Sample() or Line() value is outside of the cube (meaning the point m...
virtual bool SetUniversalGround(const double latitude, const double longitude)
Sets the lat/lon values to get the sample/line values.
int Samples() const
Returns the number of samples in the image.
Define a generic Y/X container.
bool isValid() const
Check for goodness.
void setLatLon(const double &latitude, const double &longitude)
Use Latitude/Longitude interface.
void setLineSamp(const double &line, const double &sample)
Use the Line/Sample interface.
IO Handler for Isis Cubes.
static GSLUtility * getInstance()
Return a reference to the GSL (singleton) object.
Gruen pattern matching algorithm.
@ Programmer
This error is for when a programmer made an API call that was illegal.
Structure containing comprehensive registration info/results.
Container for a point and its geometry.
Define a point set of left, right and geometry at that location.
Container for cube-like labels.
virtual double UniversalLatitude() const
Returns the planetocentric latitude, in degrees, at the surface intersection point in the body fixed ...
virtual double UniversalLongitude() const
Returns the positive east, 0-360 domain longitude, in degrees, at the surface intersection point in t...
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...
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.
void setImages(Cube *lhImage, Cube *rhImage)
Assign cubes for matching.
SmtkPoint makeRegisteredPoint(const PointGeometry &left, const PointGeometry &right, Gruen *gruen)
Create an SmtkPoint from Gruen match result.
bool isValid(const Coordinate &pnt)
Determine if a point is valid in both left/right images.
void setGruenDef(const QString ®def)
Initialize Gruen algorithm with definitions in Pvl file provided.
bool validate(const bool &throwError=true) const
Validates the state of the Camera and Gruen algoritm.
~SmtkMatcher()
Free random number generator in destructor.
void randomNumberSetup()
Initialize the random number generator.
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.
SmtkMatcher()
Construct default matcher.
Coordinate getLineSample(Camera &camera, const Coordinate &geom)
Compute line,sample from latitude, longitude.
SmtkPoint Create(const Coordinate &left, const Coordinate &right)
Create a valid, unregistered SmtkPoint.
Coordinate getLatLon(Camera &camera, const Coordinate &pnt)
Compute latitude, longitude from line,sample.
Container for SMTK match points.
const AffineRadio & getAffine() const
Returns the affine transform and radiometic results.
const Coordinate & getLeft() const
Returns the left point.
const Coordinate & getRight() const
Returns the registered right coordinate.
This is free and unencumbered software released into the public domain.
This is free and unencumbered software released into the public domain.