12#include "tnt/tnt_array2d.h"
13#include "tnt/tnt_array1d.h"
137 virtual bool CompareFits(
double fit1,
double fit2);
157 enum ErrorTypes { NotEnoughPoints = 1, CholeskyFailed = 2,
158 EigenSolutionFailed = 3, AffineNotInvertable = 4,
159 MaxIterationsExceeded = 5, RadShiftExceeded = 6,
160 RadGainExceeded = 7, MaxEigenExceeded = 8,
161 AffineDistExceeded = 9
166 struct ErrorCounter {
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++; }
174 PvlKeyword LogIt()
const {
return (PvlKeyword(m_keyname,
toString(m_count))); }
182 typedef CollectorMap<int, ErrorCounter> ErrorList;
186 QString m_filePattern;
204 double m_rgainMinTol;
205 double m_rgainMaxTol;
211 AffineRadio m_defAffine;
212 AffineRadio m_affine;
216 Statistics m_eigenStat;
217 Statistics m_iterStat;
218 Statistics m_shiftStat;
219 Statistics m_gainStat;
223 static Pvl &getDefaultParameters();
241 QString ConfKey(
const DbProfile &conf,
const QString &keyname,
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>
272 T ConfKey(
const DbProfile &conf,
const QString &keyname,
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>
301 PvlKeyword ParameterKey(
const QString &keyname,
303 const QString &unit =
"")
const {
304 if(m_prof.exists(keyname)) {
305 return(ValidateKey(keyname, value, unit));
307 return (PvlKeyword(keyname,
"Unbounded"));
323 inline PvlKeyword ValidateKey(
const QString keyname,
325 const QString &unit =
"")
const {
327 return (PvlKeyword(keyname,
"NULL"));
330 return (PvlKeyword(keyname,
toString(value), unit));
334 ErrorList initErrorList()
const;
335 int logError(
int gerrno,
const QString &gerrmsg);
336 PvlGroup StatsLog()
const;
337 PvlGroup ParameterLog()
const;
342 inline Radiometric getDefaultRadio()
const {
343 return (Radiometric(m_defShift, m_defGain));
347 inline double DegreesOfFreedom(
const int npts)
const {
348 return ((
double) (npts -
NCONSTR));
353 GMatrix Identity(
const int &ndiag = 3)
const;
358 const int &MaxIters = 50)
const;
361 bool ValidPoints(
BigInt totalPoints,
BigInt nPoints)
const;
363 int CheckConstraints(MatchPoint &point);
364 Coordinate getChipUpdate(Chip &sChip, MatchPoint &point)
const;
Container for affine and radiometric parameters.
Definition GruenTypes.h:242
Auto Registration class.
Definition AutoReg.h:167
RegisterStatus
Enumeration of the Register() method's return status.
Definition AutoReg.h:179
A small chip of data used for pattern matching.
Definition Chip.h:86
Gruen pattern matching algorithm.
Definition Gruen.h:74
double getAffineConstraint() const
Returns the Affine tolerance constraint as read from config file.
Definition Gruen.h:95
void WriteSubsearchChips(const QString &pattern="SubChip")
Set up for writing subsearch for a a given registration call.
Definition Gruen.cpp:92
Gruen()
Default constructor.
Definition Gruen.cpp:32
const AffineRadio & getDefaultAffineRadio() const
Returns default settings for Affine/Radiometric parameters.
Definition Gruen.h:101
virtual double MatchAlgorithm(Chip &pattern, Chip &subsearch)
Minimization of data set using Gruen algorithm.
Definition Gruen.cpp:608
virtual QString AlgorithmName() const
Returns the default name of the algorithm as Gruen.
Definition Gruen.h:124
Analysis errorAnalysis(const BigInt &npts, const double &resid, const GMatrix &atai)
Compute the error analysis of convergent Gruen matrix.
Definition Gruen.cpp:289
virtual double IdealFit() const
Returns the ideal fit for a perfect Gruen result.
Definition Gruen.h:140
void setAffineRadio()
Set affine parameters to defaults.
Definition Gruen.cpp:127
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.
Definition Gruen.cpp:636
double getSpiceConstraint() const
Returns the SPICE tolerance constraint as read from config file.
Definition Gruen.h:92
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.
Definition Gruen.cpp:680
int algorithm(Chip &pattern, Chip &subsearch, const Radiometric &radio, BigInt &ptsUsed, double &resid, GMatrix &atai, AffineRadio &affrad)
Real workhorse of the computational Gruen algorithm.
Definition Gruen.cpp:156
BigInt CallCount() const
Returns the current call count.
Definition Gruen.h:85
virtual Pvl AlgorithmStatistics(Pvl &pvl)
Create Gruen error and processing statistics Pvl output.
Definition Gruen.cpp:824
virtual ~Gruen()
Destructor.
Definition Gruen.h:82
const AffineRadio & getAffineRadio() const
Return current state of Affine/Radio state
Definition Gruen.h:104
AffineTolerance getAffineTolerance() const
Return set of tolerances for affine convergence.
Definition Gruen.cpp:1066
MatchPoint getLastMatch() const
Returns the register state of the last successful Gruen match.
Definition Gruen.h:120
Structure containing comprehensive registration info/results.
Definition GruenTypes.h:433
Container for cube-like labels.
Definition Pvl.h:119
Store for radiometric gain and shift parameters.
Definition GruenTypes.h:206
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition IString.cpp:211
Affine::AMatrix GMatrix
Definition GruenTypes.h:29
@ NCONSTR
Definition GruenTypes.h:33
TNT::Array1D< double > GVector
Definition GruenTypes.h:30
long long int BigInt
Big int.
Definition Constants.h:49
bool IsSpecial(const double d)
Returns if the input pixel is special.
Definition SpecialPixel.h:197
Container for Affine limits parameters.
Definition GruenTypes.h:319
Error analysis of Gruen match point solution.
Definition GruenTypes.h:383