9#include "BundleSolutionInfo.h"
15#include <QRegularExpression>
19#include <QXmlStreamWriter>
20#include <QXmlStreamReader>
22#include "BundleLidarRangeConstraint.h"
23#include "BundleResults.h"
25#include "ControlList.h"
26#include "ControlMeasure.h"
27#include "ControlNet.h"
28#include "ControlPoint.h"
34#include "PvlKeyword.h"
36#include "StatCumProbDistDynCalc.h"
37#include "Statistics.h"
50 FileName controlNetworkFileName,
54 m_id =
new QUuid(QUuid::createUuid());
59 m_outputControlName=
"";
78 FileName controlNetworkFileName,
79 FileName lidarDataFileName,
83 m_id =
new QUuid(QUuid::createUuid());
88 m_outputControlName=
"";
109 QXmlStreamReader *xmlReader,
112 m_id =
new QUuid(QUuid::createUuid());
117 m_outputControlName =
"";
125 m_xmlHandlerProject = project;
128 readBundleSolutionInfo(xmlReader);
131 void BundleSolutionInfo::readBundleSolutionInfo(QXmlStreamReader *xmlReader) {
133 if (m_xmlHandlerProject) {
134 projectRoot = m_xmlHandlerProject->
projectRoot() +
"/";
139 Q_ASSERT(xmlReader->name() ==
"bundleSolutionInfo");
140 while(xmlReader->readNextStartElement()) {
141 if (xmlReader->qualifiedName() ==
"generalAttributes") {
142 while (xmlReader->readNextStartElement()) {
143 if (xmlReader->qualifiedName() ==
"id") {
144 m_id =
new QUuid(xmlReader->readElementText());
146 else if (xmlReader->qualifiedName() ==
"name") {
147 m_name = xmlReader->readElementText();
149 else if (xmlReader->qualifiedName() ==
"runTime") {
150 m_runTime = xmlReader->readElementText();
152 else if (xmlReader->qualifiedName() ==
"inputFileName") {
155 else if (xmlReader->qualifiedName() ==
"bundleOutTXT") {
156 m_txtBundleOutputFilename = projectRoot + xmlReader->readElementText();
158 else if (xmlReader->qualifiedName() ==
"imagesCSV") {
159 m_csvSavedImagesFilename = projectRoot + xmlReader->readElementText();
161 else if (xmlReader->qualifiedName() ==
"pointsCSV") {
162 m_csvSavedPointsFilename = projectRoot + xmlReader->readElementText();
164 else if (xmlReader->qualifiedName() ==
"residualsCSV") {
165 m_csvSavedResidualsFilename = projectRoot + xmlReader->readElementText();
168 xmlReader->skipCurrentElement();
172 else if (xmlReader->name() ==
"bundleSettings") {
174 BundleSettings *settings =
new BundleSettings();
175 settings->readBundleSettings(xmlReader);
178 else if (xmlReader->name() ==
"bundleResults") {
184 xmlReader->skipCurrentElement();
230 return m_txtBundleOutputFilename;
240 return m_csvSavedImagesFilename;
250 return m_csvSavedPointsFilename;
260 return m_csvSavedResidualsFilename;
303 FileName newInputFileName(project->
cnetRoot() +
"/" +
304 oldInputFileName.dir().dirName() +
"/" + oldInputFileName.name());
308 FileName newOutputFileName(project->
cnetRoot() +
"/" +
309 oldOutputFileName.dir().dirName() +
"/" + oldOutputFileName.name());
315 m_outputControlName = newOutputFileName.expanded();
336 return m_id->toString().remove(QRegularExpression(
"[{}]"));
392 return m_outputControlName;
422 m_outputControlName =
name;
432 return m_outputControlName;
467 throw IException(IException::Unknown,
468 "Results for this bundle is NULL.",
525 std::vector<QString> outputColumns;
527 outputColumns.push_back(
"Image,");
528 outputColumns.push_back(
"rms,");
529 outputColumns.push_back(
"rms,");
530 outputColumns.push_back(
"rms,");
532 QStringList observationParameters = observation->parameterList();
534 for (
int i = 0; i < observationParameters.size(); i++) {
535 for (
int j = 0; j < 5; j++) {
536 outputColumns.push_back(observationParameters[i] +
",");
541 int ncolumns = outputColumns.size();
542 for (
int i = 0; i < ncolumns; i++) {
543 QString str = outputColumns.at(i);
544 snprintf(buf,
sizeof(buf),
"%s", (
const char*)str.toLatin1().data());
547 snprintf(buf,
sizeof(buf),
"\n");
550 outputColumns.clear();
552 outputColumns.push_back(
"Filename,");
553 outputColumns.push_back(
"sample res,");
554 outputColumns.push_back(
"line res,");
555 outputColumns.push_back(
"total res,");
557 for (
int i = 0; i < observationParameters.size(); i++) {
558 outputColumns.push_back(
"Initial,");
559 outputColumns.push_back(
"Correction,");
560 outputColumns.push_back(
"Final,");
561 outputColumns.push_back(
"Apriori Sigma,");
562 outputColumns.push_back(
"Adj Sigma,");
566 ncolumns = outputColumns.size();
567 for (
int i = 0; i < ncolumns; i++) {
568 QString str = outputColumns.at(i);
569 snprintf(buf,
sizeof(buf),
"%s", (
const char*)str.toLatin1().data());
572 snprintf(buf,
sizeof(buf),
"\n");
603 for (
int i = 0; i < numObservations; i++) {
608 int numValidLidarPoints = 0;
610 numValidLidarPoints = lidarData->numberLidarPoints();
613 int numInnerConstraints = 0;
614 int numDistanceConstraints = 0;
617 int convergenceCriteria = 1;
619 snprintf(buf,
sizeof(buf),
"JIGSAW: BUNDLE ADJUSTMENT\n=========================\n");
621 snprintf(buf,
sizeof(buf),
"\n Run Time: %s",
624 snprintf(buf,
sizeof(buf),
"\n Network Filename: %s",
628 snprintf(buf,
sizeof(buf),
"\n Cube List: %s",
629 m_settings->cubeList().toStdString().c_str() );
633 snprintf(buf,
sizeof(buf),
"\n Output Network Filename: %s",
636 snprintf(buf,
sizeof(buf),
"\n Output File Prefix: %s",
637 m_settings->outputFilePrefix().toStdString().c_str() );
640 snprintf(buf,
sizeof(buf),
"\n Network Id: %s",
643 snprintf(buf,
sizeof(buf),
"\n Network Description: %s",\
647 snprintf(buf,
sizeof(buf),
"\n Lidar Data Filename: %s",
651 snprintf(buf,
sizeof(buf),
"\n Target: %s",
654 snprintf(buf,
sizeof(buf),
"\n\n Linear Units: kilometers");
656 snprintf(buf,
sizeof(buf),
"\n Angular Units: decimal degrees");
658 snprintf(buf,
sizeof(buf),
"\n\nINPUT: SOLVE OPTIONS\n====================\n");
662 snprintf(buf,
sizeof(buf),
"\n OBSERVATIONS: ON"):
663 snprintf(buf,
sizeof(buf),
"\n OBSERVATIONS: OFF");
668 snprintf(buf,
sizeof(buf),
"\n RADIUS: ON"):
669 snprintf(buf,
sizeof(buf),
"\n RADIUS: OFF");
672 snprintf(buf,
sizeof(buf),
"\n RADIUS: N/A");
677 snprintf(buf,
sizeof(buf),
"\n TARGET BODY: ON"):
678 snprintf(buf,
sizeof(buf),
"\n TARGET BODY: OFF");
682 snprintf(buf,
sizeof(buf),
"\n UPDATE: YES"):
683 snprintf(buf,
sizeof(buf),
"\n UPDATE: NO");
687 snprintf(buf,
sizeof(buf),
"\n ERROR PROPAGATION: ON"):
688 snprintf(buf,
sizeof(buf),
"\n ERROR PROPAGATION: OFF");
692 snprintf(buf,
sizeof(buf),
"\n CONTROL POINT COORDINATE TYPE FOR REPORTS: LATITUDINAL"):
693 snprintf(buf,
sizeof(buf),
"\n CONTROL POINT COORDINATE TYPE FOR REPORTS: RECTANGULAR");
697 snprintf(buf,
sizeof(buf),
"\n CONTROL POINT COORDINATE TYPE FOR BUNDLE: LATITUDINAL"):
698 snprintf(buf,
sizeof(buf),
"\n CONTROL POINT COORDINATE TYPE FOR BUNDLE: RECTANGULAR");
702 snprintf(buf,
sizeof(buf),
"\n OUTLIER REJECTION: ON");
704 snprintf(buf,
sizeof(buf),
"\n REJECTION MULTIPLIER: %lf",
710 snprintf(buf,
sizeof(buf),
"\n OUTLIER REJECTION: OFF");
712 snprintf(buf,
sizeof(buf),
"\n REJECTION MULTIPLIER: N/A");
717 snprintf(buf,
sizeof(buf),
"\n CONTROL POINT COORDINATE TYPE FOR REPORTS: %s",
721 snprintf(buf,
sizeof(buf),
"\n CONTROL POINT COORDINATE TYPE FOR BUNDLE: %s",
724 snprintf(buf,
sizeof(buf),
"\n\nMAXIMUM LIKELIHOOD ESTIMATION\n============================\n");
727 for (
int tier = 0; tier < 3; tier++) {
728 if (tier < m_statisticsResults->numberMaximumLikelihoodModels()) {
729 snprintf(buf,
sizeof(buf),
"\n Tier %d Enabled: TRUE", tier);
731 snprintf(buf,
sizeof(buf),
"\n Maximum Likelihood Model: %s",
734 maximumLikelihoodModelWFunc(tier).model()).toLatin1().data());
736 snprintf(buf,
sizeof(buf),
"\n Quantile used for tweaking constant: %lf",
739 snprintf(buf,
sizeof(buf),
"\n Quantile weighted R^2 Residual value: %lf",
742 snprintf(buf,
sizeof(buf),
"\n Approx. weighted Residual cutoff: %s",
744 .weightedResidualCutoff().toLatin1().data());
746 if (tier != 2) fpOut <<
"\n";
749 snprintf(buf,
sizeof(buf),
"\n Tier %d Enabled: FALSE", tier);
754 snprintf(buf,
sizeof(buf),
"\n\nINPUT: CONVERGENCE CRITERIA\n===========================\n");
756 snprintf(buf,
sizeof(buf),
"\n SIGMA0: %e",
759 snprintf(buf,
sizeof(buf),
"\n MAXIMUM ITERATIONS: %d",
760 m_settings->convergenceCriteriaMaximumIterations());
774 snprintf(buf,
sizeof(buf),
"\n\nINPUT: CAMERA POINTING OPTIONS\n==============================\n");
776 switch (pointingSolveDegree) {
778 snprintf(buf,
sizeof(buf),
"\n CAMSOLVE: NONE");
781 snprintf(buf,
sizeof(buf),
"\n CAMSOLVE: ANGLES");
784 snprintf(buf,
sizeof(buf),
"\n CAMSOLVE: ANGLES, VELOCITIES");
787 snprintf(buf,
sizeof(buf),
"\n CAMSOLVE: ANGLES, VELOCITIES, ACCELERATIONS");
790 snprintf(buf,
sizeof(buf),
"\n CAMSOLVE: ALL POLYNOMIAL COEFFICIENTS (%d)"
792 "\n CKSOLVEDEGREE: %d",
800 snprintf(buf,
sizeof(buf),
"\n TWIST: ON"):
801 snprintf(buf,
sizeof(buf),
"\n TWIST: OFF");
804 snprintf(buf,
sizeof(buf),
"\n POLYNOMIAL OVER EXISTING POINTING: ON"):
805 snprintf(buf,
sizeof(buf),
"\nPOLYNOMIAL OVER EXISTING POINTING : OFF");
808 snprintf(buf,
sizeof(buf),
"\n\nINPUT: SPACECRAFT OPTIONS\n=========================\n");
810 switch (positionSolveDegree) {
812 snprintf(buf,
sizeof(buf),
"\n SPSOLVE: NONE");
815 snprintf(buf,
sizeof(buf),
"\n SPSOLVE: POSITION");
818 snprintf(buf,
sizeof(buf),
"\n SPSOLVE: POSITION, VELOCITIES");
821 snprintf(buf,
sizeof(buf),
"\n SPSOLVE: POSITION, VELOCITIES, ACCELERATIONS");
824 snprintf(buf,
sizeof(buf),
"\n SPSOLVE: ALL POLYNOMIAL COEFFICIENTS (%d)"
826 "\n SPKSOLVEDEGREE: %d",
834 snprintf(buf,
sizeof(buf),
"\n POLYNOMIAL OVER HERMITE SPLINE: ON"):
835 snprintf(buf,
sizeof(buf),
"\nPOLYNOMIAL OVER HERMITE SPLINE : OFF");
838 snprintf(buf,
sizeof(buf),
"\n\nINPUT: GLOBAL IMAGE PARAMETER UNCERTAINTIES\n===========================================\n");
842 switch (
m_settings->controlPointCoordTypeBundle()) {
844 coord1Str =
" POINT LATITUDE";
845 coord2Str =
" POINT LONGITUDE";
846 coord3Str =
" POINT RADIUS";
849 coord1Str =
" POINT X";
850 coord2Str =
" POINT Y";
851 coord3Str =
" POINT Z";
854 IString msg =
"Unknown surface point coordinate type enum ["
856 throw IException(IException::Programmer, msg, _FILEINFO_);
862 (
m_settings->globalPointCoord1AprioriSigma() == Isis::Null) ?
863 snprintf(buf,
sizeof(buf),
"\n%s SIGMA: N/A", coord1Str.toLatin1().data()):
864 snprintf(buf,
sizeof(buf),
"\n%s SIGMA: %lf (meters)", coord1Str.toLatin1().data(),
868 (
m_settings->globalPointCoord2AprioriSigma() == Isis::Null) ?
869 snprintf(buf,
sizeof(buf),
"\n%s SIGMA: N/A", coord2Str.toLatin1().data()):
870 snprintf(buf,
sizeof(buf),
"\n%s SIGMA: %lf (meters)", coord2Str.toLatin1().data(),
874 (
m_settings->globalPointCoord3AprioriSigma() == Isis::Null) ?
875 snprintf(buf,
sizeof(buf),
"\n%s SIGMA: N/A", coord3Str.toLatin1().data()):
876 snprintf(buf,
sizeof(buf),
"\n%s SIGMA: %lf (meters)", coord3Str.toLatin1().data(),
879 (positionSolveDegree < 1 || positionSigmas[0] == Isis::Null) ?
880 snprintf(buf,
sizeof(buf),
"\n SPACECRAFT POSITION SIGMA: N/A"):
881 snprintf(buf,
sizeof(buf),
"\n SPACECRAFT POSITION SIGMA: %lf (meters)",
885 (positionSolveDegree < 2 || positionSigmas[1] == Isis::Null) ?
886 snprintf(buf,
sizeof(buf),
"\n SPACECRAFT VELOCITY SIGMA: N/A"):
887 snprintf(buf,
sizeof(buf),
"\n SPACECRAFT VELOCITY SIGMA: %lf (m/s)",
891 (positionSolveDegree < 3 || positionSigmas[2] == Isis::Null) ?
892 snprintf(buf,
sizeof(buf),
"\n SPACECRAFT ACCELERATION SIGMA: N/A"):
893 snprintf(buf,
sizeof(buf),
"\n SPACECRAFT ACCELERATION SIGMA: %lf (m/s/s)",
897 (pointingSolveDegree < 1 || pointingSigmas[0] == Isis::Null) ?
898 snprintf(buf,
sizeof(buf),
"\n CAMERA ANGLES SIGMA: N/A"):
899 snprintf(buf,
sizeof(buf),
"\n CAMERA ANGLES SIGMA: %lf (dd)",
903 (pointingSolveDegree < 2 || pointingSigmas[1] == Isis::Null) ?
904 snprintf(buf,
sizeof(buf),
"\n CAMERA ANGULAR VELOCITY SIGMA: N/A"):
905 snprintf(buf,
sizeof(buf),
"\n CAMERA ANGULAR VELOCITY SIGMA: %lf (dd/s)",
909 (pointingSolveDegree < 3 || pointingSigmas[2] == Isis::Null) ?
910 snprintf(buf,
sizeof(buf),
"\n CAMERA ANGULAR ACCELERATION SIGMA: N/A"):
911 snprintf(buf,
sizeof(buf),
"\n CAMERA ANGULAR ACCELERATION SIGMA: %lf (dd/s/s)",
916 snprintf(buf,
sizeof(buf),
"\n\nINPUT: TARGET BODY OPTIONS\n==============================\n");
920 snprintf(buf,
sizeof(buf),
"\n POLE: RIGHT ASCENSION");
922 snprintf(buf,
sizeof(buf),
"\n : DECLINATION\n");
926 snprintf(buf,
sizeof(buf),
"\n POLE: RIGHT ASCENSION\n");
930 snprintf(buf,
sizeof(buf),
"\n POLE: DECLINATION\n");
936 snprintf(buf,
sizeof(buf),
"\n PRIME MERIDIAN: W0 (OFFSET)");
940 snprintf(buf,
sizeof(buf),
"\n : WDOT (SPIN RATE)");
944 snprintf(buf,
sizeof(buf),
"\n :W ACCELERATION");
951 snprintf(buf,
sizeof(buf),
"\n RADII: MEAN");
955 snprintf(buf,
sizeof(buf),
"\n RADII: TRIAXIAL");
961 snprintf(buf,
sizeof(buf),
"\n\nJIGSAW: RESULTS\n===============\n");
963 snprintf(buf,
sizeof(buf),
"\n Images: %6d",numImages);
965 snprintf(buf,
sizeof(buf),
"\n Points: %6d",numValidPoints);
968 if (numValidLidarPoints > 0) {
969 snprintf(buf,
sizeof(buf),
"\n Lidar Points: %6d",numValidLidarPoints);
973 snprintf(buf,
sizeof(buf),
"\n Total Measures: %6d",
978 snprintf(buf,
sizeof(buf),
"\n Total Observations: %6d",
983 snprintf(buf,
sizeof(buf),
"\n Good Observations: %6d",
987 snprintf(buf,
sizeof(buf),
"\n Rejected Observations: %6d",
992 snprintf(buf,
sizeof(buf),
"\n Constrained Point Parameters: %6d",
998 snprintf(buf,
sizeof(buf),
"\n Constrained Image Parameters: %6d",
1004 snprintf(buf,
sizeof(buf),
"\n Constrained Target Parameters: %6d",
1010 snprintf(buf,
sizeof(buf),
"\n Lidar Range Constraints: %6d",
1015 snprintf(buf,
sizeof(buf),
"\n Unknowns: %6d",
1019 if (numInnerConstraints > 0) {
1020 snprintf(buf,
sizeof(buf),
"\n Inner Constraints: %6d", numInnerConstraints);
1024 if (numDistanceConstraints > 0) {
1025 snprintf(buf,
sizeof(buf),
"\n Distance Constraints: %d", numDistanceConstraints);
1029 snprintf(buf,
sizeof(buf),
"\n Degrees of Freedom: %6d", numDegreesOfFreedom);
1032 snprintf(buf,
sizeof(buf),
"\n Convergence Criteria: %6.3g",
1036 if (convergenceCriteria == 1) {
1037 snprintf(buf,
sizeof(buf),
"(Sigma0)");
1045 snprintf(buf,
sizeof(buf),
"(Maximum reached)");
1051 snprintf(buf,
sizeof(buf),
" Error Propagation Elapsed Time: %6.4lf (seconds)\n",
1054 snprintf(buf,
sizeof(buf),
" Total Elapsed Time: %6.4lf (seconds)\n",
1060 snprintf(buf,
sizeof(buf),
"\n Residual Percentiles:\n");
1066 for (
int bin = 1;bin < 34;bin++) {
1067 double cumProb = double(bin) / 100.0;
1070 residualsCumulativeProbabilityDistribution().value(cumProb);
1073 residualsCumulativeProbabilityDistribution().value(cumProb + 0.33);
1076 residualsCumulativeProbabilityDistribution().value(cumProb + 0.66);
1077 snprintf(buf,
sizeof(buf),
" Percentile %3d: %+8.3lf"
1078 " Percentile %3d: %+8.3lf"
1079 " Percentile %3d: %+8.3lf\n",
1081 bin + 33, resValue33,
1082 bin + 66, resValue66);
1086 catch (IException &e) {
1087 QString msg =
"Failed to output residual percentiles for bundleout";
1088 throw IException(e, IException::Io, msg, _FILEINFO_);
1091 snprintf(buf,
sizeof(buf),
"\n Residual Box Plot:");
1093 snprintf(buf,
sizeof(buf),
"\n minimum: %+8.3lf",
1096 snprintf(buf,
sizeof(buf),
"\n Quartile 1: %+8.3lf",
1099 snprintf(buf,
sizeof(buf),
"\n Median: %+8.3lf",
1102 snprintf(buf,
sizeof(buf),
"\n Quartile 3: %+8.3lf",
1105 snprintf(buf,
sizeof(buf),
"\n maximum: %+8.3lf\n",
1109 catch (IException &e) {
1110 QString msg =
"Failed to output residual box plot for bundleout";
1111 throw IException(e, IException::Io, msg, _FILEINFO_);
1117 int filePadding = 0;
1119 for (
int i = 0; i < numObservations; i++) {
1123 for (
int j = 0; j < numImagesInObservation; j++) {
1126 if (bundleImage->fileName().length() > filePadding) {
1127 filePadding = bundleImage->fileName().length();
1132 snprintf(buf,
sizeof(buf),
"\nIMAGE MEASURES SUMMARY\n==========================\n\n");
1137 QString header(
"Measures RMS(pixels)");
1139 header +=
" Lidar RMS(pixels)";
1142 snprintf(buf,
sizeof(buf),
"%*s\n", header.length() + 11 + filePadding, header.toLatin1().data());
1145 QString dividers(
"*************************** *******************************************");
1147 dividers +=
" *******************************************";
1149 snprintf(buf,
sizeof(buf),
"%*s\n", dividers.length() + 1 + filePadding, dividers.toLatin1().data());
1152 QString fields(
"| Accepted | Total | | Samples | Lines | Total |");
1154 fields +=
" | Samples | Lines | Total |";
1156 snprintf(buf,
sizeof(buf),
"%*s\n", fields.length() + 1 + filePadding, fields.toLatin1().data());
1159 int numMeasures, numLidarMeasures;
1160 int numRejectedMeasures, numLidarRejectedMeasures;
1161 int numUsed, numLidarUsed;
1163 Statistics rmsSamplesTotal,rmsLinesTotal,rmsTotals;
1165 for (
int i = 0; i < numObservations; i++) {
1169 for (
int j = 0; j < numImagesInObservation; j++) {
1174 rmsImageSampleResiduals()[imageIndex].Rms();
1176 rmsImageLineResiduals()[imageIndex].Rms();
1178 rmsImageResiduals()[imageIndex].Rms();
1179 rmsSamplesTotal.
AddData(rmsSampleResiduals);
1180 rmsLinesTotal.
AddData(rmsLineResiduals);
1181 rmsTotals.
AddData(rmsLandSResiduals);
1184 (bundleImage->serialNumber());
1187 GetNumberOfJigsawRejectedMeasuresInImage(bundleImage->serialNumber());
1189 numUsed = numMeasures - numRejectedMeasures;
1191 QString filename = bundleImage->fileName();
1193 List = filename.split(
"/");
1195 snprintf(buf,
sizeof(buf),
"%-*s" ,filePadding + 1, bundleImage->fileName().toLatin1().data());
1198 snprintf(buf,
sizeof(buf),
" %12d %12d ", numUsed, numMeasures);
1201 snprintf(buf,
sizeof(buf),
"%13.4lf %13.4lf %13.4lf",
1202 rmsSampleResiduals,rmsLineResiduals,rmsLandSResiduals);
1208 rmsLidarImageSampleResiduals()[imageIndex].Rms();
1210 rmsLidarImageLineResiduals()[imageIndex].Rms();
1212 rmsLidarImageResiduals()[imageIndex].Rms();
1215 GetNumberOfValidMeasuresInImage(bundleImage->serialNumber());
1218 GetNumberOfJigsawRejectedMeasuresInImage(bundleImage->serialNumber());
1220 numLidarUsed = numLidarMeasures - numLidarRejectedMeasures;
1222 snprintf(buf,
sizeof(buf),
" %12d %12d ", numLidarUsed, numLidarMeasures);
1225 snprintf(buf,
sizeof(buf),
"%13.4lf %13.4lf %13.4lf",
1226 rmsLidarSampleResiduals,rmsLidarLineResiduals,rmsLidarLandSResiduals);
1231 snprintf(buf,
sizeof(buf),
" \n");
1239 snprintf(buf,
sizeof(buf),
"%*s", -(filePadding + 33),
"\nTotal RMS:");
1241 snprintf(buf,
sizeof(buf),
"%13.4lf %13.4lf %13.4lf\n",
1242 rmsSamplesTotal.
Rms(),rmsLinesTotal.
Rms(),rmsTotals.
Rms());
1268 bool errorProp =
false;
1276 if (instrumentIds.size() == 1) {
1277 QString ofname =
"bundleout_images.csv";
1278 ofname =
m_settings->outputFilePrefix() + ofname;
1279 m_csvSavedImagesFilename = ofname;
1280 outputCsvFileNames.push_back(ofname);
1284 for (
int i = 0; i < instrumentIds.size(); i++) {
1285 QString updatedInstrumentId = instrumentIds[i];
1289 updatedInstrumentId.replace(
"/",
"_").replace(
" ",
"_");
1290 QString ofname =
"bundleout_images_" + updatedInstrumentId +
".csv";
1291 ofname =
m_settings->outputFilePrefix() + ofname;
1292 m_csvSavedImagesFilename = ofname;
1293 outputCsvFileNames.push_back(ofname);
1297 for (
int i = 0; i < instrumentIds.size(); i++) {
1299 std::ofstream fpOut(outputCsvFileNames[i].toLatin1().data(), std::ios::out);
1307 int nObservations = observations.size();
1311 for (
int j = 0; j < nObservations; j++ ) {
1316 int observationIndex = observation->index();
1318 for (
int obsIndex = 0; obsIndex < observationIndex; obsIndex++) {
1326 int numImages = observation->size();
1328 for (
int k = 0; k < numImages; k++) {
1329 BundleImageQsp image = observation->at(k);
1331 snprintf(buf,
sizeof(buf),
"%s", image->fileName().toLatin1().data());
1333 snprintf(buf,
sizeof(buf),
",");
1336 fpOut <<
toString(rmsImageSampleResiduals[imgIndex].Rms()).toLatin1().data();
1337 snprintf(buf,
sizeof(buf),
",");
1340 fpOut <<
toString(rmsImageLineResiduals[imgIndex].Rms()).toLatin1().data();
1341 snprintf(buf,
sizeof(buf),
",");
1344 fpOut <<
toString(rmsImageResiduals[imgIndex].Rms()).toLatin1().data();
1345 snprintf(buf,
sizeof(buf),
",");
1348 QString observationString =
1349 observation->bundleOutputCSV(errorProp);
1352 if (observationString.right(1)==
",") {
1353 observationString.truncate(observationString.length()-1);
1356 fpOut << (
const char*) observationString.toLatin1().data();
1358 snprintf(buf,
sizeof(buf),
"\n");
1378 QString ofname =
"bundleout.txt";
1379 ofname =
m_settings->outputFilePrefix() + ofname;
1381 std::ofstream fpOut(ofname.toLatin1().data(), std::ios::out);
1386 m_txtBundleOutputFilename = ofname;
1395 bool berrorProp =
false;
1402 snprintf(buf,
sizeof(buf),
"\nTARGET BODY\n==========================\n");
1405 snprintf(buf,
sizeof(buf),
"\n Target Initial Total "
1406 "Final Initial Final\n"
1407 "Parameter Value Correction "
1408 "Value Accuracy Accuracy\n");
1411 QString targetString =
1412 m_settings->bundleTargetBody()->formatBundleOutputString(berrorProp);
1413 fpOut << (
const char*)targetString.toLatin1().data();
1417 snprintf(buf,
sizeof(buf),
"\nIMAGE EXTERIOR ORIENTATION\n==========================\n");
1423 imagesAndParameters.insert(
"target",
m_settings->bundleTargetBody()->parameterList() );
1426 for (
int i = 0; i < nObservations; i++) {
1433 int numImages = observation->size();
1434 for (
int j = 0; j < numImages; j++) {
1435 BundleImageQsp image = observation->at(j);
1436 snprintf(buf,
sizeof(buf),
"\nImage Full File Name: %s\n", image->fileName().toLatin1().data());
1438 snprintf(buf,
sizeof(buf),
"\nImage Serial Number: %s\n", image->serialNumber().toLatin1().data());
1441 snprintf(buf,
sizeof(buf),
"Image Initial Total Final Accuracy\n");
1443 snprintf(buf,
sizeof(buf),
"Parameter Value Correction Value Initial Final Units\n");
1446 snprintf(buf,
sizeof(buf),
" "
1447 "***************************************\n");
1450 observation->bundleOutputString(fpOut,berrorProp);
1452 foreach ( QString image, observation->imageNames() ) {
1453 imagesAndParameters.insert( image, observation->parameterList() );
1466 snprintf(buf,
sizeof(buf),
"\n\n\nPOINTS UNCERTAINTY SUMMARY\n==========================\n\n");
1472 snprintf(buf,
sizeof(buf),
"RMS Sigma %s(m)%20.8lf\n", coordName.toLatin1().data(),
1475 snprintf(buf,
sizeof(buf),
"MIN Sigma %s(m)%20.8lf at %s\n", coordName.toLatin1().data(),
1479 snprintf(buf,
sizeof(buf),
"MAX Sigma %s(m)%20.8lf at %s\n\n", coordName.toLatin1().data(),
1487 snprintf(buf,
sizeof(buf),
"RMS Sigma %s(m)%20.8lf\n", coordName.toLatin1().data(),
1490 snprintf(buf,
sizeof(buf),
"MIN Sigma %s(m)%20.8lf at %s\n", coordName.toLatin1().data(),
1494 snprintf(buf,
sizeof(buf),
"MAX Sigma %s(m)%20.8lf at %s\n\n", coordName.toLatin1().data(),
1501 SurfacePoint::Three);
1506 snprintf(buf,
sizeof(buf),
" RMS Sigma Radius(m) N/A\n");
1508 snprintf(buf,
sizeof(buf),
" MIN Sigma Radius(m) N/A\n");
1510 snprintf(buf,
sizeof(buf),
" MAX Sigma Radius(m) N/A\n");
1514 snprintf(buf,
sizeof(buf),
"RMS Sigma %s(m)%20.8lf\n", coordName.toLatin1().data(),
1517 snprintf(buf,
sizeof(buf),
"MIN Sigma %s(m)%20.8lf at %s\n", coordName.toLatin1().data(),
1521 snprintf(buf,
sizeof(buf),
"MAX Sigma %s(m)%20.8lf at %s\n", coordName.toLatin1().data(),
1530 snprintf(buf,
sizeof(buf),
"\n\nPOINTS SUMMARY\n==============\n%103s"
1531 "Sigma Sigma Sigma\n"
1532 " Label Status Rays RMS"
1533 " Latitude Longitude Radius"
1534 " Latitude Longitude Radius\n",
"");
1537 snprintf(buf,
sizeof(buf),
"\n\nPOINTS SUMMARY\n==============\n%103s"
1538 "Sigma Sigma Sigma\n"
1539 " Label Status Rays RMS"
1540 " Point X Point Y Point Z"
1541 " Point X Point Y Point Z\n",
"");
1546 for (
int i = 0; i < nPoints; i++) {
1549 QString pointSummaryString =
1550 bundleControlPoint->formatBundleOutputSummaryString(berrorProp);
1551 fpOut << (
const char*)pointSummaryString.toLatin1().data();
1555 for (
int i = 0; i < nLidarPoints; i++) {
1559 QString pointSummaryString =
1560 lidarControlPoint->formatBundleOutputSummaryString(berrorProp);
1561 fpOut << (
const char*)pointSummaryString.toLatin1().data();
1565 snprintf(buf,
sizeof(buf),
"\n\nPOINTS DETAIL\n=============\n\n");
1568 bool solveRadius =
m_settings->solveRadius();
1570 for (
int i = 0; i < nPoints; i++) {
1574 QString pointDetailString =
1575 bundleControlPoint->formatBundleOutputDetailString(berrorProp, solveRadius);
1576 fpOut << (
const char*)pointDetailString.toLatin1().data();
1579 for (
int i = 0; i < nLidarPoints; i++) {
1583 QString pointDetailString =
1584 bundleLidarControlPoint->formatBundleOutputDetailString(berrorProp, solveRadius);
1585 fpOut << (
const char*)pointDetailString.toLatin1().data();
1602 QString ofname =
"bundleout_points.csv";
1603 ofname =
m_settings->outputFilePrefix() + ofname;
1604 m_csvSavedPointsFilename = ofname;
1606 std::ofstream fpOut(ofname.toLatin1().data(), std::ios::out);
1613 double dLat, dLon, dRadius;
1616 double cor_lat_dd = 0.0;
1617 double cor_lon_dd = 0.0;
1618 double cor_rad_km = 0.0;
1620 double cor_lat_m = 0.0;
1621 double cor_lon_m = 0.0;
1622 double cor_rad_m = 0.0;
1624 double cor_x_km = 0.0;
1625 double cor_y_km = 0.0;
1626 double cor_z_km = 0.0;
1628 double latInit = Isis::Null;
1629 double lonInit = Isis::Null;
1630 double radInit = Isis::Null;
1632 int numMeasures, numRejectedMeasures;
1633 double dResidualRms;
1636 bool bundleLatLonRadius =
true;
1638 bundleLatLonRadius =
false;
1643 snprintf(buf,
sizeof(buf),
",,,,,3-d,3-d,3-d,Sigma,Sigma,Sigma,Correction,Correction,Correction,"
1644 "Coordinate,Coordinate,Coordinate,Sigma,Sigma,Sigma\n"
1645 "Point,Point,Accepted,Rejected,Residual,Latitude,Longitude,Radius,Latitude,Longitude,"
1646 "Radius,Latitude,Longitude,Radius,X,Y,Z,X,Y,Z\n"
1647 "Label,Status,Measures,Measures,RMS,(dd),(dd),(km),(m),(m),(m),(m),(m),(m),(km),(km),(km),"
1651 snprintf(buf,
sizeof(buf),
",,,,,3-d,3-d,3-d,Correction,Correction,Correction,Coordinate,"
1652 "Coordinate,Coordinate\n"
1653 "Point,Point,Accepted,Rejected,Residual,Latitude,Longitude,Radius,Latitude,Longitude,"
1655 "Label,Status,Measures,Measures,RMS,(dd),(dd),(km),(m),(m),(m),(km),(km),(km)\n");
1659 for (
int i = 0; i < numPoints; i++) {
1662 if (!bundlecontrolpoint) {
1666 if (bundlecontrolpoint->isRejected()) {
1670 dLat = bundlecontrolpoint->adjustedSurfacePoint().GetLatitude().degrees();
1671 dLon = bundlecontrolpoint->adjustedSurfacePoint().GetLongitude().degrees();
1672 dRadius = bundlecontrolpoint->adjustedSurfacePoint().GetLocalRadius().kilometers();
1673 dX = bundlecontrolpoint->adjustedSurfacePoint().GetX().kilometers();
1674 dY = bundlecontrolpoint->adjustedSurfacePoint().GetY().kilometers();
1675 dZ = bundlecontrolpoint->adjustedSurfacePoint().GetZ().kilometers();
1676 numMeasures = bundlecontrolpoint->numberOfMeasures();
1677 numRejectedMeasures = bundlecontrolpoint->numberOfRejectedMeasures();
1678 dResidualRms = bundlecontrolpoint->residualRms();
1682 double rtm = dRadius * 1000.;
1687 boost::numeric::ublas::bounded_vector< double, 3 > corrections = bundlecontrolpoint->
1692 if (bundleLatLonRadius ==
false) {
1693 cor_x_km = corrections(0);
1694 cor_y_km = corrections(1);
1695 cor_z_km = corrections(2);
1697 if (!IsSpecial(dX) && !IsSpecial(dY) && !IsSpecial(dZ)) {
1706 cor_lat_dd = (dLat - latInit);
1707 cor_lon_dd = (dLon - lonInit);
1708 cor_rad_km = dRadius - radInit;
1710 cor_lat_m = cor_lat_dd * DEG2RAD * rtm;
1711 cor_lon_m = cor_lon_dd * DEG2RAD * rtm * cos(dLat*DEG2RAD);
1712 cor_rad_m = cor_rad_km * 1000.;
1716 else if (bundleLatLonRadius ==
true) {
1717 cor_lat_dd = corrections(0) * RAD2DEG;
1718 cor_lon_dd = corrections(1) * RAD2DEG;
1719 cor_rad_m = corrections(2) * 1000.0;
1721 cor_lat_m = bundlecontrolpoint->adjustedSurfacePoint().LatitudeToMeters(corrections(0));
1722 cor_lon_m = bundlecontrolpoint->adjustedSurfacePoint().LongitudeToMeters(corrections(1));
1723 cor_rad_km = corrections(2);
1725 if (!IsSpecial(dLat) && !IsSpecial(dLon) && !IsSpecial(dRadius)) {
1737 strStatus =
"FIXED";
1740 strStatus =
"CONSTRAINED";
1746 strStatus =
"UNKNOWN";
1750 double dSigmaLat, dSigmaLong, dSigmaRadius;
1751 double dSigmaX, dSigmaY, dSigmaZ;
1753 dSigmaLat = bundlecontrolpoint->adjustedSurfacePoint().GetLatSigmaDistance().meters();
1754 dSigmaLong = bundlecontrolpoint->adjustedSurfacePoint().GetLonSigmaDistance().meters();
1755 dSigmaRadius = bundlecontrolpoint->adjustedSurfacePoint().GetLocalRadiusSigma().meters();
1757 dSigmaX = bundlecontrolpoint->adjustedSurfacePoint().GetXSigma().meters();
1758 dSigmaY = bundlecontrolpoint->adjustedSurfacePoint().GetYSigma().meters();
1759 dSigmaZ = bundlecontrolpoint->adjustedSurfacePoint().GetZSigma().meters();
1761 snprintf(buf,
sizeof(buf),
"%s,%s,%d,%d,%6.2lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,"
1762 "%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,"
1764 bundlecontrolpoint->id().toLatin1().data(), strStatus.toLatin1().data(),
1765 numMeasures, numRejectedMeasures, dResidualRms, dLat, dLon, dRadius, dSigmaLat,
1766 dSigmaLong, dSigmaRadius, cor_lat_m, cor_lon_m, cor_rad_m, dX, dY, dZ,
1767 dSigmaX,dSigmaY,dSigmaZ);
1770 snprintf(buf,
sizeof(buf),
"%s,%s,%d,%d,%6.2lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,"
1771 "%16.8lf,%16.8lf,%16.8lf\n",
1772 bundlecontrolpoint->id().toLatin1().data(), strStatus.toLatin1().data(),
1773 numMeasures, numRejectedMeasures, dResidualRms, dLat, dLon, dRadius, cor_lat_m,
1774 cor_lon_m, cor_rad_m, dX, dY, dZ);
1793 QString ofname =
"bundleout_lidar.csv";
1794 ofname =
m_settings->outputFilePrefix() + ofname;
1795 m_csvSavedPointsFilename = ofname;
1797 std::ofstream fpOut(ofname.toLatin1().data(), std::ios::out);
1810 snprintf(buf,
sizeof(buf),
",,measured,a priori,adjusted,adjusted\n"
1811 "point,image,range,sigma,range,sigma,residual\n"
1812 "id,name,(km),(km),(km),(km),(km)\n");
1815 snprintf(buf,
sizeof(buf),
",,measured,a priori,adjusted\n"
1816 "point,image,range,sigma,range,residual\n"
1817 "id,name,(km),(km),(km),(km)\n");
1821 for (
int i = 0; i < numPoints; i++) {
1824 if (!point || point->isRejected()) {
1828 int nRangeConstraints = point->numberRangeConstraints();
1829 for (
int j = 0; j < nRangeConstraints; j++) {
1832 QString str = rangeConstraint->formatBundleOutputString(
m_settings->errorPropagation());
1851 QString ofname =
"residuals.csv";
1852 ofname =
m_settings->outputFilePrefix() + ofname;
1853 m_csvSavedResidualsFilename = ofname;
1855 std::ofstream fpOut(ofname.toLatin1().data(), std::ios::out);
1862 snprintf(buf,
sizeof(buf),
",,,x image,y image,Measured,Measured,sample,line,Residual Vector\n");
1864 snprintf(buf,
sizeof(buf),
"Point,Image,Image,coordinate,coordinate,"
1865 "Sample,Line,residual,residual,Magnitude\n");
1867 snprintf(buf,
sizeof(buf),
"Label,Filename,Serial Number,(mm),(mm),"
1868 "(pixels),(pixels),(pixels),(pixels),(pixels),Rejected\n");
1874 int numMeasures = 0;
1879 for (
int i = 0; i < numPoints; i++) {
1881 numMeasures = bundleControlPoint->size();
1883 if (bundleControlPoint->rawControlPoint()->IsIgnored()) {
1887 for (
int j = 0; j < numMeasures; j++) {
1888 bundleMeasure = bundleControlPoint->at(j);
1890 Camera *measureCamera = bundleMeasure->camera();
1891 if (!measureCamera) {
1895 if (bundleMeasure->isRejected()) {
1896 snprintf(buf,
sizeof(buf),
"%s,%s,%s,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,*\n",
1897 bundleControlPoint->id().toLatin1().data(),
1898 bundleMeasure->parentBundleImage()->fileName().toLatin1().data(),
1899 bundleMeasure->cubeSerialNumber().toLatin1().data(),
1900 bundleMeasure->focalPlaneMeasuredX(),
1901 bundleMeasure->focalPlaneMeasuredY(),
1902 bundleMeasure->sample(),
1903 bundleMeasure->line(),
1904 bundleMeasure->sampleResidual(),
1905 bundleMeasure->lineResidual(),
1906 bundleMeasure->residualMagnitude());
1909 snprintf(buf,
sizeof(buf),
"%s,%s,%s,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf\n",
1910 bundleControlPoint->id().toLatin1().data(),
1911 bundleMeasure->parentBundleImage()->fileName().toLatin1().data(),
1912 bundleMeasure->cubeSerialNumber().toLatin1().data(),
1913 bundleMeasure->focalPlaneMeasuredX(),
1914 bundleMeasure->focalPlaneMeasuredY(),
1915 bundleMeasure->sample(),
1916 bundleMeasure->line(),
1917 bundleMeasure->sampleResidual(),
1918 bundleMeasure->lineResidual(),
1919 bundleMeasure->residualMagnitude());
1930 for (
int i = 0; i < numPoints; i++) {
1932 numMeasures = bundleLidarPoint->size();
1934 if (bundleLidarPoint->rawControlPoint()->IsIgnored()) {
1938 for (
int j = 0; j < numMeasures; j++) {
1939 bundleMeasure = bundleLidarPoint->at(j);
1941 Camera *measureCamera = bundleMeasure->camera();
1942 if (!measureCamera) {
1946 if (bundleMeasure->isRejected()) {
1947 snprintf(buf,
sizeof(buf),
"%s,%s,%s,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,*\n",
1948 bundleLidarPoint->id().toLatin1().data(),
1949 bundleMeasure->parentBundleImage()->fileName().toLatin1().data(),
1950 bundleMeasure->cubeSerialNumber().toLatin1().data(),
1951 bundleMeasure->focalPlaneMeasuredX(),
1952 bundleMeasure->focalPlaneMeasuredY(),
1953 bundleMeasure->sample(),
1954 bundleMeasure->line(),
1955 bundleMeasure->sampleResidual(),
1956 bundleMeasure->lineResidual(),
1957 bundleMeasure->residualMagnitude());
1960 snprintf(buf,
sizeof(buf),
"%s,%s,%s,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf\n",
1961 bundleLidarPoint->id().toLatin1().data(),
1962 bundleMeasure->parentBundleImage()->fileName().toLatin1().data(),
1963 bundleMeasure->cubeSerialNumber().toLatin1().data(),
1964 bundleMeasure->focalPlaneMeasuredX(),
1965 bundleMeasure->focalPlaneMeasuredY(),
1966 bundleMeasure->sample(),
1967 bundleMeasure->line(),
1968 bundleMeasure->sampleResidual(),
1969 bundleMeasure->lineResidual(),
1970 bundleMeasure->residualMagnitude());
1999 FileName newProjectRoot)
const {
2002 QString relativePath;
2003 QString relativeBundlePath;
2004 FileName bundleSolutionInfoRoot;
2012 if (oldPath != newPath) {
2014 QDir bundleDir(newPath);
2015 if (!bundleDir.mkpath(bundleDir.path())) {
2016 throw IException(IException::Io,
2017 QString(
"Failed to create directory [%1]")
2018 .arg(bundleSolutionInfoRoot.path()),
2021 QString oldFile = oldPath +
"/" + FileName(
m_outputControl->fileName()).name();
2022 QString newFile = newPath +
"/" + FileName(
m_outputControl->fileName()).name();
2023 if (!QFile::copy(oldFile, newFile)) {
2024 throw IException(IException::Io,
2025 QString(
"Failed to copy file [%1] to new file [%2]")
2029 newFile = newPath +
"/" + FileName(m_txtBundleOutputFilename).name();
2030 if (!QFile::copy(m_txtBundleOutputFilename, newFile)) {
2031 throw IException(IException::Io,
2032 QString(
"Failed to copy file [%1] to new file [%2]")
2033 .arg(m_txtBundleOutputFilename).arg(newFile),
2036 newFile = newPath +
"/" + FileName(m_csvSavedImagesFilename).name();
2037 if (!QFile::copy(m_csvSavedImagesFilename, newFile)) {
2038 throw IException(IException::Io,
2039 QString(
"Failed to copy file [%1] to new file [%2]")
2040 .arg(m_csvSavedImagesFilename).arg(newFile),
2043 newFile = newPath +
"/" + FileName(m_csvSavedPointsFilename).name();
2044 if (!QFile::copy(m_csvSavedPointsFilename, newFile)) {
2045 throw IException(IException::Io,
2046 QString(
"Failed to copy file [%1] to new file [%2]")
2047 .arg(m_csvSavedPointsFilename).arg(newFile),
2050 newFile = newPath +
"/" + FileName(m_csvSavedResidualsFilename).name();
2051 if (!QFile::copy(m_csvSavedResidualsFilename, newFile)) {
2052 throw IException(IException::Io,
2053 QString(
"Failed to copy file [%1] to new file [%2]")
2054 .arg(m_csvSavedResidualsFilename).arg(newFile),
2062 if (relativePath.startsWith(
"/")) {
2063 relativePath.remove(0,1);
2069 if (relativeBundlePath.startsWith(
"/")) {
2070 relativeBundlePath.remove(0,1);
2072 relativeBundlePath +=
"/";
2075 stream.writeStartElement(
"bundleSolutionInfo");
2077 stream.writeStartElement(
"generalAttributes");
2078 stream.writeTextElement(
"id",
m_id->toString());
2079 stream.writeTextElement(
"name",
m_name);
2080 stream.writeTextElement(
"runTime",
runTime());
2082 stream.writeTextElement(
"inputFileName",
2084 stream.writeTextElement(
"bundleOutTXT",
2085 relativeBundlePath + FileName(m_txtBundleOutputFilename).
name());
2086 stream.writeTextElement(
"imagesCSV",
2087 relativeBundlePath + FileName(m_csvSavedImagesFilename).
name());
2088 stream.writeTextElement(
"pointsCSV",
2089 relativeBundlePath + FileName(m_csvSavedPointsFilename).
name());
2090 stream.writeTextElement(
"residualsCSV",
2091 relativeBundlePath + FileName(m_csvSavedResidualsFilename).
name());
2092 stream.writeEndElement();
2103 stream.writeStartElement(
"imageLists");
2107 stream.writeEndElement();
2111 stream.writeStartElement(
"outputControl");
2113 stream.writeEndElement();
2116 stream.writeEndElement();
2129 SurfacePoint::CoordIndex coordIdx)
const {
2131 switch (
m_settings->controlPointCoordTypeReports()) {
2134 case SurfacePoint::One:
2135 coordName =
" Latitude";
2137 case SurfacePoint::Two:
2138 coordName =
"Longitude";
2140 case SurfacePoint::Three:
2141 coordName =
" Radius";
2144 IString msg =
"Unknown surface point index enum ["
2146 throw IException(IException::Programmer, msg, _FILEINFO_);
2152 case SurfacePoint::One:
2153 coordName =
"POINT X";
2155 case SurfacePoint::Two:
2156 coordName =
"POINT Y";
2158 case SurfacePoint::Three:
2159 coordName =
"POINT Z";
2162 IString msg =
"Unknown surface point index enum ["
2164 throw IException(IException::Programmer, msg, _FILEINFO_);
2169 IString msg =
"Unknown surface point coordinate type enum ["
2171 throw IException(IException::Programmer, msg, _FILEINFO_);
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 is used to modify and manage solve settings for 1 to many BundleObservations.
bool solveTwist() const
Accesses the flag for solving for twist.
bool solvePolyOverPointing() const
Whether or not the solve polynomial will be fit over the existing pointing polynomial.
int numberCameraPositionCoefficientsSolved() const
Accesses the number of camera position coefficients in the solution.
int ckDegree() const
Accesses the degree of polynomial fit to original camera angles (ckDegree).
QList< double > aprioriPositionSigmas() const
Accesses the a priori position sigmas.
QList< double > aprioriPointingSigmas() const
Accesses the a priori pointing sigmas.
int ckSolveDegree() const
Accesses the degree of the camera angles polynomial being fit to in the bundle adjustment (ckSolveDeg...
bool solvePositionOverHermite() const
Whether or not the polynomial for solving will be fit over an existing Hermite spline.
int numberCameraAngleCoefficientsSolved() const
Accesses the number of camera angle coefficients in the solution.
int spkSolveDegree() const
Accesses the degree of thecamera position polynomial being fit to in the bundle adjustment (spkSolveD...
int spkDegree() const
Accesses the degree of the polynomial fit to the original camera position (spkDegree).
A container class for statistical results from a BundleAdjust solution.
bool outputResiduals()
Outputs image coordinate residuals to a csv file.
bool outputImagesCSV()
Outputs the bundleout_images.csv file which contains Jigsaw data about the images within each observa...
BundleSettingsQsp m_settings
Bundle settings.
QString inputControlNetFileName() const
Returns the name of the input control network.
QString m_runTime
Run time of the bundle adjustment.
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Saves the BundleSolutionInfo to the project.
QString inputLidarDataFileName() const
Returns name of input lidar data file (if any).
void addAdjustedImages(ImageList *images)
Adds a list of images that were adjusted (their labels were updated).
QString savedPointsFilename()
Returns filename of output bundle points csv file.
QUuid * m_id
A unique ID for this BundleSolutionInfo object (useful for others to reference this object when savin...
BundleSettingsQsp bundleSettings()
Returns bundle settings.
void setName(QString name)
Sets the name of the bundle.
QList< ImageList * > * m_adjustedImages
Adjusted image list.
FileName * m_inputControlNetFileName
Input control network file name.
QString m_xmlHandlerCharacters
List of characters that have been handled.
void setOutputControl(Control *outputControl)
Returns the name of the output control network.
BundleSolutionInfo(BundleSettingsQsp inputSettings, FileName controlNetworkFileName, BundleResults outputStatistics, QList< ImageList * > imgList, QObject *parent=0)
Constructor.
QList< ImageList * > adjustedImages() const
Returns the list of images that were adjusted after a bundle.
QList< ImageList * > * m_images
Input image list.
FileName * m_inputLidarDataFileName
Input lidar data file name.
QString surfacePointCoordName(SurfacePoint::CoordinateType type, SurfacePoint::CoordIndex coordInx) const
Determine the control point coordinate name.
QString savedResidualsFilename()
Returns filename of output bundle residuals csv file.
void setOutputControlName(QString name)
Sets m_outputControlName.
BundleResults bundleResults()
Returns the bundle results.
QString id() const
Get a unique, identifying string associated with this BundleSolutionInfo object.
void setRunTime(QString runTime)
Sets the run time, and the name if a name is not already set.
bool outputPointsCSV()
Outputs point data to a csv file.
QString outputControlName() const
Returns m_outputControlName.
void updateFileName(Project *)
TODO: change description below to something more like english.
QString outputControlNetFileName() const
Returns the name of the output control network.
BundleResults * m_statisticsResults
Bundle statistical results.
~BundleSolutionInfo()
Destructor.
QString runTime() const
Returns the run time.
bool outputHeader(std::ofstream &fpOut)
Output header for bundle results file.
LidarData * m_outputLidarDataSet
QList of adjusted lidar points.
QString name() const
Returns the name of the bundle.
QString savedBundleOutputFilename()
Returns bundleout text filename.
bool outputText()
Outputs a text file with the results of the BundleAdjust.
Control * m_outputControl
Output control.
QString savedImagesFilename()
Returns filename of output bundle images csv file.
QList< ImageList * > imageList()
Returns the images used in the bundle.
void setOutputStatistics(BundleResults statisticsResults)
Sets the stat results.
QString m_name
Name of the bundle. Defaults to the id.
bool outputImagesCSVHeader(std::ofstream &fpOut, BundleObservationQsp observations)
Outputs the header for the bundleout_images.csv file.
Control * control() const
Returns bundle output Control object.
bool outputLidarCSV()
Outputs lidar data to a csv file.
This represents an ISIS control net in a project-based GUI interface.
@ 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.
Displacement is a signed length, usually in meters.
@ Kilometers
The distance is being specified in kilometers.
Distance measurement, usually in meters.
double kilometers() const
Get the distance in kilometers.
@ Kilometers
The distance is being specified in kilometers.
Internalizes a list of images and allows for operations on the entire list.
This class is designed to encapsulate the concept of a Latitude.
This class is designed to encapsulate the concept of a Longitude.
static QString modelToString(Model model)
Static method to return a string represtentation for a given MaximumLikelihoodWFunctions::Model enum.
The main project for ipce.
static QString cnetRoot(QString projectRoot)
Appends the root directory name 'cnets' to the project.
static QString bundleSolutionInfoRoot(QString projectRoot)
Appends the root directory name 'bundle' to the project results directory.
QString newProjectRoot() const
Get the top-level folder of the new project.
QString projectRoot() const
Get the top-level folder of the project.
This class is used to accumulate statistics on double arrays.
void AddData(const double *data, const unsigned int count)
Add an array of doubles to the accumulators and counters.
double Rms() const
Computes and returns the rms.
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.
static QString coordinateTypeToString(CoordinateType type)
Converts the given SurfacePoint::CoordinateType enumeration to a string.
Latitude GetLatitude() const
Return the body-fixed latitude for the surface point.
Longitude GetLongitude() const
Return the body-fixed longitude for the surface point.
Distance GetLocalRadius() const
Return the radius of the surface point.
static QString CurrentLocalTime()
Returns the current local time This time is taken directly from the system clock, so if the system cl...
This is free and unencumbered software released into the public domain.
This is free and unencumbered software released into the public domain.
This is free and unencumbered software released into the public domain.
QSharedPointer< LidarData > LidarDataQsp
Definition for a shared pointer to a LidarData object.
QSharedPointer< BundleLidarControlPoint > BundleLidarControlPointQsp
QSharedPointer to a BundleLidarControlPoint.
QSharedPointer< BundleSettings > BundleSettingsQsp
Definition for a BundleSettingsQsp, a shared pointer to a BundleSettings object.
QSharedPointer< BundleLidarRangeConstraint > BundleLidarRangeConstraintQsp
Typdef for BundleLidarRangeConstraint QSharedPointer.
QSharedPointer< BundleObservation > BundleObservationQsp
Typdef for BundleObservation QSharedPointer.
QString toString(const LinearAlgebra::Vector &vector, int precision)
A global function to format LinearAlgebra::Vector as a QString with the given precision.
QSharedPointer< BundleControlPoint > BundleControlPointQsp
Definition for BundleControlPointQSP, a shared pointer to a BundleControlPoint.
QSharedPointer< BundleMeasure > BundleMeasureQsp
Definition for BundleMeasureQsp, a shared pointer to a BundleMeasure.