Isis 3 Programmer Reference
MinimumDifference.cpp
Go to the documentation of this file.
1 
24 #include "MinimumDifference.h"
25 #include "Chip.h"
26 
27 namespace Isis {
28 
47  double MinimumDifference::MatchAlgorithm(Chip &pattern, Chip &subsearch) {
48  // calculate the sampling information
49 
50  double diff = 0.0;
51  double count = 0;
52  for(double l = 1.0; l <= pattern.Lines(); l++) {
53  for(double s = 1.0; s <= pattern.Samples(); s++) {
54  int line = (int)l;
55  int samp = (int)s;
56 
57  double pdn = pattern.GetValue(samp, line);
58  double sdn = subsearch.GetValue(samp, line);
59  if(IsSpecial(pdn)) continue;
60  if(IsSpecial(sdn)) continue;
61  diff += fabs(pdn - sdn);
62  count++;
63  }
64  }
65 
66  return diff / count;
67  }
68 
76  bool MinimumDifference::CompareFits(double fit1, double fit2) {
77  return (fit1 <= fit2);
78  }
79 }
80 
81 extern "C" Isis::AutoReg *MinimumDifferencePlugin(Isis::Pvl &pvl) {
82  return new Isis::MinimumDifference(pvl);
83 }
84 
A small chip of data used for pattern matching.
Definition: Chip.h:102
int Lines() const
Definition: Chip.h:122
bool IsSpecial(const double d)
Returns if the input pixel is special.
Definition: SpecialPixel.h:212
Container for cube-like labels.
Definition: Pvl.h:135
Auto Registration class.
Definition: AutoReg.h:183
int Samples() const
Definition: Chip.h:115
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...
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
virtual double MatchAlgorithm(Chip &pattern, Chip &subsearch)
Minimum difference match algorithm.
double GetValue(int sample, int line)
Loads a Chip with a value.
Definition: Chip.h:161
Minimum difference pattern matching.