28 #include "tnt/tnt_array2d.h"
29 #include "tnt/tnt_array1d.h"
145 BigInt &ptsUsed,
double &resid, GMatrix &atai,
149 const GMatrix &atai);
153 virtual bool CompareFits(
double fit1,
double fit2);
174 EigenSolutionFailed = 3, AffineNotInvertable = 4,
175 MaxIterationsExceeded = 5, RadShiftExceeded = 6,
176 RadGainExceeded = 7, MaxEigenExceeded = 8,
177 AffineDistExceeded = 9
183 ErrorCounter() : m_gerrno(0), m_keyname(
"Unknown"), m_count(0) { }
184 ErrorCounter(
int gerrno,
const QString &keyname) : m_gerrno(gerrno),
185 m_keyname(keyname), m_count(0) { }
187 inline int Errno()
const {
return (m_gerrno); }
188 inline BigInt Count()
const {
return (m_count); }
189 inline void BumpIt() { m_count++; }
202 QString m_filePattern;
205 BigInt m_unclassified;
210 BigInt m_totalIterations;
220 double m_rgainMinTol;
221 double m_rgainMaxTol;
258 const QString &defval,
int index = 0)
const {
259 if(!conf.
exists(keyname)) {
262 if(conf.
count(keyname) < index) {
265 QString iValue(conf.
value(keyname, index));
267 QString value = tmp.ToQt();
287 template <
typename T>
289 const T &defval,
int index = 0)
const {
290 if(!conf.
exists(keyname)) {
293 if(conf.
count(keyname) < index) {
296 QString iValue(conf.
value(keyname, index));
316 template <
typename T>
319 const QString &unit =
"")
const {
320 if(m_prof.
exists(keyname)) {
341 const QString &unit =
"")
const {
351 int logError(
int gerrno,
const QString &gerrmsg);
364 return ((
double) (npts - NCONSTR));
369 GMatrix Identity(
const int &ndiag = 3)
const;
370 GMatrix
Choldc(
const GMatrix &a, GVector &p)
const;
371 GMatrix
Cholsl(
const GMatrix &a,
const GVector &p,
372 const GMatrix &b,
const GMatrix &x)
const;
373 int Jacobi(
const GMatrix &a, GVector &evals, GMatrix &evecs,
374 const int &MaxIters = 50)
const;
375 void EigenSort(GVector &evals, GMatrix &evecs)
const;
377 bool ValidPoints(BigInt totalPoints, BigInt nPoints)
const;
void setAffineRadio()
Set affine parameters to defaults.
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.
MatchPoint getLastMatch() const
Returns the register state of the last successful Gruen match.
CollectorMap< int, ErrorCounter > ErrorList
Declaration of error count list.
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.
Define a generic Y/X container.
Store for radiometric gain and shift parameters.
A small chip of data used for pattern matching.
void EigenSort(GVector &evals, GMatrix &evecs) const
Sort eigenvectors from highest to lowest.
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...
GMatrix Choldc(const GMatrix &a, GVector &p) const
Compute Cholesky solution.
ErrorTypes
Error enumeration values.
T ConfKey(const DbProfile &conf, const QString &keyname, const T &defval, int index=0) const
Helper method to initialize parameters.
PvlKeyword ValidateKey(const QString keyname, const double &value, const QString &unit="") const
Checks value of key, produces appropriate value.
Analysis errorAnalysis(const BigInt &npts, const double &resid, const GMatrix &atai)
Compute the error analysis of convergent Gruen matrix.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
PvlGroup ParameterLog() const
Create a PvlGroup with the Gruen specific parameters.
int logError(int gerrno, const QString &gerrmsg)
Logs a Gruen error.
PvlKeyword ParameterKey(const QString &keyname, const T &value, const QString &unit="") const
Keyword formatter for Gruen parameters.
virtual QString AlgorithmName() const
Returns the default name of the algorithm as Gruen.
int algorithm(Chip &pattern, Chip &subsearch, const Radiometric &radio, BigInt &ptsUsed, double &resid, GMatrix &atai, AffineRadio &affrad)
Real workhorse of the computational Gruen algorithm.
QString value(const QString &key, int nth=0) const
Returns the specified value for the given keyword.
A DbProfile is a container for access parameters to a database.
virtual Pvl AlgorithmStatistics(Pvl &pvl)
Create Gruen error and processing statistics Pvl output.
int count(const QString &key) const
Report number of values in keyword.
This class is used to accumulate statistics on double arrays.
AffineTolerance getAffineTolerance() const
Return set of tolerances for affine convergence.
const AffineRadio & getAffineRadio() const
Return current state of Affine/Radio state.
Gruen()
Default constructor.
Contains multiple PvlContainers.
BigInt CallCount() const
Returns the current call count.
A single keyword-value pair.
void WriteSubsearchChips(const QString &pattern="SubChip")
Set up for writing subsearch for a a given registration call.
bool IsSpecial(const double d)
Returns if the input pixel is special.
virtual double IdealFit() const
Returns the ideal fit for a perfect Gruen result.
double DegreesOfFreedom(const int npts) const
Returns number of degrees of freedom of points.
virtual double MatchAlgorithm(Chip &pattern, Chip &subsearch)
Minimization of data set using Gruen algorithm.
Container for cube-like labels.
Container for Affine limits parameters.
Container for affine and radiometric parameters.
int CheckConstraints(MatchPoint &point)
Test user limits/contraints after the algorithm has converged.
void init(Pvl &pvl)
Initialize the object.
Structure containing comprehensive registration info/results.
Gruen pattern matching algorithm.
int Jacobi(const GMatrix &a, GVector &evals, GMatrix &evecs, const int &MaxIters=50) const
Compute the Jacobian of a covariance matrix.
bool exists(const QString &key) const
Checks for the existance of a keyword.
double getSpiceConstraint() const
Returns the SPICE tolerance constraint as read from config file.
PvlGroup StatsLog() const
Create a PvlGroup with the Gruen specific statistics.
void resetStats()
Reset Gruen statistics as needed.
RegisterStatus
Enumeration of the Register() method's return status.
bool ValidPoints(BigInt totalPoints, BigInt nPoints) const
Determines if number of points is valid percentage of all points.
Adds specific functionality to C++ strings.
double getAffineConstraint() const
Returns the Affine tolerance constraint as read from config file.
Coordinate getChipUpdate(Chip &sChip, MatchPoint &point) const
Compute the chip coordinate of the registered pixel.
Error analysis of Gruen match point solution.
ErrorList initErrorList() const
Creates an error list from know Gruen errors.
const AffineRadio & getDefaultAffineRadio() const
Returns default settings for Affine/Radiometric parameters.
static Pvl & getDefaultParameters()
Load default Gruen parameter file in $ISIS3DATA/base/templates.
Struct that maintains error counts.
QString ConfKey(const DbProfile &conf, const QString &keyname, const QString &defval, int index=0) const
Helper method to initialize parameters.
BigInt MinValidPoints(BigInt totalPoints) const
Computes the number of minimum valid points.
virtual ~Gruen()
Destructor.
Radiometric getDefaultRadio() const
Returns the default radiometric gain value.