31 #include <tnt/tnt_array1d.h> 32 #include <tnt/tnt_array2d.h> 33 #include <tnt/tnt_array2d_utils.h> 46 typedef TNT::Array1D<double> GVector;
72 Coordinate(
double y,
double x) : m_y(y), m_x(x) { }
78 void setLatLon(
const double &latitude,
const double &longitude) {
117 double yd = pntA.m_y - m_y;
118 double xd = pntA.m_x - m_x;
119 return (std::sqrt((xd * xd) + (yd * yd)));
127 inline double getLatitude()
const {
return (m_y); }
128 inline double getLongitude()
const {
return (m_x); }
129 inline double getLine()
const {
return (m_y); }
130 inline double getSample()
const {
return (m_x); }
148 return (
Coordinate(A.m_y+B.m_y, A.m_x+B.m_x));
166 return (
Coordinate(A.m_y-B.m_y, A.m_x-B.m_x));
190 PointPair(
const double &line,
const double &sample) : m_left(line, sample),
200 inline const Coordinate &getLeft()
const {
return (m_left); }
201 inline const Coordinate &getRight()
const {
return (m_right); }
203 inline double getLine()
const {
return (getLeftLine()); }
204 inline double getSample()
const {
return (getLeftSample()); }
205 inline double getLeftLine()
const {
return (m_left.getLine()); }
206 inline double getLeftSample()
const {
return (m_left.getSample()); }
207 inline double getRightLine()
const {
return (m_right.getLine()); }
208 inline double getRightSample()
const {
return (m_right.getSample()); }
225 Radiometric(
const double &shift,
const double &gain) :
226 m_shift(shift), m_gain(gain) { }
228 inline double Shift()
const {
return (m_shift); }
229 inline double Gain()
const {
return (m_gain); }
234 m_shift += B.m_shift;
245 return (
Radiometric(A.m_shift+B.m_shift, A.m_gain+B.m_gain));
261 AffineRadio(
const GMatrix &A) : m_affine(A), m_radio() { }
263 const double &gain) : m_affine(M), m_radio(shift, gain) { }
264 AffineRadio(
const GVector &alpha) : m_affine(), m_radio() {
274 m_radio += other.m_radio;
281 trans[0][2] = offset.getSample();
282 trans[1][2] = offset.getLine();
283 m_affine = TNT::matmult(trans, m_affine);
289 double x = m_affine[0][0] * location.getSample() +
290 m_affine[0][1] * location.getLine() + m_affine[0][2];
291 double y = m_affine[1][0] * location.getSample() +
292 m_affine[1][1] * location.getLine() + m_affine[1][2];
302 if ( alpha.dim1() != 8 ) {
303 QString mess =
"Alpha array for AffineRadio must have 8 elements " 304 " but has " +
toString(alpha.dim1());
308 m_affine[0][0] += alpha[1];
309 m_affine[0][1] += alpha[2];
310 m_affine[0][2] += alpha[0];
312 m_affine[1][0] += alpha[4];
313 m_affine[1][1] += alpha[5];
314 m_affine[1][2] += alpha[3];
316 m_radio.m_shift = alpha[6];
317 m_radio.m_gain = alpha[7];
337 AffineTolerance() : m_transTol(0.1), m_scaleTol(0.5), m_shearTol(0.5) { }
339 const double &shearTol) : m_transTol(transTol),
340 m_scaleTol(scaleTol),
341 m_shearTol(shearTol) { }
368 m_thresh[0] = tolerance.m_scaleTol / (((double)(chip.
Samples() - 1)) / 2.0);
369 m_thresh[1] = tolerance.m_shearTol / (((double)(chip.
Lines() - 1)) / 2.0);
370 m_thresh[2] = tolerance.m_transTol;
372 m_thresh[3] = tolerance.m_shearTol / (((double)(chip.
Samples() - 1)) / 2.0);
373 m_thresh[4] = tolerance.m_scaleTol / (((double)(chip.
Lines() - 1)) / 2.0);
374 m_thresh[5] = tolerance.m_transTol;
381 const double *alpha = Malpha[0];
382 for (
int i = 0 ; i < m_thresh.dim1() ; i++ ) {
383 if ( std::fabs(alpha[i]) >= m_thresh[i] )
return (
false);
400 Analysis() : m_npts(0), m_variance(0.0), m_sevals(),
401 m_kmat(), m_status(-1) {
402 for (
int i = 0 ; i < 2 ; i++ ) {
409 inline bool isValid()
const {
return (m_status == 0); }
413 double eigen = std::sqrt(m_sevals[0] * m_sevals[0] +
414 m_sevals[1] * m_sevals[1]);
420 for (
int i = 0 ; i < 2 ; i++ ) {
451 MatchPoint() : m_point(), m_affine(), m_analysis(), m_status(-1) { }
453 m_analysis(), m_status(-1) { }
455 m_analysis(), m_status(-1) { }
458 inline int getStatus()
const {
return (m_status); }
464 inline bool isValid()
const {
return (m_status == 0); }
465 inline double getEigen()
const {
return (m_analysis.
getEigen()); }
Coordinate operator-(const Coordinate &A, const Coordinate &B)
Subtraction operator for Coordinate.
long long int BigInt
Big int.
double getEigen() const
Returns the square of the of sum of the squares of eigenvalues.
const double Null
Value for an Isis Null pixel.
void setZeroState()
Resets eigenvalues to 0.
Coordinate getPoint(const Coordinate &location) const
Applies the affine transfrom to a point and returns result.
Define a generic Y/X container.
Store for radiometric gain and shift parameters.
double getDistance(const Coordinate &pntA=Coordinate(0.0, 0.0)) const
Computes the distance from this point and the point provided.
A small chip of data used for pattern matching.
void Translate(const Coordinate &offset)
Apply a translation to the given offset.
Define a point set of left, right and geometry at that location.
bool isValid() const
Left, right and geometry coordinates must all be good data.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
This error is for when a programmer made an API call that was illegal.
void setLatLon(const double &latitude, const double &longitude)
Use Latitude/Longitude interface.
Radiometric & operator+=(const Radiometric &B)
Add radiometric parameters from another set of parameters.
TNT::Array2D< double > AMatrix
Affine Matrix.
void clone(const GVector &alpha)
Generate a matrix from the Gruen alpha vector.
#define _FILEINFO_
Macro for the filename and line number.
Coordinate operator+(const Coordinate &A, const Coordinate &B)
Summation operator for Coordinate.
void setLineSamp(const double &line, const double &sample)
Use the Line/Sample interface.
double CubeSample() const
bool isValid() const
Check for goodness.
bool IsSpecial(const double d)
Returns if the input pixel is special.
AffineRadio & operator+=(const AffineRadio &other)
Define update procedure for accumulating Gruen iterations.
Container for Affine limits parameters.
Container for affine and radiometric parameters.
Coordinate & operator-=(const Coordinate &other)
Subtract a point from this point.
Structure containing comprehensive registration info/results.
bool hasConverged(const AffineRadio &affine) const
Determines convergence from an affine/radiometric fit.
static AMatrix getIdentity()
Return an Affine identity matrix.
Namespace for ISIS/Bullet specific routines.
Compute/test the Affine convergence from given parameters/chip.
Coordinate getAffinePoint(const Coordinate &coord=Coordinate(0.0, 0.0)) const
Return registration offset of a given chip coordinate from center.
Error analysis of Gruen match point solution.
Coordinate & operator+=(const Coordinate &other)
Add a point to this point.