Isis 3 Programmer Reference
|
Gruen pattern matching algorithm. More...
#include <Gruen.h>
Classes | |
struct | ErrorCounter |
Struct that maintains error counts. More... | |
Public Types | |
enum | RegisterStatus { SuccessPixel, SuccessSubPixel, PatternChipNotEnoughValidData, FitChipNoData, FitChipToleranceNotMet, SurfaceModelNotEnoughValidData, SurfaceModelSolutionInvalid, SurfaceModelDistanceInvalid, PatternZScoreNotMet, AdaptiveAlgorithmFailed } |
Enumeration of the Register() method's return status. More... | |
enum | GradientFilterType { None, Sobel } |
Enumeration of the different types of gradient filters that can be applied to the pattern and search chips before matching them. More... | |
Public Member Functions | |
Gruen () | |
Default constructor. More... | |
Gruen (Pvl &pvl) | |
Construct a Gruen search algorithm. More... | |
virtual | ~Gruen () |
Destructor. More... | |
BigInt | CallCount () const |
Returns the current call count. More... | |
void | WriteSubsearchChips (const QString &pattern="SubChip") |
Set up for writing subsearch for a a given registration call. More... | |
AffineTolerance | getAffineTolerance () const |
Return set of tolerances for affine convergence. More... | |
double | getSpiceConstraint () const |
Returns the SPICE tolerance constraint as read from config file. More... | |
double | getAffineConstraint () const |
Returns the Affine tolerance constraint as read from config file. More... | |
void | setAffineRadio (const AffineRadio &affrad) |
Sets initial chip transformation. More... | |
void | setAffineRadio () |
Set affine parameters to defaults. More... | |
const AffineRadio & | getDefaultAffineRadio () const |
Returns default settings for Affine/Radiometric parameters. More... | |
const AffineRadio & | getAffineRadio () const |
Return current state of Affine/Radio state. More... | |
MatchPoint | getLastMatch () const |
Returns the register state of the last successful Gruen match. More... | |
Chip * | PatternChip () |
Return pointer to pattern chip. More... | |
Chip * | SearchChip () |
Return pointer to search chip. More... | |
Chip * | FitChip () |
Return pointer to fit chip. More... | |
Chip * | RegistrationPatternChip () |
Return pointer to pattern chip used in registration. More... | |
Chip * | RegistrationSearchChip () |
Return pointer to search chip used in registration. More... | |
Chip * | ReducedPatternChip () |
Return pointer to reduced pattern chip. More... | |
Chip * | ReducedSearchChip () |
Return pointer to reduced search chip. More... | |
Chip * | ReducedFitChip () |
Return pointer to reduced fit chip. More... | |
void | SetSubPixelAccuracy (bool on) |
If the sub-pixel accuracy is enabled, the Register() method will attempt to match the pattern chip to the search chip at sub-pixel accuracy, otherwise it will be registered at whole pixel accuracy. More... | |
void | SetPatternValidPercent (const double percent) |
Set the amount of data in the pattern chip that must be valid. More... | |
void | SetSubsearchValidPercent (const double percent) |
Set the amount of data in the search chip's subchip that must be valid. More... | |
void | SetTolerance (double tolerance) |
Set the tolerance for an acceptable goodness of fit. More... | |
void | SetChipInterpolator (const QString &interpolator) |
Sets the Chip class interpolator type to be used to load pattern and search chips. More... | |
void | SetSurfaceModelWindowSize (int size) |
Set the surface model window size. More... | |
void | SetSurfaceModelDistanceTolerance (double distance) |
Set a distance the surface model solution is allowed to move away from the best whole pixel fit in the fit chip. More... | |
void | SetReductionFactor (int reductionFactor) |
Set the reduction factor used to speed up the pattern matching algorithm. More... | |
void | SetPatternZScoreMinimum (double minimum) |
Set the minimum pattern zscore. More... | |
void | SetGradientFilterType (const QString &gradientFilterType) |
Set the gradient filter type to be applied to the search and pattern chips. More... | |
QString | GradientFilterString () const |
bool | SubPixelAccuracy () |
Return whether this object will attempt to register to whole or sub-pixel accuracy. More... | |
int | ReductionFactor () |
Return the reduction factor. More... | |
double | PatternValidPercent () const |
Return pattern chip valid percent. The default value is. More... | |
double | SubsearchValidPercent () const |
Return subsearch chip valid percent. More... | |
double | Tolerance () const |
Return match algorithm tolerance. More... | |
double | WindowSize () const |
Return window size. More... | |
double | DistanceTolerance () const |
Return distance tolerance. More... | |
void | Distance (double &sampDistance, double &lineDistance) |
Return the distance point moved. More... | |
AutoReg::RegisterStatus | Register () |
Walk the pattern chip through the search chip to find the best registration. More... | |
bool | Success () const |
Return whether the match algorithm succeeded or not. More... | |
double | GoodnessOfFit () const |
Return the goodness of fit of the match algorithm. More... | |
bool | IsIdeal (double fit) |
Returns true if the fit parameter is arbitrarily close to the ideal fit value. More... | |
double | ChipSample () const |
Return the search chip sample that best matched. More... | |
double | ChipLine () const |
Return the search chip line that best matched. More... | |
double | CubeSample () const |
Return the search chip cube sample that best matched. More... | |
double | CubeLine () const |
Return the search chip cube line that best matched. More... | |
double | MinimumZScore () const |
Return minimumPatternZScore. More... | |
void | ZScores (double &score1, double &score2) const |
Return the ZScores of the pattern chip. More... | |
Pvl | RegistrationStatistics () |
This returns the cumulative registration statistics. More... | |
virtual double | MostLenientTolerance () |
Minimum tolerance specific to algorithm. More... | |
PvlGroup | RegTemplate () |
This function returns the keywords that this object was created from. More... | |
PvlGroup | UpdatedTemplate () |
Returns a PvlGroup containing the PvlKeywords of the parameters this object was most recently run with. More... | |
Protected Member Functions | |
virtual QString | AlgorithmName () const |
Returns the default name of the algorithm as Gruen. More... | |
int | algorithm (Chip &pattern, Chip &subsearch, const Radiometric &radio, BigInt &ptsUsed, double &resid, GMatrix &atai, AffineRadio &affrad) |
Real workhorse of the computational Gruen algorithm. More... | |
Analysis | errorAnalysis (const BigInt &npts, const double &resid, const GMatrix &atai) |
Compute the error analysis of convergent Gruen matrix. More... | |
virtual double | MatchAlgorithm (Chip &pattern, Chip &subsearch) |
Minimization of data set using Gruen algorithm. More... | |
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. More... | |
virtual double | IdealFit () const |
Returns the ideal fit for a perfect Gruen result. More... | |
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. More... | |
virtual Pvl | AlgorithmStatistics (Pvl &pvl) |
Create Gruen error and processing statistics Pvl output. More... | |
void | SetChipSample (double sample) |
Sets the search chip subpixel sample that matches the pattern tack sample. More... | |
void | SetChipLine (double line) |
Sets the search chip subpixel line that matches the pattern tack line. More... | |
void | SetGoodnessOfFit (double fit) |
Sets the goodness of fit for adaptive algorithms. More... | |
void | Parse (Pvl &pvl) |
Initialize parameters in the AutoReg class using a PVL specification. More... | |
bool | SetSubpixelPosition (Chip &window) |
Set the search chip sample and line to subpixel values if possible. More... | |
Chip | Reduce (Chip &chip, int reductionFactor) |
This method reduces the given chip by the given reduction factor. More... | |
Protected Attributes | |
PvlObject | p_template |
AutoRegistration object that created this projection. More... | |
Private Types | |
enum | ErrorTypes { NotEnoughPoints = 1, CholeskyFailed = 2, EigenSolutionFailed = 3, AffineNotInvertable = 4, MaxIterationsExceeded = 5, RadShiftExceeded = 6, RadGainExceeded = 7, MaxEigenExceeded = 8, AffineDistExceeded = 9 } |
Error enumeration values. More... | |
typedef CollectorMap< int, ErrorCounter > | ErrorList |
Declaration of error count list. More... | |
Private Member Functions | |
QString | ConfKey (const DbProfile &conf, const QString &keyname, const QString &defval, int index=0) const |
Helper method to initialize parameters. More... | |
template<typename T > | |
T | ConfKey (const DbProfile &conf, const QString &keyname, const T &defval, int index=0) const |
Helper method to initialize parameters. More... | |
template<typename T > | |
PvlKeyword | ParameterKey (const QString &keyname, const T &value, const QString &unit="") const |
Keyword formatter for Gruen parameters. More... | |
PvlKeyword | ValidateKey (const QString keyname, const double &value, const QString &unit="") const |
Checks value of key, produces appropriate value. More... | |
ErrorList | initErrorList () const |
Creates an error list from know Gruen errors. More... | |
int | logError (int gerrno, const QString &gerrmsg) |
Logs a Gruen error. More... | |
PvlGroup | StatsLog () const |
Create a PvlGroup with the Gruen specific statistics. More... | |
PvlGroup | ParameterLog () const |
Create a PvlGroup with the Gruen specific parameters. More... | |
void | init (Pvl &pvl) |
Initialize the object. More... | |
Radiometric | getDefaultRadio () const |
Returns the default radiometric gain value. More... | |
double | DegreesOfFreedom (const int npts) const |
Returns number of degrees of freedom of points. More... | |
void | resetStats () |
Reset Gruen statistics as needed. More... | |
GMatrix | Identity (const int &ndiag=3) const |
GMatrix | Choldc (const GMatrix &a, GVector &p) const |
Compute Cholesky solution. More... | |
GMatrix | Cholsl (const GMatrix &a, const GVector &p, const GMatrix &b, const GMatrix &x) const |
Compute Cholesky solution matrix from correlation. More... | |
int | Jacobi (const GMatrix &a, GVector &evals, GMatrix &evecs, const int &MaxIters=50) const |
Compute the Jacobian of a covariance matrix. More... | |
void | EigenSort (GVector &evals, GMatrix &evecs) const |
Sort eigenvectors from highest to lowest. More... | |
BigInt | MinValidPoints (BigInt totalPoints) const |
Computes the number of minimum valid points. More... | |
bool | ValidPoints (BigInt totalPoints, BigInt nPoints) const |
Determines if number of points is valid percentage of all points. More... | |
int | CheckConstraints (MatchPoint &point) |
Test user limits/contraints after the algorithm has converged. More... | |
Coordinate | getChipUpdate (Chip &sChip, MatchPoint &point) const |
Compute the chip coordinate of the registered pixel. More... | |
AutoReg::RegisterStatus | Status (const MatchPoint &result) |
Returns the proper status given a Gruen result container. More... | |
Static Private Member Functions | |
static Pvl & | getDefaultParameters () |
Load default Gruen parameter file in $ISIS3DATA/base/templates. More... | |
Private Attributes | |
BigInt | m_callCount |
QString | m_filePattern |
ErrorList | m_errors |
BigInt | m_unclassified |
int | m_maxIters |
int | m_nIters |
BigInt | m_totalIterations |
DbProfile | m_prof |
double | m_transTol |
double | m_scaleTol |
double | m_shearTol |
double | m_spiceTol |
double | m_affineTol |
double | m_shiftTol |
double | m_rgainMinTol |
double | m_rgainMaxTol |
double | m_defGain |
double | m_defShift |
AffineRadio | m_defAffine |
AffineRadio | m_affine |
MatchPoint | m_point |
Statistics | m_eigenStat |
Statistics | m_iterStat |
Statistics | m_shiftStat |
Statistics | m_gainStat |
Gruen pattern matching algorithm.
This class provides adaptive image (chip) registration using the AutoReg factory architecture. This algorithm uses an Affine transform to iteratively adjust the search chip at each iteration. Each iteration solves for new adjustments to the Affine transform until the 6 affine parameters fall below the tolerances as specified in AffineThreshHold1 and AffineThreshHold2.
This class minimizes the 6 specifiable Affine transform components of a 3x3 matrix. The three Affine components for X (sample) and Y (line) are scale, shear and translation. Gruen provides control over the maximum values these three components should attain in order for the registration to converge to a successful match. These limits are specified by AffineScaleTolerance, AffineShearTolerance and AffineTranslationTolerance. AffineShearTolerance is optional and if not specified, it defaults to the value of AffineScaleTolerance. These tolerances specify the maximum amount of translation pixels can be shifted between one Gruen iteration and another. For example, AffineTranslationTolerance = 0.2 means that a subsearch chip cannot move in sample or line direction more than 0.2 pixels in order to satisfy convergence. AffineScaleTolerance constrains the sample and line scale elements of the Affine transformation. And AffineShearTolerance constrains the sample and line shear elements of the Affine transformation. The scale and shear parameters are scaled by size of the Chip. The sample scale and shear Affine components maximum limit is computed as AffineScaleTolerance/((#Samples-1)/2) and AffineShearTolerance/((#Samples-1)/2). Likewise, the line scale and shear maximums are computed using #Lines in the preceding equation.
2009-09-10 Kris Becker Changed AffineThreshHold1 to AffineTranslationTolerance and AffineThreshHold2 to AffineScaleTolerance. Added AffineShearTolerance. Added logging of Gruen parameters.
2009-09-11 Kris Becker Minor error in computation of radiometric shift
2010-06-14 Jeannie Walldren - Capitalized getTransform and setTransform to match changes in Chip class
2011-05-23 Kris Becker - Reworked major portions of implementation for a more modular support.
|
private |
|
private |
|
inherited |
|
inherited |
Enumeration of the Register() method's return status.
All of the enumerations describe a failure to register except "Success". These status values can be used to provide the user with more specific feedback on why registration did not succeed.
Isis::Gruen::Gruen | ( | ) |
Default constructor.
Default constructor sets up default Gruen parameters.
Definition at line 48 of file Gruen.cpp.
References getDefaultParameters(), and init().
Isis::Gruen::Gruen | ( | Pvl & | pvl | ) |
Construct a Gruen search algorithm.
This will construct a minimum difference search algorith. It is recommended that you use a AutoRegFactory class as opposed to this constructor. Direct construction is used commonly in stereo matching.
pvl | A Pvl object that contains a valid automatic registration definition |
Definition at line 63 of file Gruen.cpp.
References init().
|
protected |
Real workhorse of the computational Gruen algorithm.
This method is called for all registration requests and actually performs the registration of two chips.
The pattern chip is deemed constant. The subsearch chip is generally an extraction from the search chip that has had an affine transform applied to fill it.
At each iteration of the Gruen algorithm, the affine transform is incrementally updated based upon the results from this method. There are six affine parameters and two radiometric (shift and gain) parameters that are solved/computed here.
The algorithm itself is a first derivative computation of the subsearch chip with small radiometric adjustments applied to better tone match the two chips. This is intended to minimize the affine variability.
pattern | Fixed pattern chip which subsearch is trying to match |
subsearch | Affined extraction of the search chip |
Definition at line 172 of file Gruen.cpp.
References Choldc(), Cholsl(), Isis::Chip::GetValue(), Isis::Chip::IsValid(), Isis::Chip::Lines(), logError(), MinValidPoints(), Isis::Chip::Samples(), Isis::Chip::TackLine(), Isis::Chip::TackSample(), Isis::IException::toString(), and ValidPoints().
Referenced by MatchAlgorithm(), and Registration().
|
inlineprotectedvirtual |
Returns the default name of the algorithm as Gruen.
Implements Isis::AutoReg.
Reimplemented in Isis::AdaptiveGruen.
Definition at line 140 of file Gruen.h.
Referenced by AlgorithmStatistics().
Create Gruen error and processing statistics Pvl output.
This method generates two groups specific to the Gruen algorithm: The GruenFailures group which logs all the errors enountered during processing and the GruenStatistics group which logs selected statistics gathered during a registration run.
These groups are added to the AutoReg log output Pvl container for reporting to user/log files.
Reimplemented from Isis::AutoReg.
Definition at line 840 of file Gruen.cpp.
References Isis::PvlObject::addGroup(), AlgorithmName(), Isis::CollectorMap< K, T, ComparePolicy, RemovalPolicy, CopyPolicy >::getNth(), ParameterLog(), Isis::CollectorMap< K, T, ComparePolicy, RemovalPolicy, CopyPolicy >::size(), StatsLog(), and Isis::toString().
|
inline |
|
private |
Test user limits/contraints after the algorithm has converged.
This method is invoked immediately after the Gruen algorithm has converged to test against user specified limits. This call is only valid in the adaptive context as much of the error checking is handled by AutoReg when using the non-adaptive algorithm.
This method tests for convergence, maximum iterations exceeded, tolerance limits of radiometric shift and gain and whether the eigenvalue of the solution exceeds the limit.
The result container is altered should a constraint not be meet which indicates the registration failed.
point | Container with point information |
Definition at line 1106 of file Gruen.cpp.
References Isis::Statistics::AddData(), getAffineConstraint(), Isis::MatchPoint::getAffinePoint(), Isis::Coordinate::getDistance(), logError(), and Isis::AutoReg::Tolerance().
Referenced by Registration().
|
inlineinherited |
Return the search chip line that best matched.
Definition at line 351 of file AutoReg.h.
References Isis::AutoReg::p_chipLine.
|
inlineinherited |
Return the search chip sample that best matched.
Definition at line 346 of file AutoReg.h.
References Isis::AutoReg::p_chipSample.
|
private |
Compute Cholesky solution.
a | |
p |
Definition at line 357 of file Gruen.cpp.
References _FILEINFO_, and Isis::IException::Programmer.
Referenced by algorithm().
|
private |
Compute Cholesky solution matrix from correlation.
a | |
p | |
b | |
x |
Definition at line 399 of file Gruen.cpp.
Referenced by algorithm().
|
protectedvirtual |
This virtual method must return if the 1st fit is equal to or better than the second fit.
fit1 | 1st goodness of fit |
fit2 | 2nd goodness of fit |
Reimplemented from Isis::AutoReg.
|
inlineprivate |
Helper method to initialize parameters.
This method will check the existance of a keyword and extract the value
if it exists to the passed parameter (type). If it doesn't exist, the default values is returned.
T | Templated variable type |
conf | Parameter profile container |
keyname | Name of keyword to get a value from |
defval | Default value it keyword/value doesn't exist |
index | Optional index of the value for keyword arrays |
Definition at line 257 of file Gruen.h.
References Isis::DbProfile::count(), Isis::DbProfile::exists(), and Isis::DbProfile::value().
Referenced by init().
|
inlineprivate |
Helper method to initialize parameters.
This method will check the existance of a keyword and extract the value
if it exists to the passed parameter (type). If it doesn't exist, the default values is returned.
T | Templated variable type |
conf | Parameter profile container |
keyname | Name of keyword to get a value from |
defval | Default value it keyword/value doesn't exist |
index | Optional index of the value for keyword arrays |
Definition at line 288 of file Gruen.h.
References Isis::DbProfile::count(), Isis::DbProfile::exists(), and Isis::DbProfile::value().
|
inlineinherited |
Return the search chip cube line that best matched.
Definition at line 361 of file AutoReg.h.
References Isis::AutoReg::p_cubeLine.
Referenced by Isis::SmtkMatcher::makeRegisteredPoint(), Isis::ControlPointEdit::registerPoint(), and Isis::ControlMeasureEditWidget::registerPoint().
|
inlineinherited |
Return the search chip cube sample that best matched.
Definition at line 356 of file AutoReg.h.
References Isis::AutoReg::p_cubeSample.
Referenced by Isis::SmtkMatcher::makeRegisteredPoint(), Isis::ControlPointEdit::registerPoint(), and Isis::ControlMeasureEditWidget::registerPoint().
|
inlineprivate |
Returns number of degrees of freedom of points.
Definition at line 363 of file Gruen.h.
Referenced by errorAnalysis().
|
inlineinherited |
Return the distance point moved.
sampDistance | Sample movement |
lineDistance | Line movement |
Definition at line 326 of file AutoReg.h.
References Isis::AutoReg::p_lineMovement, and Isis::AutoReg::p_sampMovement.
Referenced by Isis::ControlPointEdit::registerPoint(), and Isis::ControlMeasureEditWidget::registerPoint().
|
inlineinherited |
Return distance tolerance.
Definition at line 316 of file AutoReg.h.
References Isis::AutoReg::p_distanceTolerance.
Referenced by Isis::ControlPointEdit::registerPoint(), and Isis::ControlMeasureEditWidget::registerPoint().
|
private |
Sort eigenvectors from highest to lowest.
evals | |
evecs |
Definition at line 572 of file Gruen.cpp.
Referenced by errorAnalysis().
|
protected |
Compute the error analysis of convergent Gruen matrix.
npts | |
resid | |
atai |
Definition at line 305 of file Gruen.cpp.
References DegreesOfFreedom(), EigenSort(), Jacobi(), logError(), and Isis::IException::toString().
Referenced by MatchAlgorithm(), and Registration().
|
inlineinherited |
Return pointer to fit chip.
Definition at line 228 of file AutoReg.h.
References Isis::AutoReg::p_fitChip.
Referenced by Isis::ControlPointEdit::saveChips(), and Isis::ControlMeasureEditWidget::saveChips().
|
inline |
Returns the Affine tolerance constraint as read from config file.
Definition at line 111 of file Gruen.h.
Referenced by CheckConstraints().
|
inline |
AffineTolerance Isis::Gruen::getAffineTolerance | ( | ) | const |
Return set of tolerances for affine convergence.
Definition at line 1082 of file Gruen.cpp.
Referenced by Registration().
|
private |
Compute the chip coordinate of the registered pixel.
chip | Chip to update with registration parameters |
point | Registration match information |
Definition at line 1157 of file Gruen.cpp.
References Isis::Chip::ChipLine(), Isis::Chip::ChipSample(), Isis::Chip::CubeLine(), Isis::Chip::CubeSample(), Isis::MatchPoint::getAffinePoint(), Isis::Chip::SetChipPosition(), Isis::Chip::TackCube(), Isis::Chip::TackLine(), and Isis::Chip::TackSample().
Referenced by Registration().
|
inline |
Returns default settings for Affine/Radiometric parameters.
Definition at line 117 of file Gruen.h.
Referenced by setAffineRadio().
|
staticprivate |
|
inlineprivate |
Returns the default radiometric gain value.
Definition at line 358 of file Gruen.h.
Referenced by init(), and MatchAlgorithm().
|
inline |
Returns the register state of the last successful Gruen match.
This method returns the full match condition of the last call to Gruen Register function that was successful.
BEWARE: This is only valid if Register returns successfully! This is due to AutoReg returning conditions that occur prior to the actual Gruen algorithm being called.
Definition at line 136 of file Gruen.h.
Referenced by Isis::SmtkMatcher::makeRegisteredPoint().
|
inline |
Returns the SPICE tolerance constraint as read from config file.
Definition at line 108 of file Gruen.h.
Referenced by Isis::SmtkMatcher::makeRegisteredPoint().
|
inlineinherited |
Return the goodness of fit of the match algorithm.
Definition at line 339 of file AutoReg.h.
References Isis::AutoReg::p_goodnessOfFit.
Referenced by Isis::ControlPointEdit::registerPoint(), Isis::ControlMeasureEditWidget::registerPoint(), Isis::ControlPointEdit::saveMeasure(), and Isis::ControlMeasureEditWidget::saveMeasure().
|
inlineprotectedvirtual |
Returns the ideal fit for a perfect Gruen result.
Implements Isis::AutoReg.
|
private |
Initialize the object.
This method reads from the Algorithm group (if it exists) to set variables used in this object. If not all the keywords are present, then appropriate values are provided.
PvlObject | &pvl PVL object/groups that contain algorithm parameters |
Definition at line 983 of file Gruen.cpp.
References ConfKey(), Isis::PvlObject::findGroup(), getAffineRadio(), getDefaultRadio(), Isis::PvlObject::hasObject(), initErrorList(), Isis::DbProfile::Name(), Isis::DbProfile::setName(), Isis::toDouble(), Isis::toInt(), Isis::toString(), and Isis::PvlObject::Traverse.
Referenced by Gruen().
|
private |
Creates an error list from know Gruen errors.
This method creates the list of known/expected Gruen errors that might occur during processing. This should be closely maintained with the ErrorTypes enum list.
Definition at line 938 of file Gruen.cpp.
References Isis::CollectorMap< K, T, ComparePolicy, RemovalPolicy, CopyPolicy >::add().
Referenced by init().
|
inlineinherited |
Returns true if the fit parameter is arbitrarily close to the ideal fit value.
fit | Fit value to be compared to the ideal fit |
Definition at line 1175 of file AutoReg.cpp.
|
private |
Compute the Jacobian of a covariance matrix.
a | |
evals | |
evecs | |
MaxIters |
Definition at line 443 of file Gruen.cpp.
References _FILEINFO_, and Isis::IException::Programmer.
Referenced by errorAnalysis().
|
private |
Logs a Gruen error.
A running count of errors that occur is maintained through this method. If an error occurs that is not in the list, it will also be counted. This would indicate that a new error condition has occured and needs to be added to the list.
gerrno | One of the errors as defined by GruenError enum |
gerrmsg | Optional message although it is ignored in this context |
Definition at line 964 of file Gruen.cpp.
References Isis::CollectorMap< K, T, ComparePolicy, RemovalPolicy, CopyPolicy >::exists(), and Isis::CollectorMap< K, T, ComparePolicy, RemovalPolicy, CopyPolicy >::get().
Referenced by algorithm(), CheckConstraints(), errorAnalysis(), and Registration().
Minimization of data set using Gruen algorithm.
This is a very minimal application of the Gruen algorithm that provides the ability to use it in a non-adaptive capacity. This method processes two chips of the same size, pattern and subsearch. The subsearch has typically been extracted in the same manner as the MinimumDifference or MaximumCorrelation routines are utilized.
It simply applies the algorithm to the current state of the two chips, computes the error analysis on it and returns the eigen vector solution as an indication of chip registration integrity.
Note that in this mode, most all the parameters found in the definition file that apply to the adaptive mode are ignored when utilizing the algorithm in this fashion.
pattern | [in] A Chip object usually containing an nxm area of a cube. Must be the same diminsions as subsearch. |
subsearch | [in] A Chip object usually containing an nxm area of a cube. Must be the same dimensions as pattern. This is normally a subarea of a larger portion of the image. |
Implements Isis::AutoReg.
Definition at line 624 of file Gruen.cpp.
References algorithm(), errorAnalysis(), getDefaultRadio(), Isis::Analysis::getEigen(), and Isis::Null.
|
inlineinherited |
Return minimumPatternZScore.
Definition at line 366 of file AutoReg.h.
References Isis::AutoReg::p_minimumPatternZScore.
Referenced by Isis::ControlPointEdit::registerPoint(), and Isis::ControlMeasureEditWidget::registerPoint().
Computes the number of minimum valid points.
This method uses the pattern valid percent as specified in the registration config file (or the programmer) to compute the minimum number of valid points from the total.
totalPoints | Assumed to be total number of relavent pixels in a chip |
Definition at line 1054 of file Gruen.cpp.
References Isis::AutoReg::PatternValidPercent().
Referenced by algorithm(), and ValidPoints().
|
inlinevirtualinherited |
Minimum tolerance specific to algorithm.
Reimplemented in Isis::MinimumDifference.
|
inlineprivate |
Keyword formatter for Gruen parameters.
Constructs a keyword with actual user/programmer values if provided, otherwise sets the value to "Unbounded".
T | Type of value to record |
keyname | Name of keyword to create |
value | Value to set keyword to if in profile |
unit | Optional unit value |
Definition at line 317 of file Gruen.h.
References Isis::DbProfile::exists(), and ValidateKey().
Referenced by ParameterLog().
|
private |
Create a PvlGroup with the Gruen specific parameters.
This method generates a PvlGroup of Gruen algorithm parameters. This routine is called from the AutoReg algorithm specific statistics routine and augments the AutoReg log output.
Definition at line 906 of file Gruen.cpp.
References ParameterKey(), Isis::toString(), and ValidateKey().
Referenced by AlgorithmStatistics().
|
protectedinherited |
Initialize parameters in the AutoReg class using a PVL specification.
An example of the PVL required for this is:
There are many other options that can be set via the pvl and are described in other documentation (see below).
pvl | The pvl object containing the specification |
iException::User | "Improper format for AutoReg PVL." |
2010-06-15 Jeannie Walldren - Added ability to read ChipInterpolator keyword from the Algorithm group.
2010-07-20 Jeannie Walldren - Added ability to read search sub chip valid percent
Definition at line 207 of file AutoReg.cpp.
References _FILEINFO_, Isis::PvlContainer::fileName(), Isis::PvlObject::findGroup(), Isis::PvlObject::findObject(), Isis::PvlObject::hasGroup(), Isis::PvlContainer::hasKeyword(), Isis::ValidMaximum, and Isis::ValidMinimum.
|
inlineinherited |
Return pointer to pattern chip.
Definition at line 218 of file AutoReg.h.
References Isis::AutoReg::p_patternChip.
Referenced by Isis::ControlPointEdit::registerPoint(), and Isis::ControlMeasureEditWidget::registerPoint().
|
inlineinherited |
Return pattern chip valid percent. The default value is.
Definition at line 296 of file AutoReg.h.
References Isis::AutoReg::p_patternValidPercent.
Referenced by Isis::MaximumCorrelation::MatchAlgorithm(), MinValidPoints(), Isis::ControlPointEdit::registerPoint(), and Isis::ControlMeasureEditWidget::registerPoint().
This method reduces the given chip by the given reduction factor.
Used to speed up the match algorithm.
chip | Chip to be reduced |
reductionFactor | Factor by which to reduce chip. |
Definition at line 552 of file AutoReg.cpp.
References Isis::Statistics::AddData(), Isis::Statistics::Average(), Isis::Chip::GetValue(), Isis::Chip::Lines(), Isis::Null, Isis::Statistics::Reset(), Isis::Chip::Samples(), and Isis::Chip::SetValue().
|
inlineinherited |
Return pointer to reduced fit chip.
Definition at line 263 of file AutoReg.h.
References Isis::AutoReg::p_reducedFitChip.
|
inlineinherited |
Return pointer to reduced pattern chip.
Definition at line 253 of file AutoReg.h.
References Isis::AutoReg::p_reducedPatternChip.
|
inlineinherited |
Return pointer to reduced search chip.
Definition at line 258 of file AutoReg.h.
References Isis::AutoReg::p_reducedSearchChip.
|
inlineinherited |
Return the reduction factor.
Definition at line 291 of file AutoReg.h.
References Isis::AutoReg::p_reduceFactor.
|
inherited |
Walk the pattern chip through the search chip to find the best registration.
iException::User | - "Search chips samples must be at least N pixels wider than the pattern chip samples for successful surface modeling" |
iException::User | - "Search chips lines must be at least N pixels taller than the pattern chip lines for successful surface modeling" |
iException::User | - "Reduction factor is too large" |
Prep for walking the search chip by computing the starting and ending sample and line positions of the search chip to extract a sub-search chip to compare with the pattern chip.
Because the sub-search chip needs to have the same pixel dimensions as the pattern chip, and will be composed from its center pixel outwards, buffer the start and end boundaries so an area the size of the pattern chip can always be extracted around the current position.
For example, consider trying to extract a 5x5 sub-search chip from some search chip. If one starts at sample 1 and line 1, then because the "current position" is treated as the center of the sub-search chip, the algorithm could not form a 5x5 chip because there is nothing up and to the left of the current position. Consequently, for this example, there needs to be a two-pixel buffer from the edge of the search chip as the algorithm walks through it to make sure a 5x5 sub-search chip can always be extracted with the current position as its center.
Definition at line 600 of file AutoReg.cpp.
References _FILEINFO_, Isis::Chip::CubeLine(), Isis::Chip::CubeSample(), Isis::Chip::IsValid(), Isis::Chip::Lines(), Isis::Null, Isis::Chip::Samples(), Isis::Chip::SetChipPosition(), Isis::Chip::TackLine(), and Isis::Chip::TackSample().
Referenced by Isis::SmtkMatcher::makeRegisteredPoint(), Isis::ControlPointEdit::registerPoint(), and Isis::ControlMeasureEditWidget::registerPoint().
|
protectedvirtual |
Applies the adaptive Gruen algorithm to pattern and search chips.
This method computes the adaptive Gruen algorithm for a pattern chip and search chip. The search chip is assumed to be of a larger size than the pattern chip as dictated by the contents of the registration definition file.
This algorithm can be used with or without "fast geoming" the search chip. It works quite well where the two images are assumed to be nearly spatially registered. Its real intent is to compute parallax angles between two images taken at different viewing geometry. This provides an efficient process for deriving a digital elevation model (DEM) from two datasets.
The Gruen algorithm is applied to the chips until the algorithm converges (current iteration yields a detla affine within tolerance limits), an error is encountered, or the maximum number of iterations is exceeded.
Note that bestSamp and bestLine may not be the original center of the search chip. It is subject to chip reduction matching as specified by the user. All distance tolerances are compute from this postion. The process of chip reduction processing is handled by AutoReg prior to calling this routine.
sChip | Full search chip as rendered from the search image |
pChip | Full pattern chip as rendered from the pattern/match image |
fChip | Maintains the solution vector at each chip location |
startSamp | Starting sample of the search image range |
startLine | Starting line of the search image range |
endSamp | Ending sample of the search image range |
endLine | Ending line of the search image range |
bestSamp | Best registering sample of search chip |
bestLine | best registering line of search chip |
Reimplemented from Isis::AutoReg.
Definition at line 696 of file Gruen.cpp.
References algorithm(), CheckConstraints(), errorAnalysis(), Isis::Chip::Extract(), getAffineTolerance(), getChipUpdate(), Isis::Threshold::hasConverged(), Isis::Chip::Lines(), logError(), Isis::Chip::Samples(), Isis::AutoReg::SetChipLine(), Isis::Chip::SetChipPosition(), Isis::AutoReg::SetChipSample(), Isis::AutoReg::SetGoodnessOfFit(), Isis::Chip::SetSize(), Status(), Isis::Chip::TackLine(), Isis::Chip::TackSample(), Isis::AffineRadio::Translate(), and Isis::Chip::Write().
|
inlineinherited |
Return pointer to pattern chip used in registration.
Definition at line 233 of file AutoReg.h.
References Isis::AutoReg::None, Isis::AutoReg::p_gradientFilterType, Isis::AutoReg::p_gradientPatternChip, and Isis::AutoReg::p_patternChip.
Referenced by Isis::ControlPointEdit::saveChips(), and Isis::ControlMeasureEditWidget::saveChips().
|
inlineinherited |
Return pointer to search chip used in registration.
Definition at line 243 of file AutoReg.h.
References Isis::AutoReg::None, Isis::AutoReg::p_gradientFilterType, Isis::AutoReg::p_gradientSearchChip, and Isis::AutoReg::p_searchChip.
Referenced by Isis::ControlPointEdit::saveChips(), and Isis::ControlMeasureEditWidget::saveChips().
|
inherited |
This returns the cumulative registration statistics.
That is, the Register() method accumulates statistics regard the errors each time is called. Invoking this method returns a PVL summary of those statisitics
Definition at line 1190 of file AutoReg.cpp.
References Isis::PvlObject::addGroup(), and Isis::toString().
|
inherited |
This function returns the keywords that this object was created from.
Definition at line 1229 of file AutoReg.cpp.
References Isis::PvlContainer::hasKeyword().
|
private |
Reset Gruen statistics as needed.
Definition at line 1034 of file Gruen.cpp.
References Isis::Statistics::Reset().
|
inlineinherited |
Return pointer to search chip.
Definition at line 223 of file AutoReg.h.
References Isis::AutoReg::p_searchChip.
Referenced by Isis::ControlPointEdit::registerPoint(), and Isis::ControlMeasureEditWidget::registerPoint().
void Isis::Gruen::setAffineRadio | ( | const AffineRadio & | affrad | ) |
Sets initial chip transformation.
This method can be used with AutoReg registration to set initial affine transform parameters. This initial condition will be applied to the whole search chip extraction for the first subsearch chip. The caller must define the contents of the affine and radiometric parameters. See the AffineRadio construct for details.
affrad | Initial Affine/Radio parameters to apply on registration entry |
void Isis::Gruen::setAffineRadio | ( | ) |
Set affine parameters to defaults.
This method differs from the one above in that it uses the defaults as defined at construction. The basic difference is that this call sets the affine portion to the identity and the radiometric parameters to the defaults as provided in the user input auto-regististration parameters. It may have default shift and gain values to use.
Definition at line 143 of file Gruen.cpp.
References getDefaultAffineRadio().
|
inherited |
Sets the Chip class interpolator type to be used to load pattern and search chips.
Acceptable values for the interpolator parameter include:
If this method is not called, the chip interpolator type defaults to CubicConvolutionType in the Chip class.
interpolator | Name of interpolator type to be used. This is taken from the Pvl's ChipInterpolator keyword value. |
iException::User | - "Invalid Interpolator type." |
Definition at line 453 of file AutoReg.cpp.
References _FILEINFO_.
|
inlineprotectedinherited |
Sets the search chip subpixel line that matches the pattern tack line.
line | Value to set for search chip subpixel line |
Definition at line 420 of file AutoReg.h.
References Isis::AutoReg::p_chipLine.
Referenced by Registration().
|
inlineprotectedinherited |
Sets the search chip subpixel sample that matches the pattern tack sample.
sample | Value to set for search chip subpixel sample |
Definition at line 409 of file AutoReg.h.
References Isis::AutoReg::p_chipSample.
Referenced by Registration().
|
inlineprotectedinherited |
Sets the goodness of fit for adaptive algorithms.
fit | Fit value to set |
Definition at line 429 of file AutoReg.h.
References Isis::AutoReg::p_bestFit.
Referenced by Registration().
|
inherited |
Set the gradient filter type to be applied to the search and pattern chips.
gradientFilterType | the gradient filter type to use |
iException::User | - "Invalid Gradient type." |
Definition at line 286 of file AutoReg.cpp.
|
inherited |
Set the amount of data in the pattern chip that must be valid.
For example, a 21x21 pattern chip has 441 pixels. If percent is 75 then at least 330 pixels pairs must be valid in order for a comparision between the pattern and search sub-region to occur. That is, both the pattern pixel and search pixel must be valid to be counted. Pixels are considered valid based on the min/max range specified on each of the Chips (see Chip::SetValidRange method).
If the pattern chip reduction option is used this percentage will apply to all reduced patterns. Additionally, the pattern sampling effects the pixel count. For example if pattern sampling is 50% then only 220 pixels in the 21x21 pattern are considered so 165 must be valid.
If this method is not called, the PatternChip ValidPercent defaults to 50 in the AutoReg object constructor.
percent | Percentage of valid data between 0 and 100, default is 50% if never invoked |
iException::User | - "Invalid value for PatternChip ValidPercent." |
Definition at line 352 of file AutoReg.cpp.
References _FILEINFO_.
|
inherited |
Set the minimum pattern zscore.
This option is used to ignore pattern chips which are bland (low standard deviation). If the minimum or maximum pixel value in the pattern chip does not meet the minimum zscore value (see a statisitcs book for definition of zscore) then invalid registration will occur.
If this method is not called, the z-score minimum defaults to 1.0 in the AutoReg object constructor.
minimum | The minimum zscore value for the pattern chip. Default is 1.0 |
iException::User | - "Invalid value for PatternChip MinimumZScore." |
Definition at line 407 of file AutoReg.cpp.
References _FILEINFO_.
|
inherited |
Set the reduction factor used to speed up the pattern matching algorithm.
If this method is not called, the reduction factor defaults to 1 in the AutoReg object constructor.
factor | Reduction factor. Must be greater than or equal to 1. |
iException::User | - "Invalid value for Algorithm ReductionFactor." |
Definition at line 534 of file AutoReg.cpp.
References _FILEINFO_.
|
inherited |
If the sub-pixel accuracy is enabled, the Register() method will attempt to match the pattern chip to the search chip at sub-pixel accuracy, otherwise it will be registered at whole pixel accuracy.
If this method is not called, the sub pixel accuracy defaults to on = true in the AutoReg object constructor.
on | Set the state of registration accuracy. The default is sub-pixel accuracy is on |
Definition at line 325 of file AutoReg.cpp.
|
protectedinherited |
Set the search chip sample and line to subpixel values if possible.
This method uses a centroiding method to gravitate the whole pixel best fit to a subpixel extremum in the continuous image space. The weights of the centers of gravity in the centroiding algorithm are modeled by goodness of fit values within a discrete search window.
window | The search window extracted from the fit chip |
Definition at line 1100 of file AutoReg.cpp.
References Isis::Chip::ChipLine(), Isis::Chip::ChipSample(), Isis::Chip::GetValue(), Isis::Chip::Lines(), Isis::Chip::Samples(), Isis::Centroid::select(), Isis::Centroid::setDNRange(), and Isis::Chip::SetValue().
|
inherited |
Set the amount of data in the search chip's subchip that must be valid.
If this method is not called, the SearchChip SubchipValidPercent defaults to 50 in the AutoReg object constructor.
percent | Percentage of valid data between 0 and 100, default is 50% if never invoked |
iException::User | - "Invalid value for SearchChip SubchipValidPercent." |
Definition at line 380 of file AutoReg.cpp.
References _FILEINFO_.
|
inherited |
Set a distance the surface model solution is allowed to move away from the best whole pixel fit in the fit chip.
If this method is not called, the distance tolerance defaults to 1.5 in the AutoReg object constructor.
distance | The distance allowed to move in pixels. Must be greater than 0. |
iException::User | - "Invalid value for SurfaceModel DistanceTolerance." |
Definition at line 514 of file AutoReg.cpp.
References _FILEINFO_.
|
inherited |
Set the surface model window size.
The pixels in this window will be used to fit a surface model in order to compute sub-pixel accuracy. In some cases the default (3x3) and produces erroneous sub-pixel accuracy values.
If this method is not called, the window size defaults to 5 in the AutoReg object constructor.
size | The size of the window must be three or greater and odd. |
iException::User | - "Invalid value for SurfaceModel WindowSize." |
Definition at line 493 of file AutoReg.cpp.
References _FILEINFO_.
|
inherited |
Set the tolerance for an acceptable goodness of fit.
If this method is not called, the tolerance value defaults to Isis::Null in the AutoReg object constructor.
tolerance | This tolerance is used to test against the goodness of fit returned by the MatchAlgorith method after a surface model has been fit. See TestGoodnessOfFit |
Definition at line 429 of file AutoReg.cpp.
|
private |
Create a PvlGroup with the Gruen specific statistics.
This method generates a PvlGroup from statistics collected for a particular Gruen algorithm application. This routine is called from the AutoReg algorithm specific statistics routine and augments the AutoReg statistics log output.
Definition at line 869 of file Gruen.cpp.
References Isis::Statistics::Average(), Isis::Statistics::Maximum(), Isis::Statistics::Minimum(), Isis::Statistics::StandardDeviation(), Isis::toString(), and ValidateKey().
Referenced by AlgorithmStatistics().
|
private |
Returns the proper status given a Gruen result container.
This method will return registration status consistant with AutoReg::RegisterStatus return codes.
result | Gruen result container used to determine status |
Definition at line 1177 of file Gruen.cpp.
References Isis::AutoReg::AdaptiveAlgorithmFailed, and Isis::AutoReg::SuccessSubPixel.
Referenced by Registration().
|
inlineinherited |
Return whether this object will attempt to register to whole or sub-pixel accuracy.
Definition at line 286 of file AutoReg.h.
References Isis::AutoReg::p_subpixelAccuracy.
|
inlineinherited |
Return subsearch chip valid percent.
Definition at line 301 of file AutoReg.h.
References Isis::AutoReg::p_subsearchValidPercent.
|
inlineinherited |
Return whether the match algorithm succeeded or not.
Definition at line 334 of file AutoReg.h.
References Isis::AutoReg::p_registrationStatus, Isis::AutoReg::SuccessPixel, and Isis::AutoReg::SuccessSubPixel.
Referenced by Isis::ControlPointEdit::registerPoint(), and Isis::ControlMeasureEditWidget::registerPoint().
|
inlineinherited |
Return match algorithm tolerance.
Definition at line 306 of file AutoReg.h.
References Isis::AutoReg::p_tolerance.
Referenced by CheckConstraints(), Isis::ControlPointEdit::registerPoint(), and Isis::ControlMeasureEditWidget::registerPoint().
|
inherited |
Returns a PvlGroup containing the PvlKeywords of the parameters this object was most recently run with.
Because of publically accessible mutators, AutoReg's runtime parameters can change, and this version of the template is designed to reflect the paramters it was actually run with, as opposed to simply initialized with. If no mutators were ever called externally, then this PvlGroup should be the same as the one received from RegTemplate().
Definition at line 1302 of file AutoReg.cpp.
References Isis::Chip::Lines(), Isis::Chip::Samples(), and Isis::toString().
|
inlineprivate |
Checks value of key, produces appropriate value.
This function checks the value of the keyword for specialness and will create the appropriate keyword if it is special.
keyname | Name of keyword to create |
value | Keyword value |
unit | Optional unit qualifer with value |
Definition at line 339 of file Gruen.h.
References Isis::IsSpecial(), and Isis::toString().
Referenced by ParameterKey(), ParameterLog(), and StatsLog().
Determines if number of points is valid percentage of all points.
Computes the number of minimum valid points from user specified percentage and tests the acutal number used.
totalPoints | Total number of possible valid points in chip |
nPoints | Actual number of valid points used in chips |
Definition at line 1071 of file Gruen.cpp.
References MinValidPoints().
Referenced by algorithm().
|
inlineinherited |
Return window size.
Definition at line 311 of file AutoReg.h.
References Isis::AutoReg::p_windowSize.
void Isis::Gruen::WriteSubsearchChips | ( | const QString & | pattern = "SubChip" | ) |
Set up for writing subsearch for a a given registration call.
This method is provided to request the write of the subsearch chip at each iteration. This must be invoked prior to every call to AutoReg::Register() method. It will only write subchips from the Register() interface as it interates to a solution. Direct calls to Gruen methods don't iterate in the same fashion.
The "pattern" parameter is optional but is provided to direct the location and naming convention of each subsearch chip. The format for the output file name for each subsearch chip is comprised of the pattern parameter, call number, which can be retrieved by the CallCount() method and pertains to the call after the Register() method is invoked and the interation count. Below is a code example:
Note that prior to each call to Register(), it must be called again in order for the subchips to be written. The last part of the parameter above, "subchip", cannot be a directory, but is a filename prefix. Assuming this is the first call to Register(), a series of cube subsearch chips will be written with the pattern "/work1/kbecker/subchipC000001IXXX.cub" where "C" indicates call count and the next 6 digits are the return of CallCount() method, "I" indicates the iteration count "XXX" of the algorithm() method. Note that the chip written for a particular iteration is what is provided as a parameter into the algorithm() method.
pattern | Specifies an optional directory and file pattern to write the subsearch chip at each algorithm iteration. |
|
inlineinherited |
Return the ZScores of the pattern chip.
score1 | First Z Score |
score2 | Second Z Score |
Definition at line 376 of file AutoReg.h.
References Isis::AutoReg::p_zScoreMax, and Isis::AutoReg::p_zScoreMin.
Referenced by Isis::ControlPointEdit::registerPoint(), Isis::ControlMeasureEditWidget::registerPoint(), Isis::ControlPointEdit::saveMeasure(), and Isis::ControlMeasureEditWidget::saveMeasure().
|
protectedinherited |