12#include "tnt/tnt_array2d.h" 
   13#include "tnt/tnt_array1d.h" 
   16#include "GruenTypes.h" 
   17#include "CollectorMap.h" 
   18#include "Statistics.h" 
  129                    BigInt &ptsUsed, 
double &resid, GMatrix &atai,
 
  133                             const GMatrix &atai);
 
  137      virtual bool CompareFits(
double fit1, 
double fit2);
 
  158                         EigenSolutionFailed = 3, AffineNotInvertable = 4,
 
  159                         MaxIterationsExceeded = 5, RadShiftExceeded = 6,
 
  160                         RadGainExceeded = 7, MaxEigenExceeded = 8,
 
  161                         AffineDistExceeded = 9
 
 
  167        ErrorCounter() : m_gerrno(0), m_keyname(
"Unknown"), m_count(0) { }
 
  168        ErrorCounter(
int gerrno, 
const QString &keyname) : m_gerrno(gerrno),
 
  169          m_keyname(keyname), m_count(0) { }
 
  171        inline int  Errno()
 const {  
return (m_gerrno); }
 
  172        inline BigInt Count()
 const { 
return (m_count); }
 
  173        inline void BumpIt() { m_count++; }
 
 
  186      QString  m_filePattern;
 
  204      double       m_rgainMinTol;       
 
  205      double       m_rgainMaxTol;       
 
  242                const QString &defval, 
