Isis 3 Developer Reference
|
Auto Registration class. More...
#include <AutoReg.h>
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 | |
AutoReg (Pvl &pvl) | |
Create AutoReg object. More... | |
virtual | ~AutoReg () |
Destroy AutoReg object. 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... | |
virtual QString | AlgorithmName () const =0 |
Returns the name of the 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 | |
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... | |
virtual AutoReg::RegisterStatus | Registration (Chip &sChip, Chip &pChip, Chip &fChip, int startSamp, int startLine, int endSamp, int endLine, int bestSamp, int bestLine) |
Performs matching between the pattern and search at both whole-pixel and subpixel levels. More... | |
void | Parse (Pvl &pvl) |
Initialize parameters in the AutoReg class using a PVL specification. 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... | |
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... | |
virtual double | IdealFit () const =0 |
Returns the ideal (perfect) fit that could be returned by the MatchAlgorithm. More... | |
virtual double | MatchAlgorithm (Chip &pattern, Chip &subsearch)=0 |
Given two identically sized chips return a double that indicates how well they match. More... | |
virtual Pvl | AlgorithmStatistics (Pvl &pvl) |
Provide (adaptive) algorithms a chance to report results. More... | |
Protected Attributes | |
PvlObject | p_template |
AutoRegistration object that created this projection. More... | |
Auto Registration class.
Create AutoReg object. Because this is a pure virtual class you can not create an AutoReg class directly. Instead, see the AutoRegFactory class.
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::AutoReg::AutoReg | ( | Pvl & | pvl | ) |
Create AutoReg object.
Because this is a pure virtual class you can not create an AutoReg class directly. Instead, see the AutoRegFactory class. The default settings include:
The reduced chips are initially set to the same size as their corresponding chips in the constructor.
pvl | A pvl object containing a valid AutoReg specification |
References Isis::PvlObject::findObject(), Isis::None, and Isis::Null.
|
virtual |
Destroy AutoReg object.
|
pure virtual |
Returns the name of the algorithm.
Implemented in Isis::Gruen, Isis::MinimumDifference, Isis::AdaptiveGruen, and Isis::MaximumCorrelation.
Provide (adaptive) algorithms a chance to report results.
Provide Adaptive objects the opportunity to report behavior. It is called at the final step prior to program termination.
pvl | Pvl structure to add report to |
Reimplemented in Isis::Gruen.
|
inline |
Return the search chip line that best matched.
|
inline |
Return the search chip sample that best matched.
|
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 in Isis::Gruen, Isis::MinimumDifference, and Isis::MaximumCorrelation.
|
inline |
Return the search chip cube line that best matched.
|
inline |
Return the search chip cube sample that best matched.
|
inline |
Return the distance point moved.
sampDistance | Sample movement |
lineDistance | Line movement |
|
inline |
Return distance tolerance.
|
inline |
Return pointer to fit chip.
Referenced by Isis::ControlPointEdit::saveChips(), and Isis::ControlMeasureEditWidget::saveChips().
|
inline |
Return the goodness of fit of the match algorithm.
QString Isis::AutoReg::GradientFilterString | ( | ) | const |
References _FILEINFO_, and Isis::None.
|
protectedpure virtual |
Returns the ideal (perfect) fit that could be returned by the MatchAlgorithm.
Implemented in Isis::Gruen, Isis::MinimumDifference, and Isis::MaximumCorrelation.
|
inline |
Returns true if the fit parameter is arbitrarily close to the ideal fit value.
fit | Fit value to be compared to the ideal fit |
|
protectedpure virtual |
Given two identically sized chips return a double that indicates how well they match.
For example, a correlation match algorithm would return a correlation coefficient ranging from -1 to 1.
pattern | Pattern chip to match against |
subsearch | Subchip of the search chip to match with |
Implemented in Isis::Gruen, Isis::MinimumDifference, and Isis::MaximumCorrelation.
|
inline |
Return minimumPatternZScore.
|
inlinevirtual |
Minimum tolerance specific to algorithm.
Reimplemented in Isis::MinimumDifference.
|
protected |
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." |
References _FILEINFO_, Isis::PvlContainer::fileName(), Isis::PvlObject::findGroup(), Isis::PvlObject::findObject(), Isis::PvlObject::hasGroup(), Isis::PvlContainer::hasKeyword(), Isis::ValidMaximum, and Isis::ValidMinimum.
|
inline |
Return pointer to pattern chip.
|
inline |
Return pattern chip valid percent. The default value is.
Referenced by Isis::MaximumCorrelation::MatchAlgorithm().
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. |
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().
|
inline |
Return pointer to reduced fit chip.
|
inline |
Return pointer to reduced pattern chip.
|
inline |
Return pointer to reduced search chip.
|
inline |
Return the reduction factor.
AutoReg::RegisterStatus Isis::AutoReg::Register | ( | ) |
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" |
References _FILEINFO_, Isis::Chip::CubeLine(), Isis::Chip::CubeSample(), Isis::Chip::IsValid(), Isis::Chip::Lines(), Isis::None, Isis::Null, Isis::Chip::Samples(), Isis::Chip::SetChipPosition(), Isis::Chip::TackLine(), and Isis::Chip::TackSample().
|
protectedvirtual |
Performs matching between the pattern and search at both whole-pixel and subpixel levels.
For adaptive algorithms, only subpixel matching occurs. Such algorithms override this method to use their alternative matching procedures.
For those algorithms that need it, the best sample and line in the search chip is provided. This is either the initial tack sample and line in the search chip or it is the centered sample and line after the reduction algorithm is applied (KJB, 2009-08-26).
sChip | Search chip |
pChip | Pattern chip |
fChip | Fit chip |
startSamp | Defines the starting sample of the window the algorithm should remain inside this boundary. |
startLine | Defines the starting line of the window the algorithm should remain inside this boundary. |
endSamp | Defines the ending sample of the window the algorithm should remain inside this boundary. |
endLine | Defines the ending line of the window the algorithm should remain inside this boundary. |
bestSamp | Best sample |
bestLine | Best line |
Reimplemented in Isis::Gruen.
References Isis::Chip::Extract(), Isis::Chip::IsValid(), Isis::Null, and Isis::Chip::SetChipPosition().
|
inline |
Return pointer to pattern chip used in registration.
References None.
Referenced by Isis::ControlPointEdit::saveChips(), and Isis::ControlMeasureEditWidget::saveChips().
|
inline |
Return pointer to search chip used in registration.
References None.
Referenced by Isis::ControlPointEdit::saveChips(), and Isis::ControlMeasureEditWidget::saveChips().
Pvl Isis::AutoReg::RegistrationStatistics | ( | ) |
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
References Isis::PvlObject::addGroup(), and Isis::toString().
PvlGroup Isis::AutoReg::RegTemplate | ( | ) |
This function returns the keywords that this object was created from.
References Isis::PvlContainer::hasKeyword().
|
inline |
Return pointer to search chip.
void Isis::AutoReg::SetChipInterpolator | ( | const QString & | interpolator | ) |
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." |
References _FILEINFO_, Isis::Interpolator::BiLinearType, Isis::Interpolator::CubicConvolutionType, and Isis::Interpolator::NearestNeighborType.
|
inlineprotected |
Sets the search chip subpixel line that matches the pattern tack line.
line | Value to set for search chip subpixel line |
Referenced by Isis::Gruen::Registration().
|
inlineprotected |
Sets the search chip subpixel sample that matches the pattern tack sample.
sample | Value to set for search chip subpixel sample |
Referenced by Isis::Gruen::Registration().
|
inlineprotected |
Sets the goodness of fit for adaptive algorithms.
fit | Fit value to set |
Referenced by Isis::Gruen::Registration().
void Isis::AutoReg::SetGradientFilterType | ( | const QString & | gradientFilterType | ) |
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." |
References _FILEINFO_, and Isis::None.
void Isis::AutoReg::SetPatternValidPercent | ( | const double | percent | ) |
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." |
References _FILEINFO_.
void Isis::AutoReg::SetPatternZScoreMinimum | ( | double | minimum | ) |
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." |
References _FILEINFO_.
void Isis::AutoReg::SetReductionFactor | ( | int | factor | ) |
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." |
References _FILEINFO_.
void Isis::AutoReg::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.
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 |
|
protected |
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 |
References Isis::Selection::centerOfMassWeighted(), 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().
void Isis::AutoReg::SetSubsearchValidPercent | ( | const double | percent | ) |
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." |
References _FILEINFO_.
void Isis::AutoReg::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.
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." |
References _FILEINFO_.
void Isis::AutoReg::SetSurfaceModelWindowSize | ( | int | size | ) |
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." |
References _FILEINFO_.
void Isis::AutoReg::SetTolerance | ( | double | tolerance | ) |
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 |
|
inline |
Return whether this object will attempt to register to whole or sub-pixel accuracy.
|
inline |
Return subsearch chip valid percent.
|
inline |
Return whether the match algorithm succeeded or not.
References SuccessPixel, and SuccessSubPixel.
|
inline |
Return match algorithm tolerance.
PvlGroup Isis::AutoReg::UpdatedTemplate | ( | ) |
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().
References Isis::Chip::Lines(), Isis::Chip::Samples(), and Isis::toString().
|
inline |
Return window size.
|
inline |
Return the ZScores of the pattern chip.
score1 | First Z Score |
score2 | Second Z Score |
|
protected |
AutoRegistration object that created this projection.