|
Isis Developer Reference
|
Go to the documentation of this file.
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;
double getAffineConstraint() const
Returns the Affine tolerance constraint as read from config file.
Definition: Gruen.h:95
void SetChipSample(double sample)
Sets the search chip subpixel sample that matches the pattern tack sample.
Definition: AutoReg.h:393
double getEigen() const
Definition: GruenTypes.h:449
BigInt m_npts
Definition: GruenTypes.h:412
GMatrix m_affine
Definition: GruenTypes.h:280
void AddData(const double *data, const unsigned int count)
Add an array of doubles to the accumulators and counters.
Definition: Statistics.cpp:141
virtual double MatchAlgorithm(Chip &pattern, Chip &subsearch)
Minimization of data set using Gruen algorithm.
Definition: Gruen.cpp:608
QString Name() const
Returns the name of this property.
Definition: DbProfile.h:104
void WriteSubsearchChips(const QString &pattern="SubChip")
Set up for writing subsearch for a a given registration call.
Definition: Gruen.cpp:92
Store for radiometric gain and shift parameters.
Definition: GruenTypes.h:206
TNT::Array1D< double > GVector
Definition: GruenTypes.h:30
Gruen()
Default constructor.
Definition: Gruen.cpp:32
A single keyword-value pair.
Definition: PvlKeyword.h:82
virtual Pvl AlgorithmStatistics(Pvl &pvl)
Create Gruen error and processing statistics Pvl output.
Definition: Gruen.cpp:824
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
Radiometric m_radio
Definition: GruenTypes.h:281
T & getNth(int nth)
Returns the nth value in the collection.
Definition: CollectorMap.h:624
const AffineRadio & getAffineRadio() const
Return current state of Affine/Radio state
Definition: Gruen.h:104
void SetSize(const int samples, const int lines)
Change the size of the Chip.
Definition: Chip.cpp:134
double getDistance(const Coordinate &pntA=Coordinate(0.0, 0.0)) const
Computes the distance from this point and the point provided.
Definition: GruenTypes.h:100
@ AdaptiveAlgorithmFailed
Error occured in Adaptive algorithm.
Definition: AutoReg.h:189
bool isValid() const
Definition: GruenTypes.h:393
void SetGoodnessOfFit(double fit)
Sets the goodness of fit for adaptive algorithms.
Definition: AutoReg.h:413
T & get(const K &key)
Returns the value associated with the name provided.
Definition: CollectorMap.h:567
double GetValue(int sample, int line)
Loads a Chip with a value.
Definition: Chip.h:145
double Maximum() const
Returns the absolute maximum double found in all data passed through the AddData method.
Definition: Statistics.cpp:403
AffineTolerance getAffineTolerance() const
Return set of tolerances for affine convergence.
Definition: Gruen.cpp:1066
Container for affine and radiometric parameters.
Definition: GruenTypes.h:242
void Reset()
Reset all accumulators and counters to zero.
Definition: Statistics.cpp:113
int size() const
Returns the size of the collection.
Definition: CollectorMap.h:512
BigInt CallCount() const
Returns the current call count.
Definition: Gruen.h:85
Container for cube-like labels.
Definition: Pvl.h:119
int m_status
Definition: GruenTypes.h:416
@ NCONSTR
Definition: GruenTypes.h:33
double m_sevals[2]
Definition: GruenTypes.h:414
int getStatus() const
Definition: GruenTypes.h:442
Chip Extract(int samples, int lines, int samp, int line)
Extract a sub-chip from a chip.
Definition: Chip.cpp:727
double getSample() const
Definition: GruenTypes.h:114
Define a generic Y/X container.
Definition: GruenTypes.h:53
Analysis errorAnalysis(const BigInt &npts, const double &resid, const GMatrix &atai)
Compute the error analysis of convergent Gruen matrix.
Definition: Gruen.cpp:289
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
virtual double IdealFit() const
Returns the ideal fit for a perfect Gruen result.
Definition: Gruen.h:140
bool IsSpecial(const double d)
Returns if the input pixel is special.
Definition: SpecialPixel.h:197
Auto Registration class.
Definition: AutoReg.h:167
MatchPoint getLastMatch() const
Returns the register state of the last successful Gruen match.
Definition: Gruen.h:120
@ Traverse
Search child objects.
Definition: PvlObject.h:158
int m_nIters
Definition: GruenTypes.h:460
int TackSample() const
This method returns a chip's fixed tack sample; the middle of the chip.
Definition: Chip.h:176
const AffineRadio & getDefaultAffineRadio() const
Returns default settings for Affine/Radiometric parameters.
Definition: Gruen.h:101
int Lines() const
Definition: Chip.h:106
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
bool exists(const K &key) const
Checks the existance of a particular key in the list.
Definition: CollectorMap.h:551
Compute/test the Affine convergence from given parameters/chip.
Definition: GruenTypes.h:348
double getSpiceConstraint() const
Returns the SPICE tolerance constraint as read from config file.
Definition: Gruen.h:92
@ SuccessSubPixel
Success registering to sub-pixel accuracy.
Definition: AutoReg.h:181
virtual ~Gruen()
Destructor.
Definition: Gruen.h:82
double m_kmat[2]
Definition: GruenTypes.h:415
Contains multiple PvlContainers.
Definition: PvlGroup.h:41
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
int TackLine() const
This method returns a chip's fixed tack line; the middle of the chip.
Definition: Chip.h:187
QString toString() const
Returns a string representation of this exception.
Definition: IException.cpp:537
void Write(const QString &filename)
Writes the contents of the Chip to a cube.
Definition: Chip.cpp:985
int toInt(const QString &string)
Global function to convert from a string to an integer.
Definition: IString.cpp:93
double StandardDeviation() const
Computes and returns the standard deviation.
Definition: Statistics.cpp:312
double Minimum() const
Returns the absolute minimum double found in all data passed through the AddData method.
Definition: Statistics.cpp:382
Error analysis of Gruen match point solution.
Definition: GruenTypes.h:383
double m_variance
Definition: GruenTypes.h:413
Define a point set of left, right and geometry at that location.
Definition: GruenTypes.h:171
long long int BigInt
Big int.
Definition: Constants.h:49
double getLine() const
Definition: GruenTypes.h:113
Analysis m_analysis
Definition: GruenTypes.h:459
double PatternValidPercent() const
Return pattern chip valid percent. The default value is.
Definition: AutoReg.h:280
Isis exception class.
Definition: IException.h:91
RegisterStatus
Enumeration of the Register() method's return status.
Definition: AutoReg.h:179
const MatchPoint & setStatus(int status)
Definition: GruenTypes.h:443
double Tolerance() const
Return match algorithm tolerance.
Definition: AutoReg.h:290
Structure containing comprehensive registration info/results.
Definition: GruenTypes.h:433
const double Null
Value for an Isis Null pixel.
Definition: SpecialPixel.h:95
double getEigen() const
Returns the square of the of sum of the squares of eigenvalues.
Definition: GruenTypes.h:396
void add(const K &key, const T &value)
Adds the element to the list.
Definition: CollectorMap.h:540
void addGroup(const Isis::PvlGroup &group)
Add a group to the object.
Definition: PvlObject.h:186
double Average() const
Computes and returns the average.
Definition: Statistics.cpp:300
Affine::AMatrix GMatrix
Definition: GruenTypes.h:29
virtual QString AlgorithmName() const
Returns the default name of the algorithm as Gruen.
Definition: Gruen.h:124
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition: IString.cpp:149
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:146
bool IsValid(int sample, int line)
Definition: Chip.h:240
double Gain() const
Definition: GruenTypes.h:213
Namespace for the standard library.
void setAffineRadio()
Set affine parameters to defaults.
Definition: Gruen.cpp:127
double Shift() const
Definition: GruenTypes.h:212
Coordinate getAffinePoint(const Coordinate &coord=Coordinate(0.0, 0.0)) const
Return registration offset of a given chip coordinate from center
Definition: GruenTypes.h:452
AffineRadio m_affine
Definition: GruenTypes.h:458
Container for Affine limits parameters.
Definition: GruenTypes.h:319
A small chip of data used for pattern matching.
Definition: Chip.h:86
int Samples() const
Definition: Chip.h:99
Affine basis function.
Definition: Affine.h:65
Gruen pattern matching algorithm.
Definition: Gruen.h:74
void SetChipPosition(const double sample, const double line)
Compute the position of the cube given a chip coordinate.
Definition: Chip.cpp:643
void setName(const QString &name)
Set the name of this profile.
Definition: DbProfile.h:95
void SetChipLine(double line)
Sets the search chip subpixel line that matches the pattern tack line.
Definition: AutoReg.h:404
void Translate(const Coordinate &offset)
Apply a translation to the given offset.
Definition: GruenTypes.h:263
bool hasConverged(const AffineRadio &affine) const
Determines convergence from an affine/radiometric fit.
Definition: GruenTypes.h:363
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
bool isValid() const
Definition: GruenTypes.h:448
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