int index = 0)
 const {
 
  243        if(!conf.exists(keyname)) {
 
  246        if(conf.count(keyname) < index) {
 
  249        QString iValue(conf.value(keyname, index));
 
  251        QString value = tmp.ToQt();  
 
 
  271      template <
typename T>
 
  273                const T &defval, 
int index = 0)
 const {
 
  274        if(!conf.exists(keyname)) {
 
  277        if(conf.count(keyname) < index) {
 
  280        QString iValue(conf.value(keyname, index));
 
 
  300      template <
typename T>
 
  303                              const QString &unit = 
"")
 const {
 
  304        if(m_prof.
exists(keyname)) {
 
 
  325                                    const QString &unit = 
"")
 const {
 
 
  335      int logError(
int gerrno, 
const QString &gerrmsg);
 
  348        return ((
double) (npts - NCONSTR));
 
 
  353      GMatrix Identity(
const int &ndiag = 3) 
const;
 
  354      GMatrix 
Choldc(
const GMatrix &a, GVector &p) 
const;
 
  355      GMatrix 
Cholsl(
const GMatrix &a, 
const GVector &p,
 
  356                     const GMatrix &b, 
const GMatrix &x) 
const;
 
  357      int Jacobi(
const GMatrix &a, GVector &evals, GMatrix &evecs,
 
  358                  const int &MaxIters = 50) 
const;
 
  359      void EigenSort(GVector &evals, GMatrix &evecs) 
const;
 
 
Container for affine and radiometric parameters.
 
RegisterStatus
Enumeration of the Register() method's return status.
 
A small chip of data used for pattern matching.
 
Define a generic Y/X container.
 
A DbProfile is a container for access parameters to a database.
 
bool exists(const QString &key) const
Checks for the existance of a keyword.
 
Gruen pattern matching algorithm.
 
void EigenSort(GVector &evals, GMatrix &evecs) const
Sort eigenvectors from highest to lowest.
 
double getAffineConstraint() const
Returns the Affine tolerance constraint as read from config file.
 
void WriteSubsearchChips(const QString &pattern="SubChip")
Set up for writing subsearch for a a given registration call.
 
void resetStats()
Reset Gruen statistics as needed.
 
QString ConfKey(const DbProfile &conf, const QString &keyname, const QString &defval, int index=0) const
Helper method to initialize parameters.
 
Gruen()
Default constructor.
 
int Jacobi(const GMatrix &a, GVector &evals, GMatrix &evecs, const int &MaxIters=50) const
Compute the Jacobian of a covariance matrix.
 
const AffineRadio & getDefaultAffineRadio() const
Returns default settings for Affine/Radiometric parameters.
 
CollectorMap< int, ErrorCounter > ErrorList
Declaration of error count list.
 
void init(Pvl &pvl)
Initialize the object.
 
Coordinate getChipUpdate(Chip &sChip, MatchPoint &point) const
Compute the chip coordinate of the registered pixel.
 
virtual double MatchAlgorithm(Chip &pattern, Chip &subsearch)
Minimization of data set using Gruen algorithm.
 
virtual QString AlgorithmName() const
Returns the default name of the algorithm as Gruen.
 
Analysis errorAnalysis(const BigInt &npts, const double &resid, const GMatrix &atai)
Compute the error analysis of convergent Gruen matrix.
 
virtual double IdealFit() const
Returns the ideal fit for a perfect Gruen result.
 
static Pvl & getDefaultParameters()
Load default Gruen parameter file in $ISISROOT/appdata/templates.
 
int logError(int gerrno, const QString &gerrmsg)
Logs a Gruen error.
 
bool ValidPoints(BigInt totalPoints, BigInt nPoints) const
Determines if number of points is valid percentage of all points.
 
void setAffineRadio()
Set affine parameters to defaults.
 
virtual bool CompareFits(double fit1, double fit2)
This virtual method must return if the 1st fit is equal to or better than the second fit.
 
double getSpiceConstraint() const
Returns the SPICE tolerance constraint as read from config file.
 
ErrorTypes
Error enumeration values.
 
GMatrix Cholsl(const GMatrix &a, const GVector &p, const GMatrix &b, const GMatrix &x) const
Compute Cholesky solution matrix from correlation.
 
AutoReg::RegisterStatus Status(const MatchPoint &result)
Returns the proper status given a Gruen result container.
 
T ConfKey(const DbProfile &conf, const QString &keyname, const T &defval, int index=0) const
Helper method to initialize parameters.
 
PvlGroup ParameterLog() const
Create a PvlGroup with the Gruen specific parameters.
 
PvlKeyword ValidateKey(const QString keyname, const double &value, const QString &unit="") const
Checks value of key, produces appropriate value.
 
virtual AutoReg::RegisterStatus Registration(Chip &sChip, Chip &pChip, Chip &fChip, int startSamp, int startLine, int endSamp, int endLine, int bestSamp, int bestLine)
Applies the adaptive Gruen algorithm to pattern and search chips.
 
PvlGroup StatsLog() const
Create a PvlGroup with the Gruen specific statistics.
 
Radiometric getDefaultRadio() const
Returns the default radiometric gain value.
 
int algorithm(Chip &pattern, Chip &subsearch, const Radiometric &radio, BigInt &ptsUsed, double &resid, GMatrix &atai, AffineRadio &affrad)
Real workhorse of the computational Gruen algorithm.
 
int CheckConstraints(MatchPoint &point)
Test user limits/contraints after the algorithm has converged.
 
ErrorList initErrorList() const
Creates an error list from know Gruen errors.
 
BigInt CallCount() const
Returns the current call count.
 
GMatrix Choldc(const GMatrix &a, GVector &p) const
Compute Cholesky solution.
 
PvlKeyword ParameterKey(const QString &keyname, const T &value, const QString &unit="") const
Keyword formatter for Gruen parameters.
 
double DegreesOfFreedom(const int npts) const
Returns number of degrees of freedom of points.
 
virtual Pvl AlgorithmStatistics(Pvl &pvl)
Create Gruen error and processing statistics Pvl output.
 
BigInt MinValidPoints(BigInt totalPoints) const
Computes the number of minimum valid points.
 
virtual ~Gruen()
Destructor.
 
const AffineRadio & getAffineRadio() const
Return current state of Affine/Radio state
 
AffineTolerance getAffineTolerance() const
Return set of tolerances for affine convergence.
 
MatchPoint getLastMatch() const
Returns the register state of the last successful Gruen match.
 
Adds specific functionality to C++ strings.
 
Structure containing comprehensive registration info/results.
 
Contains multiple PvlContainers.
 
Container for cube-like labels.
 
A single keyword-value pair.
 
Store for radiometric gain and shift parameters.
 
This class is used to accumulate statistics on double arrays.
 
This is free and unencumbered software released into the public domain.
 
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
 
long long int BigInt
Big int.
 
bool IsSpecial(const double d)
Returns if the input pixel is special.
 
Container for Affine limits parameters.
 
Error analysis of Gruen match point solution.
 
Struct that maintains error counts.