6 #include <boost/numeric/ublas/vector_proxy.hpp> 27 m_controlPoint = controlPoint;
30 int numMeasures = controlPoint->GetNumMeasures();
31 for (
int i = 0; i < numMeasures; i++) {
33 if (controlMeasure->IsIgnored()) {
58 m_coordTypeBundle = bundleSettings->controlPointCoordTypeBundle();
91 m_controlPoint = src.m_controlPoint;
93 int numMeasures = src.size();
95 for (
int i = 0; i < numMeasures; i++)
104 m_coordTypeBundle = src.m_coordTypeBundle;
121 append(bundleMeasure);
123 return bundleMeasure;
180 double globalPointCoord1AprioriSigma = settings->globalPointCoord1AprioriSigma();
181 double globalPointCoord2AprioriSigma = settings->globalPointCoord2AprioriSigma();
182 double globalPointCoord3AprioriSigma = settings->globalPointCoord3AprioriSigma();
196 if (!
IsSpecial(globalPointCoord1AprioriSigma)) {
200 if (!
IsSpecial(globalPointCoord2AprioriSigma)) {
209 if (!
IsSpecial(globalPointCoord3AprioriSigma)) {
226 m_controlPoint->GetAprioriSurfacePoint().
GetWeight(m_coordTypeBundle, SurfacePoint::One);
228 else if (!
IsSpecial(globalPointCoord1AprioriSigma)) {
238 m_controlPoint->GetAprioriSurfacePoint().
GetWeight(m_coordTypeBundle, SurfacePoint::Two);
240 else if (!
IsSpecial(globalPointCoord2AprioriSigma)) {
254 (m_coordTypeBundle, SurfacePoint::Three);
256 else if (!
IsSpecial(globalPointCoord3AprioriSigma)) {
282 double sigmaRadians =
284 if (sigmaRadians > DBL_EPSILON) {
285 m_weights[index] = 1. / (sigmaRadians*sigmaRadians);
289 double sigmakm = gSigma * .001;
290 if (sigmakm > DBL_EPSILON) {
295 IString msg =
"Unknown surface point coordinate type enum [" 296 +
toString(m_coordTypeBundle) +
"]." ;
303 double sigmaRadians =
305 if (sigmaRadians > DBL_EPSILON) {
306 m_weights[1] = 1. / (sigmaRadians*sigmaRadians);
310 double sigmakm = gSigma * 0.001;
311 if (sigmakm > DBL_EPSILON)
m_weights[1] = 1./ (sigmakm*sigmakm);
314 IString msg =
"Unknown surface point coordinate type enum [" 315 +
toString(m_coordTypeBundle) +
"]." ;
323 double sigmakm = gSigma * .001;
360 int subrangeStart, subrangeEnd;
362 while ( Qit.hasNext() ) {
365 int columnIndex = Qit.key();
367 subrangeStart = sparseNormals.at(columnIndex)->startColumn();
368 subrangeEnd = subrangeStart + Qit.value()->size2();
370 m_nicVector += alpha * prod(*(Qit.value()),subrange(v1,subrangeStart,subrangeEnd));
391 switch (m_coordTypeBundle) {
399 IString msg =
"Unknown surface point coordinate type enum [" 400 +
toString(m_coordTypeBundle) +
"]." ;
418 return m_controlPoint;
428 return m_controlPoint->IsRejected();
472 return m_controlPoint->GetAdjustedSurfacePoint();
482 return m_controlPoint->
GetId();
495 return m_controlPoint->
GetType();
521 return m_coordTypeBundle;
616 SurfacePoint::CoordUnits units = SurfacePoint::Degrees;
619 SurfacePoint::One, units);
621 SurfacePoint::Two, units);
623 SurfacePoint::Three, SurfacePoint::Kilometers);
627 QString output = QString(
"%1%2%3 of %4%5%6%7%8%9%10%11\n")
656 bool solveRadius)
const {
667 IString msg =
"Unknown surface point coordinate type enum [" +
toString(m_coordTypeBundle) +
"]." ;
695 bool errorPropagation,
696 bool solveRadius)
const {
706 double rtm = rad * 1000.;
711 double cor_lat_dd = 0.;
712 double cor_lon_dd = 0.;
713 double cor_rad_km = 0.;
714 double cor_lat_m = 0.;
715 double cor_lon_m = 0.;
716 double cor_rad_m = 0.;
722 double x = m_controlPoint->GetAdjustedSurfacePoint().GetX().
kilometers();
724 double y = m_controlPoint->GetAdjustedSurfacePoint().GetY().
kilometers();
726 double z = m_controlPoint->GetAdjustedSurfacePoint().GetZ().
kilometers();
737 cor_lat_dd = (lat - latInit);
738 cor_lat_m = cor_lat_dd *
DEG2RAD * rtm;
741 cor_lon_dd = (lon - lonInit);
745 cor_rad_km = rad - radInit;
746 cor_rad_m = cor_rad_km * 1000.;
760 latInit = lat - cor_lat_dd;
764 lonInit = lon - cor_lon_dd;
772 IString msg =
"Unknown surface point coordinate type enum [" +
773 toString(m_coordTypeBundle) +
"]." ;
781 output = QString(
" Label: %1\nStatus: %2\n Rays: %3 of %4\n")
787 QString labels =
"\n Point Initial Total Total " 788 " Final Initial Final\n" 789 "Coordinate Value Correction Correction " 790 " Value Accuracy Accuracy\n" 791 " (dd/dd/km) (dd/dd/km) (Meters) " 792 " (dd/dd/km) (Meters) (Meters)\n";
795 SurfacePoint::CoordIndex idx = SurfacePoint::One;
796 output += QString(
" LATITUDE%1%2%3%4%5%6\n")
804 idx = SurfacePoint::Two;
805 output += QString(
" LONGITUDE%1%2%3%4%5%6\n")
813 idx = SurfacePoint::Three;
814 output += QString(
" RADIUS%1%2%3%4%5%6\n\n")
838 (
bool errorPropagation)
const {
839 int numRays = numberOfMeasures();
840 int numGoodRays = numRays - numberOfRejectedMeasures();
841 double X = m_controlPoint->GetAdjustedSurfacePoint().GetX().kilometers();
842 double Y = m_controlPoint->GetAdjustedSurfacePoint().GetY().kilometers();
843 double Z = m_controlPoint->GetAdjustedSurfacePoint().GetZ().kilometers();
856 double lat = m_controlPoint->GetAdjustedSurfacePoint().GetLatitude().degrees();
857 double latcor = m_corrections(0) *
RAD2DEG;
858 double lon = m_controlPoint->GetAdjustedSurfacePoint().GetLongitude().degrees();
859 double loncor = m_corrections(1) *
RAD2DEG;
860 double rad = m_controlPoint->GetAdjustedSurfacePoint().GetLocalRadius().kilometers();
861 double radcor = m_corrections(2);
872 cor_X_m = (X - XInit);
876 cor_Y_m = (Y - YInit);
880 cor_Z_m = (Z - ZInit);
885 cor_X_m = m_corrections(0);
886 cor_Y_m = m_corrections(1);
887 cor_Z_m = m_corrections(2);
889 XInit = X - m_corrections(0);
892 YInit = Y - m_corrections(1);
895 ZInit = Z - m_corrections(2);
899 IString msg =
"Unknown surface point coordinate type enum [" +
900 toString(m_coordTypeBundle) +
"]." ;
908 output = QString(
" Label: %1\nStatus: %2\n Rays: %3 of %4\n")
915 "\n Point Initial Total Final " 917 " Coordinate Value Correction Value " 918 " Accuracy Accuracy\n" 919 " (km/km/km) (km) (km/km/km) " 920 " (Meters) (Meters)\n";
923 SurfacePoint::CoordIndex idx = SurfacePoint::One;
924 output += QString(
" BODY-FIXED-X%1%2%3%4%5\n")
925 .arg(formatValue(XInit, 17, 8))
926 .arg(formatValue(cor_X_m, 20, 8))
927 .arg(formatValue(X, 20, 8))
928 .arg(formatCoordAprioriSigmaString(idx, 18,8,
true))
929 .arg(formatCoordAdjustedSigmaString(idx, 18,8,errorPropagation));
931 idx = SurfacePoint::Two;
932 output += QString(
" BODY-FIXED-Y%1%2%3%4%5\n")
933 .arg(formatValue(YInit, 17, 8))
934 .arg(formatValue(cor_Y_m, 20, 8))
935 .arg(formatValue(Y, 20, 8))
936 .arg(formatCoordAprioriSigmaString(idx, 18, 8,
true))
937 .arg(formatCoordAdjustedSigmaString(idx, 18,8,errorPropagation));
939 idx = SurfacePoint::Three;
940 output += QString(
" BODY-FIXED-Z%1%2%3%4%5\n\n")
941 .arg(formatValue(ZInit, 17, 8))
942 .arg(formatValue(cor_Z_m, 20, 8))
943 .arg(formatValue(Z, 20, 8))
946 .arg(formatCoordAprioriSigmaString(idx, 18,8,
true))
947 .arg(formatCoordAdjustedSigmaString(idx, 18,8,errorPropagation));
966 output = QString(
"%1").arg(
"Null", fieldWidth) :
967 output = QString(
"%1").arg(value, fieldWidth,
'f', precision);
986 int fieldWidth,
int precision,
987 bool solveRadius)
const {
988 QString aprioriSigmaStr;
990 if (pointType ==
"CONSTRAINED" || !solveRadius) {
995 aprioriSigmaStr = QString(
"%1").arg(pointType, fieldWidth);
998 aprioriSigmaStr = QString(
"%1").arg(sigma, fieldWidth,
'f', precision);
1000 return aprioriSigmaStr;
1017 bool solveRadius)
const {
1036 int fieldWidth,
int precision,
1037 bool errorPropagation)
const {
1038 QString adjustedSigmaStr;
1040 if (!errorPropagation) {
1041 adjustedSigmaStr = QString(
"%1").arg(
"N/A",fieldWidth);
1048 adjustedSigmaStr = QString(
"%1").arg(
"N/A",fieldWidth);
1051 adjustedSigmaStr = QString(
"%1").arg(sigma, fieldWidth,
'f', precision);
1055 return adjustedSigmaStr;
1072 int fieldWidth,
int precision,
1073 bool errorPropagation)
const {
1092 double latCorrection = m_nicVector[0];
1093 double lonCorrection = m_nicVector[1];
1094 double radCorrection = m_nicVector[2];
1097 pointLat +=
RAD2DEG * latCorrection;
1098 pointLon +=
RAD2DEG * lonCorrection;
1101 if (pointLat < -90.0) {
1102 pointLat = -180.0 - pointLat;
1103 pointLon = pointLon + 180.0;
1105 if (pointLat > 90.0) {
1106 pointLat = 180.0 - pointLat;
1107 pointLon = pointLon + 180.0;
1109 while (pointLon > 360.0) {
1110 pointLon = pointLon - 360.0;
1112 while (pointLon < 0.0) {
1113 pointLon = pointLon + 360.0;
1117 pointRad += 1000. * radCorrection;
1122 if (target && (target->solveMeanRadius() || target->solveTriaxialRadii()) ) {
1123 if (target->solveMeanRadius()) {
1126 target->meanRadius());
1128 else if (target->solveTriaxialRadii()) {
1142 setAdjustedSurfacePoint(surfacepoint);
1153 double pointX = surfacepoint.GetX().
meters();
1154 double pointY = surfacepoint.GetY().
meters();
1155 double pointZ = surfacepoint.GetZ().
meters();
1163 pointX += 1000. * XCorrection;
1164 pointY += 1000. * YCorrection;
1165 pointZ += 1000. * ZCorrection;
This class defines a body-fixed surface point.
double meters() const
Get the distance in meters.
void ZeroNumberOfRejectedMeasures()
Initialize the number of rejected measures to 0.
QString formatBundleRectangularOutputDetailString(bool errorPropagation) const
Formats a detailed output string table for this Rectangular BundleControlPoint.
ControlPoint::PointType type() const
Accesses BundleControlPoint's type.
const double Null
Value for an Isis Null pixel.
QString formatAdjustedSigmaString(SurfacePoint::CoordIndex, int fieldWidth, int precision, bool errorPropagation) const
Formats the adjusted sigma value indicated by the given type code.
The distance is being specified in kilometers.
QString formatBundleOutputDetailString(bool errorPropagation, bool solveRadius=false) const
Formats a detailed output string table for this BundleControlPoint.
void SetNumberOfRejectedMeasures(int numRejected)
Set (update) the number of rejected measures for the control point.
boost::numeric::ublas::bounded_vector< double, 3 > m_adjustedSigmas
adjusted sigmas for point parameters
A Constrained point is a Control Point whose lat/lon/radius is somewhat established and should not be...
double residualRms() const
Gets the root-mean-square (rms) of the BundleControlPoint's residuals.
A Fixed point is a Control Point whose lat/lon is well established and should not be changed...
BundleControlPoint(BundleSettingsQsp bundleSettings, ControlPoint *point)
Constructs a BundleControlPoint object from a ControlPoint.
SurfacePoint::CoordinateType coordTypeBundle() const
Accesses BundleControlPoint's control point coordinate type for the bundle adjustment.
bool IsCoord3Constrained()
Return bool indicating if 3rd coordinate is Constrained or not.
QString formatAprioriSigmaString(SurfacePoint::CoordIndex index, int fieldWidth, int precision, bool solveRadius=false) const
Formats the apriori sigma value indicated by the given type code.
void setRejected(bool reject)
Sets this BundleControlPoint to rejected or not rejected.
int GetNumberOfRejectedMeasures() const
Get the number of rejected measures on the control point.
const ControlMeasure * GetMeasure(QString serialNumber) const
Get a control measure based on its cube's serial number.
BundleMeasureQsp addMeasure(ControlMeasure *controlMeasure)
Creates a BundleMeasure from the given ControlMeasure and appends it to this BundleControlPoint's mea...
void applyParameterCorrections(LinearAlgebra::Vector imageSolution, SparseBlockMatrix &sparseNormals, const BundleTargetBodyQsp target)
Apply the parameter corrections to the bundle control point.
double MetersToLatitude(double latLength)
This method returns an angular measure of a distance in the direction of and relative to the latitude...
void copy(const BundleControlPoint &src)
Copies given BundleControlPoint to this BundleControlPoint.
PointType
These are the valid 'types' of point.
double meters() const
Get the displacement in meters.
void SetRectangularCoordinates(const Displacement &x, const Displacement &y, const Displacement &z)
Set surface point in rectangular coordinates.
This class is designed to encapsulate the concept of a Latitude.
void computeResiduals()
Computes the residuals for this BundleControlPoint.
boost::numeric::ublas::bounded_vector< double, 3 > & weights()
Accesses the 3 dimensional ordered vector of weight values associated with coordinate1, coordinate2, and coordinate3.
The distance is being specified in kilometers.
boost::numeric::ublas::bounded_vector< double, 3 > & aprioriSigmas()
Accesses the 3 dimensional ordered vector of apriori sigmas (apriori coordinate1, apriori coordinate2...
A container class for a ControlMeasure.
void updateAdjustedSurfacePointRectangularly()
pointer to the control point object this represents
QString formatValue(double value, int fieldWidth, int precision) const
Formats the given double precision value using the specified field width and precision.
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.
double kilometers() const
Get the distance in kilometers.
The distance is being specified in meters.
Distance measurement, usually in meters.
double GetResidualRms() const
Get rms of residuals.
Latitude GetLatitude() const
Return the body-fixed latitude for the surface point.
boost::numeric::ublas::bounded_vector< double, 3 > & adjustedSigmas()
Accesses the 3 dimensional ordered vector of adjusted sigmas (adjusted coordinate1, adjusted coordinate2, adjusted coordinate3).
double GetCoord(CoordinateType type, CoordIndex index, CoordUnits units)
This method returns a coordinate of a SurfacePoint.
double degrees() const
Get the angle in units of Degrees.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Status SetAdjustedSurfacePoint(SurfacePoint newSurfacePoint)
Set or update the surface point relating to this control point.
boost::numeric::ublas::bounded_vector< double, 3 > & corrections()
Accesses the 3 dimensional ordered vector of correction values associated with coord1, coord2, and coord 3 (latitude, longitude, and radius or X, Y, and Z.
A Free point is a Control Point that identifies common measurements between two or more cubes...
boost::numeric::ublas::bounded_vector< double, 3 > & nicVector()
Accesses the 3 dimensional ordered NIC vector.
Planetocentric latitudinal (lat/lon/rad) coordinates.
boost::numeric::ublas::bounded_vector< double, 3 > m_nicVector
array of NICs (see Brown, 1976)
This class is designed to encapsulate the concept of a Longitude.
ControlPoint * rawControlPoint() const
Accessor for the raw ControlPoint object used for this BundleControlPoint.
boost::numeric::ublas::vector< double > Vector
Definition for an Isis::LinearAlgebra::Vector of doubles.
void updateAdjustedSurfacePointLatitudinally(const BundleTargetBodyQsp target)
Apply the parameter corrections to the bundle control point latitudinally.
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
QString formatBundleLatitudinalOutputDetailString(bool errorPropagation, bool solveRadius=false) const
Formats a detailed output string table for this Latitudinal BundleControlPoint.
int numberOfRejectedMeasures() const
Accesses the number of rejected measures for this BundleControlPoint.
boost::numeric::ublas::bounded_vector< double, 3 > m_aprioriSigmas
apriori sigmas for point parameters
QString GetId() const
Return the Id of the control point.
double LongitudeToMeters(double longitude) const
This method returns a length in meters version of a delta longitude angle in radians relative to the ...
double MetersToLongitude(double lonLength)
This method returns an angular measure in radians of a distance in the direction of and relative to t...
bool IsCoord2Constrained()
Return bool indicating if 2nd coordinate is Constrained or not.
void zeroNumberOfRejectedMeasures()
Resets the number of rejected measures for this BundleControlPoint to zero.
void setAdjustedSurfacePoint(SurfacePoint surfacePoint)
Sets the adjusted surface point for this BundleControlPoint.
#define _FILEINFO_
Macro for the filename and line number.
SurfacePoint::CoordinateType m_coordTypeReports
BundleControlPoint coordinate type.
boost::numeric::ublas::bounded_vector< double, 3 > m_weights
weights for point parameters
This class holds information about a control point that BundleAdjust needs to run correctly...
bool IsCoord1Constrained()
Return bool indicating if 1st coordinate is Constrained or not.
~BundleControlPoint()
Destructor for BundleControlPoint.
bool IsSpecial(const double d)
Returns if the input pixel is special.
boost::numeric::ublas::bounded_vector< double, 3 > m_corrections
corrections to point parameters
void productAlphaAV(double alpha, SparseBlockMatrix &sparseNormals, LinearAlgebra::Vector &v1)
Perform the matrix multiplication v2 = alpha ( Q x v1 ).
SurfacePoint::CoordinateType coordTypeReports() const
Accesses BundleControlPoint's coordinate type for reports.
Body-fixed rectangular x/y/z coordinates.
CoordinateType
Defines the coordinate typ, units, and coordinate index for some of the output methods.
Distance GetSigmaDistance(CoordinateType type, CoordIndex index)
This method returns a sigma of a SurfacePoint coordinate as a Distance.
const double DEG2RAD
Multiplier for converting from degrees to radians.
QString formatCoordAdjustedSigmaString(SurfacePoint::CoordIndex, int fieldWidth, int precision, bool errorPropagation) const
Formats the adjusted coordinate sigma value.
Status SetRejected(bool rejected)
Set the jigsawRejected state.
double LatitudeToMeters(double latitude) const
This method returns a Displacement of an Angle relative to the current SurfacePoint latitude...
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
SurfacePoint adjustedSurfacePoint() const
Accesses the adjusted SurfacePoint associated with this BundleControlPoint.
Longitude GetLongitude() const
Return the body-fixed longitude for the surface point.
int numberOfMeasures() const
Accesses number of measures associated with this BundleControlPoint.
void setSigmaWeightFromGlobals(double gSigma, int index)
Sets the member sigmas and weights from a global sigma.
Displacement is a signed length, usually in meters.
QSharedPointer< BundleMeasure > BundleMeasureQsp
Definition for BundleMeasureQsp, a shared pointer to a BundleMeasure.
QString id() const
Accesses the Point ID associated with this BundleControlPoint.
Adds specific functionality to C++ strings.
QString formatCoordAprioriSigmaString(SurfacePoint::CoordIndex index, int fieldWidth, int precision, bool solveRadius=false) const
Formats the apriori coordinate 1 (latitude or X) sigma value.
Namespace for ISIS/Bullet specific routines.
QString formatBundleOutputSummaryString(bool errorPropagation) const
Formats an output summary string for this BundleControlPoint.
SparseBlockRowMatrix m_cholmodQMatrix
The CholMod matrix associated with this point.
bool isRejected() const
Method used to determine whether this control point is rejected.
The distance is being specified in meters.
double GetWeight(CoordinateType type, CoordIndex index)
This method returns the weight of a SurfacePoint coordinate Note: At this time a units argument is no...
const double RAD2DEG
Multiplier for converting from radians to degrees.
double kilometers() const
Get the displacement in kilometers.
PointType GetType() const
void SetSphericalCoordinates(const Latitude &lat, const Longitude &lon, const Distance &radius)
Update spherical coordinates (lat/lon/radius)
Distance GetLocalRadius() const
Return the radius of the surface point.
void setWeights(const BundleSettingsQsp settings)
Sets the weights using the given BundleSettings QSharedPointer and a conversion value for meters to r...
void setNumberOfRejectedMeasures(int numRejected)
Sets the number of rejected measures for this BundleControlPoint.
SparseBlockRowMatrix & cholmodQMatrix()
Accesses the CholMod matrix associated with this BundleControlPoint.
static QString PointTypeToString(PointType type)
Obtain a string representation of a given PointType.
Status ComputeResiduals()
This method computes the BundleAdjust residuals for a point.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.