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;
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;
bool ValidPoints(BigInt totalPoints, BigInt nPoints) const
Determines if number of points is valid percentage of all points.
long long int BigInt
Big int.
int Jacobi(const GMatrix &a, GVector &evals, GMatrix &evecs, const int &MaxIters=50) const
Compute the Jacobian of a covariance matrix.
void setAffineRadio()
Set affine parameters to defaults.
AutoReg::RegisterStatus Status(const MatchPoint &result)
Returns the proper status given a Gruen result container.
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.
int count(const QString &key) const
Report number of values in keyword.
Store for radiometric gain and shift parameters.
A small chip of data used for pattern matching.
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...
BigInt CallCount() const
Returns the current call count.
GMatrix Cholsl(const GMatrix &a, const GVector &p, const GMatrix &b, const GMatrix &x) const
Compute Cholesky solution matrix from correlation.
ErrorTypes
Error enumeration values.
PvlGroup StatsLog() const
Create a PvlGroup with the Gruen specific statistics.
virtual double IdealFit() const
Returns the ideal fit for a perfect Gruen result.
bool exists(const QString &key) const
Checks for the existance of a keyword.
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.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
int logError(int gerrno, const QString &gerrmsg)
Logs a Gruen error.
int algorithm(Chip &pattern, Chip &subsearch, const Radiometric &radio, BigInt &ptsUsed, double &resid, GMatrix &atai, AffineRadio &affrad)
Real workhorse of the computational Gruen algorithm.
A DbProfile is a container for access parameters to a database.
virtual Pvl AlgorithmStatistics(Pvl &pvl)
Create Gruen error and processing statistics Pvl output.
double getSpiceConstraint() const
Returns the SPICE tolerance constraint as read from config file.
Coordinate getChipUpdate(Chip &sChip, MatchPoint &point) const
Compute the chip coordinate of the registered pixel.
const AffineRadio & getAffineRadio() const
Return current state of Affine/Radio state.
double DegreesOfFreedom(const int npts) const
Returns number of degrees of freedom of points.
This class is used to accumulate statistics on double arrays.
BigInt MinValidPoints(BigInt totalPoints) const
Computes the number of minimum valid points.
Gruen()
Default constructor.
ErrorList initErrorList() const
Creates an error list from know Gruen errors.
MatchPoint getLastMatch() const
Returns the register state of the last successful Gruen match.
QString ConfKey(const DbProfile &conf, const QString &keyname, const QString &defval, int index=0) const
Helper method to initialize parameters.
void EigenSort(GVector &evals, GMatrix &evecs) const
Sort eigenvectors from highest to lowest.
PvlKeyword ParameterKey(const QString &keyname, const T &value, const QString &unit="") const
Keyword formatter for Gruen parameters.
Contains multiple PvlContainers.
QString value(const QString &key, int nth=0) const
Returns the specified value for the given keyword.
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.
AffineTolerance getAffineTolerance() const
Return set of tolerances for affine convergence.
virtual double MatchAlgorithm(Chip &pattern, Chip &subsearch)
Minimization of data set using Gruen algorithm.
PvlGroup ParameterLog() const
Create a PvlGroup with the Gruen specific parameters.
Container for cube-like labels.
Container for Affine limits parameters.
Radiometric getDefaultRadio() const
Returns the default radiometric gain value.
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.
PvlKeyword ValidateKey(const QString keyname, const double &value, const QString &unit="") const
Checks value of key, produces appropriate value.
void resetStats()
Reset Gruen statistics as needed.
RegisterStatus
Enumeration of the Register() method's return status.
T ConfKey(const DbProfile &conf, const QString &keyname, const T &defval, int index=0) const
Helper method to initialize parameters.
Adds specific functionality to C++ strings.
const AffineRadio & getDefaultAffineRadio() const
Returns default settings for Affine/Radiometric parameters.
Namespace for ISIS/Bullet specific routines.
Error analysis of Gruen match point solution.
static Pvl & getDefaultParameters()
Load default Gruen parameter file in $ISIS3DATA/base/templates.
GMatrix Choldc(const GMatrix &a, GVector &p) const
Compute Cholesky solution.
double getAffineConstraint() const
Returns the Affine tolerance constraint as read from config file.
Struct that maintains error counts.
virtual ~Gruen()
Destructor.