28 #include "tnt/tnt_array2d.h" 29 #include "tnt/tnt_array1d.h" 153 virtual bool CompareFits(
double fit1,
double fit2);
173 enum ErrorTypes { NotEnoughPoints = 1, CholeskyFailed = 2,
174 EigenSolutionFailed = 3, AffineNotInvertable = 4,
175 MaxIterationsExceeded = 5, RadShiftExceeded = 6,
176 RadGainExceeded = 7, MaxEigenExceeded = 8,
177 AffineDistExceeded = 9
182 struct ErrorCounter {
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++; }
190 PvlKeyword LogIt()
const {
return (PvlKeyword(m_keyname,
toString(m_count))); }
198 typedef CollectorMap<int, ErrorCounter> ErrorList;
202 QString m_filePattern;
220 double m_rgainMinTol;
221 double m_rgainMaxTol;
227 AffineRadio m_defAffine;
228 AffineRadio m_affine;
232 Statistics m_eigenStat;
233 Statistics m_iterStat;
234 Statistics m_shiftStat;
235 Statistics m_gainStat;
239 static Pvl &getDefaultParameters();
257 QString ConfKey(
const DbProfile &conf,
const QString &keyname,
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>
288 T ConfKey(
const DbProfile &conf,
const QString &keyname,
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>
317 PvlKeyword ParameterKey(
const QString &keyname,
319 const QString &unit =
"")
const {
320 if(m_prof.exists(keyname)) {
321 return(ValidateKey(keyname, value, unit));
323 return (PvlKeyword(keyname,
"Unbounded"));
339 inline PvlKeyword ValidateKey(
const QString keyname,
341 const QString &unit =
"")
const {
343 return (PvlKeyword(keyname,
"NULL"));
346 return (PvlKeyword(keyname,
toString(value), unit));
350 ErrorList initErrorList()
const;
351 int logError(
int gerrno,
const QString &gerrmsg);
352 PvlGroup StatsLog()
const;
353 PvlGroup ParameterLog()
const;
358 inline Radiometric getDefaultRadio()
const {
359 return (Radiometric(m_defShift, m_defGain));
363 inline double DegreesOfFreedom(
const int npts)
const {
364 return ((
double) (npts -
NCONSTR));
369 GMatrix Identity(
const int &ndiag = 3)
const;
374 const int &MaxIters = 50)
const;
377 bool ValidPoints(
BigInt totalPoints,
BigInt nPoints)
const;
379 int CheckConstraints(MatchPoint &point);
380 Coordinate getChipUpdate(Chip &sChip, MatchPoint &point)
const;
long long int BigInt
Big int.
Definition: Constants.h:65
void setAffineRadio()
Set affine parameters to defaults.
Definition: Gruen.cpp:143
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:696
Store for radiometric gain and shift parameters.
Definition: GruenTypes.h:222
A small chip of data used for pattern matching.
Definition: Chip.h:102
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:652
BigInt CallCount() const
Returns the current call count.
Definition: Gruen.h:101
Affine::AMatrix GMatrix
Definition: GruenTypes.h:45
Definition: GruenTypes.h:49
virtual double IdealFit() const
Returns the ideal fit for a perfect Gruen result.
Definition: Gruen.h:156
virtual QString AlgorithmName() const
Returns the default name of the algorithm as Gruen.
Definition: Gruen.h:140
Analysis errorAnalysis(const BigInt &npts, const double &resid, const GMatrix &atai)
Compute the error analysis of convergent Gruen matrix.
Definition: Gruen.cpp:305
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:226
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:172
virtual Pvl AlgorithmStatistics(Pvl &pvl)
Create Gruen error and processing statistics Pvl output.
Definition: Gruen.cpp:840
double getSpiceConstraint() const
Returns the SPICE tolerance constraint as read from config file.
Definition: Gruen.h:108
const AffineRadio & getAffineRadio() const
Return current state of Affine/Radio state.
Definition: Gruen.h:120
Gruen()
Default constructor.
Definition: Gruen.cpp:48
MatchPoint getLastMatch() const
Returns the register state of the last successful Gruen match.
Definition: Gruen.h:136
void WriteSubsearchChips(const QString &pattern="SubChip")
Set up for writing subsearch for a a given registration call.
Definition: Gruen.cpp:108
bool IsSpecial(const double d)
Returns if the input pixel is special.
Definition: SpecialPixel.h:212
AffineTolerance getAffineTolerance() const
Return set of tolerances for affine convergence.
Definition: Gruen.cpp:1082
virtual double MatchAlgorithm(Chip &pattern, Chip &subsearch)
Minimization of data set using Gruen algorithm.
Definition: Gruen.cpp:624
Container for cube-like labels.
Definition: Pvl.h:135
Container for Affine limits parameters.
Definition: GruenTypes.h:335
Container for affine and radiometric parameters.
Definition: GruenTypes.h:258
Auto Registration class.
Definition: AutoReg.h:183
Structure containing comprehensive registration info/results.
Definition: GruenTypes.h:449
Gruen pattern matching algorithm.
Definition: Gruen.h:90
TNT::Array1D< double > GVector
Definition: GruenTypes.h:46
RegisterStatus
Enumeration of the Register() method's return status.
Definition: AutoReg.h:195
const AffineRadio & getDefaultAffineRadio() const
Returns default settings for Affine/Radiometric parameters.
Definition: Gruen.h:117
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Error analysis of Gruen match point solution.
Definition: GruenTypes.h:399
double getAffineConstraint() const
Returns the Affine tolerance constraint as read from config file.
Definition: Gruen.h:111
virtual ~Gruen()
Destructor.
Definition: Gruen.h:98