9#include "BundleControlPoint.h" 
   14#include <boost/numeric/ublas/vector_proxy.hpp> 
   17#include "ControlMeasure.h" 
   19#include "LinearAlgebra.h" 
   21#include "SparseBlockMatrix.h" 
   22#include "SpecialPixel.h" 
   38    int numMeasures = controlPoint->GetNumMeasures();
 
   39    for (
int i = 0; i < numMeasures; i++) {
 
   41      if (controlMeasure->IsIgnored()) {
 
   66    m_coordTypeBundle = bundleSettings->controlPointCoordTypeBundle();
 
 
  101    int numMeasures = src.size();
 
  103    for (
int i = 0; i < numMeasures; i++)
 
  112    m_coordTypeBundle = src.m_coordTypeBundle;
 
 
  129    append(bundleMeasure);
 
  131    return bundleMeasure;
 
 
  144    for (
int i = 0; i < size(); i++) {
 
  145      at(i)->setFocalPlaneResidualsMillimeters();
 
 
  193    double globalPointCoord1AprioriSigma = settings->globalPointCoord1AprioriSigma();
 
  194    double globalPointCoord2AprioriSigma = settings->globalPointCoord2AprioriSigma();
 
  195    double globalPointCoord3AprioriSigma = settings->globalPointCoord3AprioriSigma();
 
  209      if (!
IsSpecial(globalPointCoord1AprioriSigma)) {
 
  213      if (!
IsSpecial(globalPointCoord2AprioriSigma)) {
 
  222        if (!
IsSpecial(globalPointCoord3AprioriSigma)) {
 
  241      else if (!
IsSpecial(globalPointCoord1AprioriSigma)) {
 
  253      else if (!
IsSpecial(globalPointCoord2AprioriSigma)) {
 
  267            (m_coordTypeBundle, SurfacePoint::Three);
 
  269        else if (!
IsSpecial(globalPointCoord3AprioriSigma)) {
 
 
  295          double sigmaRadians =
 
  297          if (sigmaRadians > DBL_EPSILON) {
 
  298            m_weights[index] = 1. / (sigmaRadians*sigmaRadians);  
 
  302          double sigmakm = gSigma * .001;  
 
  303          if (sigmakm > DBL_EPSILON) {
 
  308          IString msg =
"Unknown surface point coordinate type enum [" 
  309            + 
toString(m_coordTypeBundle) + 
"]." ;
 
  316          double sigmaRadians =
 
  318          if (sigmaRadians > DBL_EPSILON) {
 
  319            m_weights[1] = 1. / (sigmaRadians*sigmaRadians);  
 
  323          double sigmakm = gSigma * 0.001;  
 
  324          if (sigmakm > DBL_EPSILON) 
m_weights[1] = 1./ (sigmakm*sigmakm); 
 
  327          IString msg =
"Unknown surface point coordinate type enum [" 
  328            + 
toString(m_coordTypeBundle) + 
"]." ;
 
  336        double sigmakm = gSigma * .001;  
 
 
  373    int subrangeStart, subrangeEnd;
 
  375    while ( Qit.hasNext() ) {
 
  378      int columnIndex = Qit.key();
 
  380      subrangeStart = sparseNormals.at(columnIndex)->startColumn();
 
  381      subrangeEnd = subrangeStart + Qit.value()->size2();
 
  383      m_nicVector += alpha * prod(*(Qit.value()),subrange(v1,subrangeStart,subrangeEnd));
 
 
  404      switch (m_coordTypeBundle) {
 
  412            IString msg =
"Unknown surface point coordinate type enum [" 
  413            + 
toString(m_coordTypeBundle) + 
"]." ;
 
 
  534    return m_coordTypeBundle;
 
 
  629    SurfacePoint::CoordUnits units = SurfacePoint::Degrees;
 
  632                                                  SurfacePoint::One, units);
 
  634                                                  SurfacePoint::Two, units);
 
  636                                                  SurfacePoint::Three, SurfacePoint::Kilometers);
 
  640    QString output = QString(
"%1%2%3 of %4%5%6%7%8%9%10%11\n")
 
 
  669                                                             bool solveRadius)
 const {
 
  680         IString msg =
"Unknown surface point coordinate type enum [" + 
toString(m_coordTypeBundle) + 
"]." ;
 
 
  708                                                             bool errorPropagation,
 
  709                                                             bool solveRadius)
 const {
 
  719    double rtm = rad * 1000.;
 
  724    double cor_lat_dd = 0.;                
 
  725    double cor_lon_dd = 0.;               
 
  726    double cor_rad_km  = 0.;             
 
  727    double cor_lat_m = 0.;                 
 
  728    double cor_lon_m = 0.;                
 
  729    double cor_rad_m  = 0.;              
 
  746        latInit = rectPoint.GetLatitude().degrees();
 
  747        lonInit = rectPoint.GetLongitude().degrees();
 
  748        radInit = rectPoint.GetLocalRadius().kilometers();
 
  750          cor_lat_dd = (lat - latInit); 
 
  751          cor_lat_m  =  cor_lat_dd * 
DEG2RAD * rtm;
 
  754          cor_lon_dd = (lon - lonInit); 
 
  758          cor_rad_km  =  rad - radInit;
 
  759          cor_rad_m  =  cor_rad_km * 1000.;
 
  773        latInit = lat - cor_lat_dd;
 
  777        lonInit = lon - cor_lon_dd;
 
  785      IString msg =
"Unknown surface point coordinate type enum [" +
 
  786        toString(m_coordTypeBundle) + 
"]." ;
 
  794    output = QString(
" Label: %1\nStatus: %2\n  Rays: %3 of %4\n")
 
  800    QString labels = 
"\n     Point         Initial               Total               Total        " 
  801                     "      Final             Initial             Final\n" 
  802                     "Coordinate          Value             Correction          Correction        " 
  803                     "    Value             Accuracy          Accuracy\n" 
  804                     "                 (dd/dd/km)           (dd/dd/km)           (Meters)         " 
  805                     "  (dd/dd/km)          (Meters)          (Meters)\n";
 
  808    SurfacePoint::CoordIndex idx = SurfacePoint::One;
 
  809    output += QString(
"  LATITUDE%1%2%3%4%5%6\n")
 
  817    idx = SurfacePoint::Two;
 
  818    output += QString(
" LONGITUDE%1%2%3%4%5%6\n")
 
  826    idx = SurfacePoint::Three;
 
  827    output += QString(
"    RADIUS%1%2%3%4%5%6\n\n")
 
 
  851                                                        (
bool errorPropagation)
 const {
 
  880        XInit = latPoint.GetX().kilometers();
 
  881        YInit = latPoint.GetY().kilometers();
 
  882        ZInit = latPoint.GetZ().kilometers();
 
  885          cor_X_m = (X - XInit); 
 
  889          cor_Y_m = (Y - YInit); 
 
  893          cor_Z_m = (Z - ZInit); 
 
  912      IString msg =
"Unknown surface point coordinate type enum [" +
 
  913        toString(m_coordTypeBundle) + 
"]." ;
 
  921    output = QString(
" Label: %1\nStatus: %2\n  Rays: %3 of %4\n")
 
  928                       "\n        Point         Initial              Total              Final        " 
  930                       "   Coordinate         Value             Correction            Value         " 
  931                       "    Accuracy          Accuracy\n" 
  932                       "                    (km/km/km)             (km)           (km/km/km)         " 
  933                       " (Meters)          (Meters)\n";
 
  936    SurfacePoint::CoordIndex idx = SurfacePoint::One;
 
  937    output += QString(
" BODY-FIXED-X%1%2%3%4%5\n")
 
  944    idx = SurfacePoint::Two;
 
  945    output += QString(
" BODY-FIXED-Y%1%2%3%4%5\n")
 
  952    idx = SurfacePoint::Three;
 
  953    output += QString(
" BODY-FIXED-Z%1%2%3%4%5\n\n")
 
 
  979      output = QString(
"%1").arg(
"Null", fieldWidth) :
 
  980      output = QString(
"%1").arg(value, fieldWidth, 
'f', precision);
 
 
  999                                                       int fieldWidth, 
int precision,
 
 1000                                                       bool solveRadius)
 const {
 
 1001    QString aprioriSigmaStr;
 
 1003    if (pointType == 
"CONSTRAINED" || !solveRadius) {
 
 1008      aprioriSigmaStr = QString(
"%1").arg(pointType, fieldWidth);
 
 1011      aprioriSigmaStr = QString(
"%1").arg(sigma, fieldWidth, 
'f', precision);
 
 1013    return aprioriSigmaStr;
 
 
 1030                                                          bool solveRadius)
 const {
 
 
 1049                                                        int fieldWidth, 
int precision,
 
 1050                                                        bool errorPropagation)
 const {
 
 1051    QString adjustedSigmaStr;
 
 1053    if (!errorPropagation) {
 
 1054      adjustedSigmaStr = QString(
"%1").arg(
"N/A",fieldWidth);
 
 1061        adjustedSigmaStr = QString(
"%1").arg(
"N/A",fieldWidth);
 
 1064        adjustedSigmaStr = QString(
"%1").arg(sigma, fieldWidth, 
'f', precision);
 
 1068    return adjustedSigmaStr;
 
 
 1085                                                                int fieldWidth, 
int precision,
 
 1086                                                                bool errorPropagation)
 const {
 
 
 1100      double pointLat = surfacepoint.GetLatitude().degrees();
 
 1101      double pointLon = surfacepoint.GetLongitude().degrees();
 
 1102      double pointRad = surfacepoint.GetLocalRadius().meters();
 
 1110      pointLat += 
RAD2DEG * latCorrection;
 
 1111      pointLon += 
RAD2DEG * lonCorrection;
 
 1114      if (pointLat < -90.0) {
 
 1115        pointLat = -180.0 - pointLat;
 
 1116        pointLon = pointLon + 180.0;
 
 1118      if (pointLat > 90.0) {
 
 1119        pointLat = 180.0 - pointLat;
 
 1120        pointLon = pointLon + 180.0;
 
 1122      while (pointLon > 360.0) {
 
 1123        pointLon = pointLon - 360.0;
 
 1125      while (pointLon < 0.0) {
 
 1126        pointLon = pointLon + 360.0;
 
 1130      pointRad += 1000. * radCorrection;
 
 1135      if (target && (target->solveMeanRadius() || target->solveTriaxialRadii()) ) {
 
 1136        if (target->solveMeanRadius()) {
 
 1139                                               target->meanRadius());
 
 1141        else if (target->solveTriaxialRadii()) {
 
 
 1166      double pointX = surfacepoint.GetX().meters();
 
 1167      double pointY = surfacepoint.GetY().meters();
 
 1168      double pointZ = surfacepoint.GetZ().meters();
 
 1176      pointX += 1000. * XCorrection;
 
 1177      pointY += 1000. * YCorrection;
 
 1178      pointZ += 1000. * ZCorrection;
 
 
 1196    double weight = 0.0;
 
 1199    for (
int i = 0; i < size(); i++) {
 
 1201      if (measure->isRejected()) {
 
 1205      weight = measure->weight();
 
 1206      vx = measure->xFocalPlaneResidual();
 
 1207      vy = measure->yFocalPlaneResidual();
 
 1209      vtpv += vx * vx * weight + vy * vy * weight;
 
 
double degrees() const
Get the angle in units of Degrees.
 
@ Degrees
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
 
This class holds information about a control point that BundleAdjust needs to run correctly.
 
QString formatValue(double value, int fieldWidth, int precision) const
Formats the given double precision value using the specified field width and precision.
 
double residualRms() const
Gets the root-mean-square (rms) of the BundleControlPoint's residuals.
 
void setNumberOfRejectedMeasures(int numRejected)
Sets the number of rejected measures for this BundleControlPoint.
 
SparseBlockRowMatrix & cholmodQMatrix()
Accesses the CholMod matrix associated with this BundleControlPoint.
 
virtual void applyParameterCorrections(LinearAlgebra::Vector imageSolution, SparseBlockMatrix &sparseNormals, const BundleTargetBodyQsp target)
Apply the parameter corrections to the bundle control point.
 
QString formatBundleOutputDetailString(bool errorPropagation, bool solveRadius=false) const
Formats a detailed output string table for this BundleControlPoint.
 
SurfacePoint::CoordinateType coordTypeReports() const
Accesses BundleControlPoint's coordinate type for reports.
 
void setRejected(bool reject)
Sets this BundleControlPoint to rejected or not rejected.
 
boost::numeric::ublas::bounded_vector< double, 3 > m_nicVector
array of NICs (see Brown, 1976)
 
QString formatBundleRectangularOutputDetailString(bool errorPropagation) const
Formats a detailed output string table for this Rectangular BundleControlPoint.
 
void updateAdjustedSurfacePointRectangularly()
Apply the parameter corrections to the bundle control point rectangularly.
 
virtual ~BundleControlPoint()
Destructor for BundleControlPoint.
 
BundleControlPoint(BundleSettingsQsp bundleSettings, ControlPoint *point)
Constructs a BundleControlPoint object from a ControlPoint.
 
void productAlphaAV(double alpha, SparseBlockMatrix &sparseNormals, LinearAlgebra::Vector &v1)
Perform the matrix multiplication v2 = alpha ( Q x v1 ).
 
int numberOfRejectedMeasures() const
Accesses the number of rejected measures for this BundleControlPoint.
 
QString formatBundleLatitudinalOutputDetailString(bool errorPropagation, bool solveRadius=false) const
Formats a detailed output string table for this Latitudinal BundleControlPoint.
 
void updateAdjustedSurfacePointLatitudinally(const BundleTargetBodyQsp target)
Apply the parameter corrections to the bundle control point latitudinally.
 
double vtpvMeasures()
Compute vtpv of image measures (weighted sum of squares of measure residuals).
 
QString formatAprioriSigmaString(SurfacePoint::CoordIndex index, int fieldWidth, int precision, bool solveRadius=false) const
Formats the apriori sigma value indicated by the given type code.
 
boost::numeric::ublas::bounded_vector< double, 3 > m_corrections
corrections to point parameters
 
void zeroNumberOfRejectedMeasures()
Resets the number of rejected measures for this BundleControlPoint to zero.
 
void computeResiduals()
Computes the residuals for this BundleControlPoint.
 
SurfacePoint adjustedSurfacePoint() const
Accesses the adjusted SurfacePoint associated with this BundleControlPoint.
 
QString formatCoordAdjustedSigmaString(SurfacePoint::CoordIndex, int fieldWidth, int precision, bool errorPropagation) const
Formats the adjusted coordinate sigma value.
 
SurfacePoint::CoordinateType coordTypeBundle() const
Accesses BundleControlPoint's control point coordinate type for the bundle adjustment.
 
boost::numeric::ublas::bounded_vector< double, 3 > & nicVector()
Accesses the 3 dimensional ordered NIC vector.
 
double vtpv()
Compute vtpv, the weighted sum of squares of constrained point residuals.
 
ControlPoint::PointType type() const
Accesses BundleControlPoint's type.
 
boost::numeric::ublas::bounded_vector< double, 3 > & weights()
Accesses the 3 dimensional ordered vector of weight values associated with coordinate1,...
 
bool isRejected() const
Method used to determine whether this control point is rejected.
 
void setAdjustedSurfacePoint(SurfacePoint surfacePoint)
Sets the adjusted surface point for this BundleControlPoint.
 
boost::numeric::ublas::bounded_vector< double, 3 > m_aprioriSigmas
apriori sigmas for point parameters
 
ControlPoint * m_controlPoint
< pointer to the control point object this represents
 
QString formatAdjustedSigmaString(SurfacePoint::CoordIndex, int fieldWidth, int precision, bool errorPropagation) const
Formats the adjusted sigma value indicated by the given type code.
 
QString formatCoordAprioriSigmaString(SurfacePoint::CoordIndex index, int fieldWidth, int precision, bool solveRadius=false) const
Formats the apriori coordinate 1 (latitude or X) sigma value.
 
boost::numeric::ublas::bounded_vector< double, 3 > & corrections()
Accesses the 3 dimensional ordered vector of correction values associated with coord1,...
 
boost::numeric::ublas::bounded_vector< double, 3 > & aprioriSigmas()
Accesses the 3 dimensional ordered vector of apriori sigmas (apriori coordinate1, apriori coordinate2...
 
BundleMeasureQsp addMeasure(ControlMeasure *controlMeasure)
Creates a BundleMeasure from the given ControlMeasure and appends it to this BundleControlPoint's mea...
 
boost::numeric::ublas::bounded_vector< double, 3 > m_adjustedSigmas
adjusted sigmas for point parameters
 
void copy(const BundleControlPoint &src)
Copies given BundleControlPoint to this BundleControlPoint.
 
SurfacePoint::CoordinateType m_coordTypeReports
BundleControlPoint coordinate type.
 
boost::numeric::ublas::bounded_vector< double, 3 > & adjustedSigmas()
Accesses the 3 dimensional ordered vector of adjusted sigmas (adjusted coordinate1,...
 
void setWeights(const BundleSettingsQsp settings)
Sets the weights using the given BundleSettings QSharedPointer and a conversion value for meters to r...
 
QString formatBundleOutputSummaryString(bool errorPropagation) const
Formats an output summary string for this BundleControlPoint.
 
void setSigmaWeightFromGlobals(double gSigma, int index)
Sets the member sigmas and weights from a global sigma.
 
int numberOfMeasures() const
Accesses number of measures associated with this BundleControlPoint.
 
ControlPoint * rawControlPoint() const
Accessor for the raw ControlPoint object used for this BundleControlPoint.
 
boost::numeric::ublas::bounded_vector< double, 3 > m_weights
weights for point parameters
 
SparseBlockRowMatrix m_cholmodQMatrix
The CholMod matrix associated with this point.
 
QString id() const
Accesses the Point ID associated with this BundleControlPoint.
 
A container class for a ControlMeasure.
 
double GetResidualRms() const
Get rms of residuals.
 
Status SetRejected(bool rejected)
Set the jigsawRejected state.
 
PointType GetType() const
 
Status SetAdjustedSurfacePoint(SurfacePoint newSurfacePoint)
Set or update the surface point relating to this control point.
 
PointType
These are the valid 'types' of point.
 
@ Constrained
A Constrained point is a Control Point whose lat/lon/radius is somewhat established and should not be...
 
@ Free
A Free point is a Control Point that identifies common measurements between two or more cubes.
 
@ Fixed
A Fixed point is a Control Point whose lat/lon is well established and should not be changed.
 
const ControlMeasure * GetMeasure(QString serialNumber) const
Get a control measure based on its cube's serial number.
 
bool IsCoord2Constrained()
Return bool indicating if 2nd coordinate is Constrained or not.
 
bool IsCoord1Constrained()
Return bool indicating if 1st coordinate is Constrained or not.
 
bool IsCoord3Constrained()
Return bool indicating if 3rd coordinate is Constrained or not.
 
static QString PointTypeToString(PointType type)
Obtain a string representation of a given PointType.
 
Status ComputeResiduals()
This method computes the BundleAdjust residuals for a point.
 
QString GetId() const
Return the Id of the control point.
 
void ZeroNumberOfRejectedMeasures()
Initialize the number of rejected measures to 0.
 
int GetNumberOfRejectedMeasures() const
Get the number of rejected measures on the control point.
 
void SetNumberOfRejectedMeasures(int numRejected)
Set (update) the number of rejected measures for the control point.
 
Displacement is a signed length, usually in meters.
 
double kilometers() const
Get the displacement in kilometers.
 
@ Kilometers
The distance is being specified in kilometers.
 
@ Meters
The distance is being specified in meters.
 
Distance measurement, usually in meters.
 
double kilometers() const
Get the distance in kilometers.
 
@ Kilometers
The distance is being specified in kilometers.
 
@ Meters
The distance is being specified in meters.
 
double meters() const
Get the distance in meters.
 
@ Programmer
This error is for when a programmer made an API call that was illegal.
 
Adds specific functionality to C++ strings.
 
This class is designed to encapsulate the concept of a Latitude.
 
boost::numeric::ublas::vector< double > Vector
Definition for an Isis::LinearAlgebra::Vector of doubles.
 
This class is designed to encapsulate the concept of a Longitude.
 
This class defines a body-fixed surface point.
 
CoordinateType
Defines the coordinate typ, units, and coordinate index for some of the output methods.
 
@ Latitudinal
Planetocentric latitudinal (lat/lon/rad) coordinates.
 
@ Rectangular
Body-fixed rectangular x/y/z coordinates.
 
Latitude GetLatitude() const
Return the body-fixed latitude for the surface point.
 
double GetWeight(CoordinateType type, CoordIndex index)
This method returns the weight of a SurfacePoint coordinate Note: At this time a units argument is no...
 
double MetersToLongitude(double lonLength)
This method returns an angular measure in radians of a distance in the direction of and relative to t...
 
double LongitudeToMeters(double longitude) const
This method returns a length in meters version of a delta longitude angle in radians relative to the ...
 
Longitude GetLongitude() const
Return the body-fixed longitude for the surface point.
 
double GetCoord(CoordinateType type, CoordIndex index, CoordUnits units)
This method returns a coordinate of a SurfacePoint.
 
double LatitudeToMeters(double latitude) const
This method returns a Displacement of an Angle relative to the current SurfacePoint latitude.
 
double MetersToLatitude(double latLength)
This method returns an angular measure of a distance in the direction of and relative to the latitude...
 
Distance GetSigmaDistance(CoordinateType type, CoordIndex index)
This method returns a sigma of a SurfacePoint coordinate as a Distance.
 
Distance GetLocalRadius() const
Return the radius of the surface point.
 
This is free and unencumbered software released into the public domain.
 
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
 
const double DEG2RAD
Multiplier for converting from degrees to radians.
 
const double Null
Value for an Isis Null pixel.
 
bool IsSpecial(const double d)
Returns if the input pixel is special.
 
const double RAD2DEG
Multiplier for converting from radians to degrees.
 
QSharedPointer< BundleMeasure > BundleMeasureQsp
Definition for BundleMeasureQsp, a shared pointer to a BundleMeasure.