Isis 3 Programmer Reference
BundleSolutionInfo.cpp
1 
7 /* SPDX-License-Identifier: CC0-1.0 */
8 
9 #include "BundleSolutionInfo.h"
10 
11 #include <QDataStream>
12 #include <QDebug>
13 #include <QFile>
14 #include <QList>
15 #include <QString>
16 #include <QStringList>
17 #include <QUuid>
18 #include <QXmlStreamWriter>
19 
20 #include "BundleResults.h"
21 #include "Control.h"
22 #include "ControlList.h"
23 #include "ControlMeasure.h"
24 #include "ControlNet.h"
25 #include "ControlPoint.h"
26 #include "FileName.h"
27 #include "ImageList.h"
28 #include "IString.h"
29 #include "iTime.h"
30 #include "Project.h"
31 #include "PvlKeyword.h"
32 #include "PvlObject.h"
33 #include "StatCumProbDistDynCalc.h"
34 #include "Statistics.h"
35 #include "XmlStackedHandlerReader.h"
36 
37 namespace Isis {
38 
47  BundleSolutionInfo::BundleSolutionInfo(BundleSettingsQsp inputSettings,
48  FileName controlNetworkFileName,
49  BundleResults outputStatistics,
50  QList<ImageList *> imgList,
51  QObject *parent) : QObject(parent) {
52  m_id = new QUuid(QUuid::createUuid());
53  m_runTime = "";
54  m_name = m_runTime;
55  m_inputControlNetFileName = new FileName(controlNetworkFileName);
56  m_outputControl = NULL;
57  m_outputControlName="";
58  m_settings = inputSettings;
59  m_statisticsResults = new BundleResults(outputStatistics);
60  m_images = new QList<ImageList *>(imgList);
62  }
63 
64 
72  BundleSolutionInfo::BundleSolutionInfo(Project *project,
73  XmlStackedHandlerReader *xmlReader,
74  QObject *parent) : QObject(parent) {
75  //TODO does xml stuff need project???
76  m_id = new QUuid(QUuid::createUuid());
77  m_runTime = "";
78  m_name = m_runTime;
80  m_outputControl = NULL;
81  m_outputControlName="";
82  m_statisticsResults = NULL;
83  // what about the rest of the member data ? should we set defaults ??? CREATE INITIALIZE METHOD
86 
87  xmlReader->setErrorHandler(new XmlHandler(this, project));
88  xmlReader->pushContentHandler(new XmlHandler(this, project));
89  }
90 
91 
96  delete m_id;
97 
100 
101  delete m_outputControl;
102  m_outputControl = NULL;
103 
104  delete m_statisticsResults;
105  m_statisticsResults = NULL;
106 
107  if (m_images != NULL) {
108  delete m_images;
109  m_images = NULL;
110  }
111 
112  // if (m_adjustedImages != NULL) {
113  // qDeleteAll(*m_adjustedImages);
114  // m_adjustedImages->clear();
115  // delete m_adjustedImages;
116  // m_adjustedImages = NULL;
117  // }
118  }
119 
120 
127  return m_txtBundleOutputFilename;
128  }
129 
130 
137  return m_csvSavedImagesFilename;
138  }
139 
140 
147  return m_csvSavedPointsFilename;
148  }
149 
150 
157  return m_csvSavedResidualsFilename;
158  }
159 
160 
167  m_adjustedImages->append(images);
168  }
169 
170 
177  delete m_statisticsResults;
178  m_statisticsResults = NULL;
179  m_statisticsResults = new BundleResults(statisticsResults);
180  }
181 
182 
196 
197  //TODO do we need to close anything here?
198 
199  FileName oldInputFileName(*m_inputControlNetFileName);
200  FileName newInputFileName(project->cnetRoot() + "/" +
201  oldInputFileName.dir().dirName() + "/" + oldInputFileName.name());
202  *m_inputControlNetFileName = newInputFileName.expanded();
203 
204  FileName oldOutputFileName(m_outputControl->fileName());
205  FileName newOutputFileName(project->cnetRoot() + "/" +
206  oldOutputFileName.dir().dirName() + "/" + oldOutputFileName.name());
207 
208  if (m_outputControl) {
209  delete m_outputControl;
210  }
211  m_outputControl = new Control(newOutputFileName.expanded());
212  m_outputControlName = newOutputFileName.expanded();
213  }
214 
215 
223  return *m_adjustedImages;
224  }
225 
226 
232  QString BundleSolutionInfo::id() const {
233  return m_id->toString().remove(QRegExp("[{}]"));
234  }
235 
236 
242  void BundleSolutionInfo::setRunTime(QString runTime) {
243  // ??? validate that a valid time has been given???
244  // try {
245  // iTime time(runTime);
246  // }
247  // catch (...) {
248  // throw IException(IException::Unknown,
249  // "Invalid bundle adjustment run time [" + runTime + ].",
250  // _FILEINFO_);
251  // }
252  m_runTime = runTime;
253  if (m_name == m_runTime || m_name == "") {
254  m_name = runTime;
255  }
256  }
257 
258 
264  QString BundleSolutionInfo::runTime() const {
265  return m_runTime;
266  }
267 
268 
276  }
277 
278 
285 
286  if (m_outputControl)
287  return m_outputControl->fileName();
288  else
289  return m_outputControlName;
290  }
291 
292 
299  m_outputControl = outputControl;
300  }
301 
302 
309  m_outputControlName = name;
310  }
311 
312 
319  return m_outputControlName;
320  }
321 
328  return m_outputControl;
329  }
330 
331 
338  return m_settings;
339  }
340 
341 
350  if (m_statisticsResults) {
351  return *m_statisticsResults;
352  }
353  else {
355  "Results for this bundle is NULL.",
356  _FILEINFO_);
357  }
358  }
359 
360 
367  return *m_images;
368  }
369 
370 
376  void BundleSolutionInfo::setName(QString name) {
377  m_name = name;
378  }
379 
380 
387  QString BundleSolutionInfo::name() const {
388  return m_name;
389  }
390 
391 
403  bool BundleSolutionInfo::outputImagesCSVHeader(std::ofstream &fpOut, BundleObservationQsp observation) {
404 
405  if (!fpOut) {
406  return false;
407  }
408 
409  char buf[1056];
410 
411  // setup column headers
412  std::vector<QString> outputColumns;
413 
414  outputColumns.push_back("Image,");
415  outputColumns.push_back("rms,");
416  outputColumns.push_back("rms,");
417  outputColumns.push_back("rms,");
418 
419  QStringList observationParameters = observation->parameterList();
420 
421  for (int i = 0; i < observationParameters.size(); i++) {
422  for (int j = 0; j < 5; j++) {
423  outputColumns.push_back(observationParameters[i] + ",");
424  }
425  }
426 
427  // print first column header to buffer and output to file
428  int ncolumns = outputColumns.size();
429  for (int i = 0; i < ncolumns; i++) {
430  QString str = outputColumns.at(i);
431  sprintf(buf, "%s", (const char*)str.toLatin1().data());
432  fpOut << buf;
433  }
434  sprintf(buf, "\n");
435  fpOut << buf;
436 
437  outputColumns.clear();
438 
439  outputColumns.push_back("Filename,");
440  outputColumns.push_back("sample res,");
441  outputColumns.push_back("line res,");
442  outputColumns.push_back("total res,");
443 
444  for (int i = 0; i < observationParameters.size(); i++) {
445  outputColumns.push_back("Initial,");
446  outputColumns.push_back("Correction,");
447  outputColumns.push_back("Final,");
448  outputColumns.push_back("Apriori Sigma,");
449  outputColumns.push_back("Adj Sigma,");
450  }
451 
452  // print second column header to buffer and output to file
453  ncolumns = outputColumns.size();
454  for (int i = 0; i < ncolumns; i++) {
455  QString str = outputColumns.at(i);
456  sprintf(buf, "%s", (const char*)str.toLatin1().data());
457  fpOut << buf;
458  }
459  sprintf(buf, "\n");
460  fpOut << buf;
461 
462  return true;
463  }
464 
465 
466 
479  bool BundleSolutionInfo::outputHeader(std::ofstream &fpOut) {
480 
481  if (!fpOut) {
482  return false;
483  }
484 
485  char buf[1056];
486  int numObservations = m_statisticsResults->observations().size();
487  int numImages = 0;
488  for (int i = 0; i < numObservations; i++) {
489  numImages += m_statisticsResults->observations().at(i)->size();
490  }
491  int numValidPoints = m_statisticsResults->outputControlNet()->GetNumValidPoints();
492  int numInnerConstraints = 0;
493  int numDistanceConstraints = 0;
494  int numDegreesOfFreedom = m_statisticsResults->numberObservations()
499 
500  int convergenceCriteria = 1;
501 
502  sprintf(buf, "JIGSAW: BUNDLE ADJUSTMENT\n=========================\n");
503  fpOut << buf;
504  sprintf(buf, "\n Run Time: %s",
505  Isis::iTime::CurrentLocalTime().toLatin1().data());
506  fpOut << buf;
507  sprintf(buf, "\n Network Filename: %s",
508  m_inputControlNetFileName->expanded().toLatin1().data());
509  fpOut << buf;
510 
511  sprintf(buf,"\n Cube List: %s",
512  m_settings->cubeList().toStdString().c_str() );
513 
514  fpOut << buf;
515 
516  sprintf(buf, "\n Output Network Filename: %s",
517  outputControlName().toStdString().c_str() );
518  fpOut << buf;
519  sprintf(buf,"\n Output File Prefix: %s",
520  m_settings->outputFilePrefix().toStdString().c_str() );
521  fpOut <<buf;
522 
523  sprintf(buf, "\n Network Id: %s",
524  m_statisticsResults->outputControlNet()->GetNetworkId().toLatin1().data());
525  fpOut << buf;
526  sprintf(buf, "\n Network Description: %s",\
527  m_statisticsResults->outputControlNet()->Description().toLatin1().data());
528  fpOut << buf;
529  sprintf(buf, "\n Target: %s",
530  m_statisticsResults->outputControlNet()->GetTarget().toLatin1().data());
531  fpOut << buf;
532  sprintf(buf, "\n\n Linear Units: kilometers");
533  fpOut << buf;
534  sprintf(buf, "\n Angular Units: decimal degrees");
535  fpOut << buf;
536  sprintf(buf, "\n\nINPUT: SOLVE OPTIONS\n====================\n");
537  fpOut << buf;
538 
539  m_settings->solveObservationMode() ?
540  sprintf(buf, "\n OBSERVATIONS: ON"):
541  sprintf(buf, "\n OBSERVATIONS: OFF");
542  fpOut << buf;
543 
544  m_settings->solveRadius() ?
545  sprintf(buf, "\n RADIUS: ON"):
546  sprintf(buf, "\n RADIUS: OFF");
547  fpOut << buf;
548 
549  m_settings->solveTargetBody() ?
550  sprintf(buf, "\n TARGET BODY: ON"):
551  sprintf(buf, "\n TARGET BODY: OFF");
552  fpOut << buf;
553 
554  m_settings->updateCubeLabel() ?
555  sprintf(buf, "\n UPDATE: YES"):
556  sprintf(buf, "\n UPDATE: NO");
557  fpOut << buf;
558 
559  m_settings->errorPropagation() ?
560  sprintf(buf, "\n ERROR PROPAGATION: ON"):
561  sprintf(buf, "\n ERROR PROPAGATION: OFF");
562  fpOut << buf;
563 
564  (m_settings->controlPointCoordTypeReports() == SurfacePoint::Latitudinal) ?
565  sprintf(buf, "\n CONTROL POINT COORDINATE TYPE FOR REPORTS: LATITUDINAL"):
566  sprintf(buf, "\n CONTROL POINT COORDINATE TYPE FOR REPORTS: RECTANGULAR");
567  fpOut << buf;
568 
569  (m_settings->controlPointCoordTypeBundle() == SurfacePoint::Latitudinal) ?
570  sprintf(buf, "\n CONTROL POINT COORDINATE TYPE FOR BUNDLE: LATITUDINAL"):
571  sprintf(buf, "\n CONTROL POINT COORDINATE TYPE FOR BUNDLE: RECTANGULAR");
572  fpOut << buf;
573 
574  if (m_settings->outlierRejection()) {
575  sprintf(buf, "\n OUTLIER REJECTION: ON");
576  fpOut << buf;
577  sprintf(buf, "\n REJECTION MULTIPLIER: %lf",
578  m_settings->outlierRejectionMultiplier());
579  fpOut << buf;
580 
581  }
582  else {
583  sprintf(buf, "\n OUTLIER REJECTION: OFF");
584  fpOut << buf;
585  sprintf(buf, "\n REJECTION MULTIPLIER: N/A");
586  fpOut << buf;
587  }
588 
589  // Added April 5, 2017
590  sprintf(buf, "\n CONTROL POINT COORDINATE TYPE FOR REPORTS: %s",
591  SurfacePoint::coordinateTypeToString(m_settings->controlPointCoordTypeReports()).toLatin1().data());
592 
593  // Added July 4, 2017
594  sprintf(buf, "\n CONTROL POINT COORDINATE TYPE FOR BUNDLE: %s",
595  SurfacePoint::coordinateTypeToString(m_settings->controlPointCoordTypeBundle()).toLatin1().data());
596 
597  sprintf(buf, "\n\nMAXIMUM LIKELIHOOD ESTIMATION\n============================\n");
598  fpOut << buf;
599 
600  for (int tier = 0; tier < 3; tier++) {
601  if (tier < m_statisticsResults->numberMaximumLikelihoodModels()) {
602  sprintf(buf, "\n Tier %d Enabled: TRUE", tier);
603  fpOut << buf;
604  sprintf(buf, "\n Maximum Likelihood Model: %s",
607  maximumLikelihoodModelWFunc(tier).model()).toLatin1().data());
608  fpOut << buf;
609  sprintf(buf, "\n Quantile used for tweaking constant: %lf",
611  fpOut << buf;
612  sprintf(buf, "\n Quantile weighted R^2 Residual value: %lf",
614  fpOut << buf;
615  sprintf(buf, "\n Approx. weighted Residual cutoff: %s",
617  .weightedResidualCutoff().toLatin1().data());
618  fpOut << buf;
619  if (tier != 2) fpOut << "\n";
620  }
621  else {
622  sprintf(buf, "\n Tier %d Enabled: FALSE", tier);
623  fpOut << buf;
624  }
625  }
626 
627  sprintf(buf, "\n\nINPUT: CONVERGENCE CRITERIA\n===========================\n");
628  fpOut << buf;
629  sprintf(buf, "\n SIGMA0: %e",
630  m_settings->convergenceCriteriaThreshold());
631  fpOut << buf;
632  sprintf(buf, "\n MAXIMUM ITERATIONS: %d",
633  m_settings->convergenceCriteriaMaximumIterations());
634  fpOut << buf;
635 
636  //TODO Should it be checked that positionSigmas.size() == positionSolveDegree and
637  // pointingSigmas.size() == pointingSolveDegree somewhere? JAM
638 
639  //TODO How do we output this information when using multiple solve settings? JAM
640 
641  BundleObservationSolveSettings globalSettings = m_settings->observationSolveSettings(0);
642  int pointingSolveDegree = globalSettings.numberCameraAngleCoefficientsSolved();
643  QList<double> pointingSigmas = globalSettings.aprioriPointingSigmas();
644  int positionSolveDegree = globalSettings.numberCameraPositionCoefficientsSolved();
645  QList<double> positionSigmas = globalSettings.aprioriPositionSigmas();
646 
647  sprintf(buf, "\n\nINPUT: CAMERA POINTING OPTIONS\n==============================\n");
648  fpOut << buf;
649  switch (pointingSolveDegree) {
650  case 0:
651  sprintf(buf,"\n CAMSOLVE: NONE");
652  break;
653  case 1:
654  sprintf(buf,"\n CAMSOLVE: ANGLES");
655  break;
656  case 2:
657  sprintf(buf,"\n CAMSOLVE: ANGLES, VELOCITIES");
658  break;
659  case 3:
660  sprintf(buf,"\n CAMSOLVE: ANGLES, VELOCITIES, ACCELERATIONS");
661  break;
662  default:
663  sprintf(buf,"\n CAMSOLVE: ALL POLYNOMIAL COEFFICIENTS (%d)"
664  "\n CKDEGREE: %d"
665  "\n CKSOLVEDEGREE: %d",
666  pointingSolveDegree,
667  globalSettings.ckDegree(),
668  globalSettings.ckSolveDegree());
669  break;
670  }
671  fpOut << buf;
672  globalSettings.solveTwist() ?
673  sprintf(buf, "\n TWIST: ON"):
674  sprintf(buf, "\n TWIST: OFF");
675  fpOut << buf;
676  globalSettings.solvePolyOverPointing() ?
677  sprintf(buf, "\n POLYNOMIAL OVER EXISTING POINTING: ON"):
678  sprintf(buf, "\nPOLYNOMIAL OVER EXISTING POINTING : OFF");
679  fpOut << buf;
680 
681  sprintf(buf, "\n\nINPUT: SPACECRAFT OPTIONS\n=========================\n");
682  fpOut << buf;
683  switch (positionSolveDegree) {
684  case 0:
685  sprintf(buf,"\n SPSOLVE: NONE");
686  break;
687  case 1:
688  sprintf(buf,"\n SPSOLVE: POSITION");
689  break;
690  case 2:
691  sprintf(buf,"\n SPSOLVE: POSITION, VELOCITIES");
692  break;
693  case 3:
694  sprintf(buf,"\n SPSOLVE: POSITION, VELOCITIES, ACCELERATIONS");
695  break;
696  default:
697  sprintf(buf,"\n SPSOLVE: ALL POLYNOMIAL COEFFICIENTS (%d)"
698  "\n SPKDEGREE: %d"
699  "\n SPKSOLVEDEGREE: %d",
700  positionSolveDegree,
701  globalSettings.spkDegree(),
702  globalSettings.spkSolveDegree());
703  break;
704  }
705  fpOut << buf;
706  globalSettings.solvePositionOverHermite() ?
707  sprintf(buf, "\n POLYNOMIAL OVER HERMITE SPLINE: ON"):
708  sprintf(buf, "\nPOLYNOMIAL OVER HERMITE SPLINE : OFF");
709  fpOut << buf;
710 
711  sprintf(buf, "\n\nINPUT: GLOBAL IMAGE PARAMETER UNCERTAINTIES\n===========================================\n");
712  QString coord1Str;
713  QString coord2Str;
714  QString coord3Str;
715  switch (m_settings->controlPointCoordTypeReports()) {
717  coord1Str = "LATITUDE";
718  coord2Str = "LONGITUDE";
719  coord3Str = "RADIUS";
720  break;
722  coord1Str = " X";
723  coord2Str = " Y";
724  coord3Str = " Z";
725  break;
726  default:
727  IString msg ="Unknown surface point coordinate type enum ["
728  + toString(m_settings->controlPointCoordTypeReports()) + "]." ;
729  throw IException(IException::Programmer, msg, _FILEINFO_);
730  break;
731  }
732 
733  // Coordinate 1 (latitude or point X)
734  fpOut << buf;
735  (m_settings->globalPointCoord1AprioriSigma() == Isis::Null) ?
736  sprintf(buf,"\n POINT %s SIGMA: N/A", coord1Str.toLatin1().data()):
737  sprintf(buf,"\n POINT %s SIGMA: %lf (meters)", coord1Str.toLatin1().data(),
738  m_settings->globalPointCoord1AprioriSigma());
739  // Coordinate 2 (longitude or point Y)
740  fpOut << buf;
741  (m_settings->globalPointCoord2AprioriSigma() == Isis::Null) ?
742  sprintf(buf,"\n POINT %s SIGMA: N/A", coord2Str.toLatin1().data()):
743  sprintf(buf,"\n POINT %s SIGMA: %lf (meters)", coord2Str.toLatin1().data(),
744  m_settings->globalPointCoord2AprioriSigma());
745  // Coordinate 3 (radius or point Z)
746  fpOut << buf;
747  (m_settings->globalPointCoord3AprioriSigma() == Isis::Null) ?
748  sprintf(buf,"\n POINT %s SIGMA: N/A", coord3Str.toLatin1().data()):
749  sprintf(buf,"\n POINT %s SIGMA: %lf (meters)", coord3Str.toLatin1().data(),
750  m_settings->globalPointCoord3AprioriSigma());
751  fpOut << buf;
752  (positionSolveDegree < 1 || positionSigmas[0] == Isis::Null) ?
753  sprintf(buf,"\n SPACECRAFT POSITION SIGMA: N/A"):
754  sprintf(buf,"\n SPACECRAFT POSITION SIGMA: %lf (meters)",
755  positionSigmas[0]);
756  fpOut << buf;
757 
758  (positionSolveDegree < 2 || positionSigmas[1] == Isis::Null) ?
759  sprintf(buf,"\n SPACECRAFT VELOCITY SIGMA: N/A"):
760  sprintf(buf,"\n SPACECRAFT VELOCITY SIGMA: %lf (m/s)",
761  positionSigmas[1]);
762  fpOut << buf;
763 
764  (positionSolveDegree < 3 || positionSigmas[2] == Isis::Null) ?
765  sprintf(buf,"\n SPACECRAFT ACCELERATION SIGMA: N/A"):
766  sprintf(buf,"\n SPACECRAFT ACCELERATION SIGMA: %lf (m/s/s)",
767  positionSigmas[2]);
768  fpOut << buf;
769 
770  (pointingSolveDegree < 1 || pointingSigmas[0] == Isis::Null) ?
771  sprintf(buf,"\n CAMERA ANGLES SIGMA: N/A"):
772  sprintf(buf,"\n CAMERA ANGLES SIGMA: %lf (dd)",
773  pointingSigmas[0]);
774  fpOut << buf;
775 
776  (pointingSolveDegree < 2 || pointingSigmas[1] == Isis::Null) ?
777  sprintf(buf,"\n CAMERA ANGULAR VELOCITY SIGMA: N/A"):
778  sprintf(buf,"\n CAMERA ANGULAR VELOCITY SIGMA: %lf (dd/s)",
779  pointingSigmas[1]);
780  fpOut << buf;
781 
782  (pointingSolveDegree < 3 || pointingSigmas[2] == Isis::Null) ?
783  sprintf(buf,"\n CAMERA ANGULAR ACCELERATION SIGMA: N/A"):
784  sprintf(buf,"\n CAMERA ANGULAR ACCELERATION SIGMA: %lf (dd/s/s)",
785  pointingSigmas[2]);
786  fpOut << buf;
787 
788  if (m_settings->solveTargetBody()) {
789  sprintf(buf, "\n\nINPUT: TARGET BODY OPTIONS\n==============================\n");
790  fpOut << buf;
791 
792  if (m_settings->solvePoleRA() && m_settings->solvePoleDec()) {
793  sprintf(buf,"\n POLE: RIGHT ASCENSION");
794  fpOut << buf;
795  sprintf(buf,"\n : DECLINATION\n");
796  fpOut << buf;
797  }
798  else if (m_settings->solvePoleRA()) {
799  sprintf(buf,"\n POLE: RIGHT ASCENSION\n");
800  fpOut << buf;
801  }
802  else if (m_settings->solvePoleDec()) {
803  sprintf(buf,"\n POLE: DECLINATION\n");
804  fpOut << buf;
805  }
806 
807  if (m_settings->solvePM() || m_settings->solvePMVelocity()
808  || m_settings->solvePMAcceleration()) {
809  sprintf(buf,"\n PRIME MERIDIAN: W0 (OFFSET)");
810  fpOut << buf;
811 
812  if (m_settings->solvePMVelocity()) {
813  sprintf(buf,"\n : WDOT (SPIN RATE)");
814  fpOut << buf;
815  }
816  if (m_settings->solvePMAcceleration()) {
817  sprintf(buf,"\n :W ACCELERATION");
818  fpOut << buf;
819  }
820  }
821 
822  if (m_settings->solveTriaxialRadii() || m_settings->solveMeanRadius()) {
823  if (m_settings->solveMeanRadius()) {
824  sprintf(buf,"\n RADII: MEAN");
825  fpOut << buf;
826  }
827  else if (m_settings->solveTriaxialRadii()) {
828  sprintf(buf,"\n RADII: TRIAXIAL");
829  fpOut << buf;
830  }
831  }
832  }
833 
834  sprintf(buf, "\n\nJIGSAW: RESULTS\n===============\n");
835  fpOut << buf;
836  sprintf(buf, "\n Images: %6d",numImages);
837  fpOut << buf;
838  sprintf(buf, "\n Points: %6d",numValidPoints);
839  fpOut << buf;
840 
841  sprintf(buf, "\n Total Measures: %6d",
844  fpOut << buf;
845 
846  sprintf(buf, "\n Total Observations: %6d",
849  fpOut << buf;
850 
851  sprintf(buf, "\n Good Observations: %6d",
853  fpOut << buf;
854 
855  sprintf(buf, "\n Rejected Observations: %6d",
857  fpOut << buf;
858 
860  sprintf(buf, "\n Constrained Point Parameters: %6d",
862  fpOut << buf;
863  }
864 
866  sprintf(buf, "\n Constrained Image Parameters: %6d",
868  fpOut << buf;
869  }
870 
872  sprintf(buf, "\n Constrained Target Parameters: %6d",
874  fpOut << buf;
875  }
876 
877  sprintf(buf, "\n Unknowns: %6d",
879  fpOut << buf;
880 
881  if (numInnerConstraints > 0) {
882  sprintf(buf, "\n Inner Constraints: %6d", numInnerConstraints);
883  fpOut << buf;
884  }
885 
886  if (numDistanceConstraints > 0) {
887  sprintf(buf, "\n Distance Constraints: %d", numDistanceConstraints);
888  fpOut << buf;
889  }
890 
891  sprintf(buf, "\n Degrees of Freedom: %6d", numDegreesOfFreedom);
892  fpOut << buf;
893 
894  sprintf(buf, "\n Convergence Criteria: %6.3g",
895  m_settings->convergenceCriteriaThreshold());
896  fpOut << buf;
897 
898  if (convergenceCriteria == 1) {
899  sprintf(buf, "(Sigma0)");
900  fpOut << buf;
901  }
902 
903  sprintf(buf, "\n Iterations: %6d", m_statisticsResults->iterations());
904  fpOut << buf;
905 
906  if (m_statisticsResults->iterations() >= m_settings->convergenceCriteriaMaximumIterations()) {
907  sprintf(buf, "(Maximum reached)");
908  fpOut << buf;
909  }
910 
911  sprintf(buf, "\n Sigma0: %30.20lf\n", m_statisticsResults->sigma0());
912  fpOut << buf;
913  sprintf(buf, " Error Propagation Elapsed Time: %6.4lf (seconds)\n",
915  fpOut << buf;
916  sprintf(buf, " Total Elapsed Time: %6.4lf (seconds)\n",
918  fpOut << buf;
921  > 100) {
922  sprintf(buf, "\n Residual Percentiles:\n");
923  fpOut << buf;
924 
925  // residual prob distribution values are calculated/printed
926  // even if there is no maximum likelihood estimation
927  try {
928  for (int bin = 1;bin < 34;bin++) {
929  double cumProb = double(bin) / 100.0;
930  double resValue =
932  residualsCumulativeProbabilityDistribution().value(cumProb);
933  double resValue33 =
935  residualsCumulativeProbabilityDistribution().value(cumProb + 0.33);
936  double resValue66 =
938  residualsCumulativeProbabilityDistribution().value(cumProb + 0.66);
939  sprintf(buf, " Percentile %3d: %+8.3lf"
940  " Percentile %3d: %+8.3lf"
941  " Percentile %3d: %+8.3lf\n",
942  bin, resValue,
943  bin + 33, resValue33,
944  bin + 66, resValue66);
945  fpOut << buf;
946  }
947  }
948  catch (IException &e) {
949  QString msg = "Failed to output residual percentiles for bundleout";
950  throw IException(e, IException::Io, msg, _FILEINFO_);
951  }
952  try {
953  sprintf(buf, "\n Residual Box Plot:");
954  fpOut << buf;
955  sprintf(buf, "\n minimum: %+8.3lf",
957  fpOut << buf;
958  sprintf(buf, "\n Quartile 1: %+8.3lf",
960  fpOut << buf;
961  sprintf(buf, "\n Median: %+8.3lf",
963  fpOut << buf;
964  sprintf(buf, "\n Quartile 3: %+8.3lf",
966  fpOut << buf;
967  sprintf(buf, "\n maximum: %+8.3lf\n",
969  fpOut << buf;
970  }
971  catch (IException &e) {
972  QString msg = "Failed to output residual box plot for bundleout";
973  throw IException(e, IException::Io, msg, _FILEINFO_);
974  }
975  }
976 
977  // Loop over the observations to find the longest file path/name in the
978  // bunch
979  int filePadding = 0;
980 
981  for (int i = 0; i < numObservations; i++) {
982 
983  int numImagesInObservation = m_statisticsResults->observations().at(i)->size();
984 
985  for (int j = 0; j < numImagesInObservation; j++) {
986  BundleImageQsp bundleImage = m_statisticsResults->observations().at(i)->at(j);
987 
988  if (bundleImage->fileName().length() > filePadding) {
989  filePadding = bundleImage->fileName().length();
990  }
991  }
992  }
993 
994  sprintf(buf, "\nIMAGE MEASURES SUMMARY\n==========================\n\n");
995  fpOut << buf;
996 
997  // Pad each element in the table with the space for the longest image
998  // path/name then padd it the length of the element + 1
999  QString header("Measures RMS(pixels)");
1000  // This is padded by an extra 11 to move it center to the table
1001  sprintf(buf,"%*s\n", header.length() + 11 + filePadding, header.toLatin1().data());
1002  fpOut << buf;
1003 
1004  QString dividers("*************************** *******************************************");
1005  sprintf(buf,"%*s\n", dividers.length() + 1 + filePadding, dividers.toLatin1().data());
1006  fpOut << buf;
1007 
1008  QString fields("| Accepted | Total | | Samples | Lines | Total |");
1009  sprintf(buf,"%*s\n", fields.length() + 1 + filePadding, fields.toLatin1().data());
1010  fpOut << buf;
1011 
1012  int numMeasures;
1013  int numRejectedMeasures;
1014  int numUsed;
1015  int imageIndex = 0;
1016  Statistics rmsSamplesTotal,rmsLinesTotal,rmsTotals;
1017 
1018  for (int i = 0; i < numObservations; i++) {
1019 
1020  int numImagesInObservation = m_statisticsResults->observations().at(i)->size();
1021 
1022  for (int j = 0; j < numImagesInObservation; j++) {
1023 
1024  BundleImageQsp bundleImage = m_statisticsResults->observations().at(i)->at(j);
1025 
1026  double rmsSampleResiduals = m_statisticsResults->
1027  rmsImageSampleResiduals()[imageIndex].Rms();
1028  double rmsLineResiduals = m_statisticsResults->
1029  rmsImageLineResiduals()[imageIndex].Rms();
1030  double rmsLandSResiduals = m_statisticsResults->
1031  rmsImageResiduals()[imageIndex].Rms();
1032  rmsSamplesTotal.AddData(rmsSampleResiduals);
1033  rmsLinesTotal.AddData(rmsLineResiduals);
1034  rmsTotals.AddData(rmsLandSResiduals);
1035 
1036  numMeasures = m_statisticsResults->outputControlNet()->GetNumberOfValidMeasuresInImage
1037  (bundleImage->serialNumber());
1038 
1039  numRejectedMeasures = m_statisticsResults->outputControlNet()->
1040  GetNumberOfJigsawRejectedMeasuresInImage(bundleImage->serialNumber());
1041 
1042  numUsed = numMeasures - numRejectedMeasures;
1043 
1044  QString filename = bundleImage->fileName();
1045  QStringList List;
1046  List = filename.split("/");
1047 
1048  sprintf(buf,"%-*s" ,filePadding + 1, bundleImage->fileName().toLatin1().data());
1049  fpOut << buf;
1050 
1051  sprintf(buf, " %12d %12d ", numUsed, numMeasures);
1052  fpOut << buf;
1053 
1054  sprintf(buf,"%13.4lf %13.4lf %13.4lf \n",
1055  rmsSampleResiduals,rmsLineResiduals,rmsLandSResiduals);
1056 
1057  fpOut << buf;
1058  imageIndex++;
1059  }
1060  }
1061 
1062  // Do something similar to above but left justify the string and add a 33
1063  // character buffer
1064  sprintf(buf,"%*s", -(filePadding + 33), "\nTotal RMS:");
1065  fpOut << buf;
1066  sprintf(buf,"%13.4lf %13.4lf %13.4lf\n",
1067  rmsSamplesTotal.Rms(),rmsLinesTotal.Rms(),rmsTotals.Rms());
1068  fpOut << buf;
1069 
1070  return true;
1071  }
1072 
1073 
1086 
1087  char buf[1056];
1088 
1089  QList<Statistics> rmsImageSampleResiduals = m_statisticsResults->rmsImageSampleResiduals();
1090  QList<Statistics> rmsImageLineResiduals = m_statisticsResults->rmsImageLineResiduals();
1092 
1093  bool errorProp = false;
1094  if (m_statisticsResults->converged() && m_settings->errorPropagation()) {
1095  errorProp = true;
1096  }
1097 
1098  QList<QString> outputCsvFileNames;
1100  // If there's just a single instrumentId just call it bundleout_images.csv
1101  if (instrumentIds.size() == 1) {
1102  QString ofname = "bundleout_images.csv";
1103  ofname = m_settings->outputFilePrefix() + ofname;
1104  m_csvSavedImagesFilename = ofname;
1105  outputCsvFileNames.push_back(ofname);
1106  }
1107  // Otherwise append the instrument IDs so it's bundleout_images_spacecraft_sensor.csv
1108  else {
1109  for (int i = 0; i < instrumentIds.size(); i++) {
1110  QString updatedInstrumentId = instrumentIds[i];
1111  // Replace and "/" or " " characters with "_" to make the filename safer
1112  // This line must be separate to avoid modifying the instrumentId in the list
1113  // we will iterate over later
1114  updatedInstrumentId.replace("/", "_").replace(" ", "_");
1115  QString ofname = "bundleout_images_" + updatedInstrumentId + ".csv";
1116  ofname = m_settings->outputFilePrefix() + ofname;
1117  m_csvSavedImagesFilename = ofname;
1118  outputCsvFileNames.push_back(ofname);
1119  }
1120  }
1121 
1122  for (int i = 0; i < instrumentIds.size(); i++) {
1123 
1124  std::ofstream fpOut(outputCsvFileNames[i].toLatin1().data(), std::ios::out);
1125  if (!fpOut) {
1126  return false;
1127  }
1128 
1129  QList<BundleObservationQsp> observations =
1131 
1132  int nObservations = observations.size();
1133 
1134  outputImagesCSVHeader(fpOut, observations.front());
1135 
1136  for (int j = 0; j < nObservations; j++ ) {
1137  BundleObservationQsp observation = observations[j];
1138 
1139  // We need the image index, not the observation index,
1140  // so count all of the images prior to this observation
1141  int observationIndex = observation->index();
1142  int imgIndex = 0;
1143  for (int obsIndex = 0; obsIndex < observationIndex; obsIndex++) {
1144  imgIndex += m_statisticsResults->observations().at(obsIndex)->size();
1145  }
1146 
1147  if(!observation) {
1148  continue;
1149  }
1150 
1151  int numImages = observation->size();
1152 
1153  for (int k = 0; k < numImages; k++) {
1154  BundleImageQsp image = observation->at(k);
1155 
1156  sprintf(buf, "%s", image->fileName().toLatin1().data());
1157  fpOut << buf;
1158  sprintf(buf,",");
1159  fpOut << buf;
1160 
1161  fpOut << toString(rmsImageSampleResiduals[imgIndex].Rms()).toLatin1().data();
1162  sprintf(buf,",");
1163  fpOut << buf;
1164 
1165  fpOut << toString(rmsImageLineResiduals[imgIndex].Rms()).toLatin1().data();
1166  sprintf(buf,",");
1167  fpOut << buf;
1168 
1169  fpOut << toString(rmsImageResiduals[imgIndex].Rms()).toLatin1().data();
1170  sprintf(buf,",");
1171  fpOut << buf;
1172 
1173  QString observationString =
1174  observation->bundleOutputCSV(errorProp);
1175 
1176  //Removes trailing commas
1177  if (observationString.right(1)==",") {
1178  observationString.truncate(observationString.length()-1);
1179  }
1180 
1181  fpOut << (const char*) observationString.toLatin1().data();
1182 
1183  sprintf(buf,"\n");
1184  fpOut << buf;
1185  imgIndex++;
1186 
1187  }
1188  }
1189  fpOut.close();
1190  }
1191 
1192  return true;
1193  }
1194 
1195 
1202 
1203  QString ofname = "bundleout.txt";
1204  ofname = m_settings->outputFilePrefix() + ofname;
1205 
1206  std::ofstream fpOut(ofname.toLatin1().data(), std::ios::out);
1207  if (!fpOut) {
1208  return false;
1209  }
1210 
1211  m_txtBundleOutputFilename = ofname;
1212 
1213  char buf[4096];
1214  BundleObservationQsp observation;
1215 
1216  int nObservations = m_statisticsResults->observations().size();
1217 
1218  outputHeader(fpOut);
1219 
1220  bool berrorProp = false;
1221  if (m_statisticsResults->converged() && m_settings->errorPropagation()) {
1222  berrorProp = true;
1223  }
1224 
1225  // output target body header if solving for target
1226  if (m_settings->solveTargetBody()) {
1227  sprintf(buf, "\nTARGET BODY\n==========================\n");
1228  fpOut << buf;
1229 
1230  sprintf(buf, "\n Target Initial Total "
1231  "Final Initial Final\n"
1232  "Parameter Value Correction "
1233  "Value Accuracy Accuracy\n");
1234  fpOut << buf;
1235 
1236  QString targetString =
1237  m_settings->bundleTargetBody()->formatBundleOutputString(berrorProp);
1238  fpOut << (const char*)targetString.toLatin1().data();
1239  }
1240 
1241  // output image exterior orientation header
1242  sprintf(buf, "\nIMAGE EXTERIOR ORIENTATION\n==========================\n");
1243  fpOut << buf;
1244 
1245  QMap<QString, QStringList> imagesAndParameters;
1246 
1247  if (m_settings->solveTargetBody()) {
1248  imagesAndParameters.insert( "target", m_settings->bundleTargetBody()->parameterList() );
1249  }
1250 
1251  for (int i = 0; i < nObservations; i++) {
1252 
1253  observation = m_statisticsResults->observations().at(i);
1254  if (!observation) {
1255  continue;
1256  }
1257 
1258  int numImages = observation->size();
1259  for (int j = 0; j < numImages; j++) {
1260  BundleImageQsp image = observation->at(j);
1261  sprintf(buf, "\nImage Full File Name: %s\n", image->fileName().toLatin1().data());
1262  fpOut << buf;
1263  sprintf(buf, "\nImage Serial Number: %s\n", image->serialNumber().toLatin1().data());
1264  fpOut << buf;
1265 
1266  sprintf(buf,"Image Initial Total Final Accuracy\n");
1267  fpOut << buf;
1268  sprintf(buf,"Parameter Value Correction Value Initial Final Units\n");
1269  fpOut << buf;
1270 
1271  sprintf(buf," "
1272  "***************************************\n");
1273  fpOut << buf;
1274 
1275  observation->bundleOutputString(fpOut,berrorProp);
1276  // Build list of images and parameters for correlation matrix.
1277  foreach ( QString image, observation->imageNames() ) {
1278  imagesAndParameters.insert( image, observation->parameterList() );
1279  }
1280  }
1281  }
1282 
1283  // Save list of images and their associated parameters for CorrelationMatrix to use in ice.
1284  m_statisticsResults->setCorrMatImgsAndParams(imagesAndParameters);
1285 
1286  // Save list of images and their associated parameters for CorrelationMatrix to use in ice.
1287  m_statisticsResults->setCorrMatImgsAndParams(imagesAndParameters);
1288 
1289  // output point uncertainty statistics if error propagation is on
1290  if (berrorProp) {
1291  sprintf(buf, "\n\n\nPOINTS UNCERTAINTY SUMMARY\n==========================\n\n");
1292  fpOut << buf;
1293 
1294  // Coordinate 1 (latitude or point x) summary
1295  QString
1296  coordName = surfacePointCoordName(m_settings->controlPointCoordTypeReports(),
1297  SurfacePoint::One);
1298  sprintf(buf, "RMS Sigma %s(m)%20.8lf\n", coordName.toLatin1().data(),
1300  fpOut << buf;
1301  sprintf(buf, "MIN Sigma %s(m)%20.8lf at %s\n", coordName.toLatin1().data(),
1303  m_statisticsResults->minSigmaCoord1PointId().toLatin1().data());
1304  fpOut << buf;
1305  sprintf(buf, "MAX Sigma %s(m)%20.8lf at %s\n\n", coordName.toLatin1().data(),
1307  m_statisticsResults->maxSigmaCoord1PointId().toLatin1().data());
1308  fpOut << buf;
1309 
1310  // Coordinate 2 (longitude or point y) summary
1311  coordName = surfacePointCoordName(m_settings->controlPointCoordTypeReports(),
1312  SurfacePoint::Two);
1313  sprintf(buf, "RMS Sigma %s(m)%20.8lf\n", coordName.toLatin1().data(),
1315  fpOut << buf;
1316  sprintf(buf, "MIN Sigma %s(m)%20.8lf at %s\n", coordName.toLatin1().data(),
1318  m_statisticsResults->minSigmaCoord2PointId().toLatin1().data());
1319  fpOut << buf;
1320  sprintf(buf, "MAX Sigma %s(m)%20.8lf at %s\n\n", coordName.toLatin1().data(),
1322  m_statisticsResults->maxSigmaCoord2PointId().toLatin1().data());
1323  fpOut << buf;
1324 
1325  // Coordinate 3 (radius or point z) summary
1326  coordName = surfacePointCoordName(m_settings->controlPointCoordTypeReports(),
1327  SurfacePoint::Three);
1328  if ( m_settings->solveRadius() ) {
1329  sprintf(buf, "RMS Sigma %s(m)%20.8lf\n", coordName.toLatin1().data(),
1331  fpOut << buf;
1332  sprintf(buf, "MIN Sigma %s(m)%20.8lf at %s\n", coordName.toLatin1().data(),
1334  m_statisticsResults->minSigmaCoord3PointId().toLatin1().data());
1335  fpOut << buf;
1336  sprintf(buf, "MAX Sigma %s(m)%20.8lf at %s\n", coordName.toLatin1().data(),
1338  m_statisticsResults->maxSigmaCoord3PointId().toLatin1().data());
1339  fpOut << buf;
1340  }
1341  else {
1342  sprintf(buf, " RMS Sigma Radius(m) N/A\n");
1343  fpOut << buf;
1344  sprintf(buf, " MIN Sigma Radius(m) N/A\n");
1345  fpOut << buf;
1346  sprintf(buf, " MAX Sigma Radius(m) N/A\n");
1347  fpOut << buf;
1348  }
1349  }
1350 
1351  // output point summary data header
1352  if (m_settings->controlPointCoordTypeReports() == SurfacePoint::Latitudinal) {
1353  sprintf(buf, "\n\nPOINTS SUMMARY\n==============\n%103s"
1354  "Sigma Sigma Sigma\n"
1355  " Label Status Rays RMS"
1356  " Latitude Longitude Radius"
1357  " Latitude Longitude Radius\n", "");
1358  }
1359  else { // Must be Rectangular
1360  sprintf(buf, "\n\nPOINTS SUMMARY\n==============\n%103s"
1361  "Sigma Sigma Sigma\n"
1362  " Label Status Rays RMS"
1363  " Point X Point Y Point Z"
1364  " Point X Point Y Point Z\n", "");
1365  }
1366  fpOut << buf;
1367 
1368  int nPoints = m_statisticsResults->bundleControlPoints().size();
1369  for (int i = 0; i < nPoints; i++) {
1370  BundleControlPointQsp bundleControlPoint = m_statisticsResults->bundleControlPoints().at(i);
1371 
1372  QString pointSummaryString =
1373  bundleControlPoint->formatBundleOutputSummaryString(berrorProp);
1374  fpOut << (const char*)pointSummaryString.toLatin1().data();
1375  }
1376 
1377  // output point detail data header
1378  sprintf(buf, "\n\nPOINTS DETAIL\n=============\n\n");
1379  fpOut << buf;
1380 
1381  bool solveRadius = m_settings->solveRadius();
1382 
1383  for (int i = 0; i < nPoints; i++) {
1384  BundleControlPointQsp bundleControlPoint = m_statisticsResults->bundleControlPoints().at(i);
1385 
1386  // Removed radiansToMeters argument 9/18/2018 DAC
1387  QString pointDetailString =
1388  bundleControlPoint->formatBundleOutputDetailString(berrorProp,
1389  solveRadius);
1390  fpOut << (const char*)pointDetailString.toLatin1().data();
1391  }
1392 
1393  fpOut.close();
1394 
1395  return true;
1396  }
1397 
1398 
1405  char buf[1056];
1406 
1407  QString ofname = "bundleout_points.csv";
1408  ofname = m_settings->outputFilePrefix() + ofname;
1409  m_csvSavedPointsFilename = ofname;
1410 
1411  std::ofstream fpOut(ofname.toLatin1().data(), std::ios::out);
1412  if (!fpOut) {
1413  return false;
1414  }
1415 
1416  int numPoints = m_statisticsResults->bundleControlPoints().size();
1417 
1418  double dLat, dLon, dRadius;
1419  double dX, dY, dZ;
1420  double dSigmaLat, dSigmaLong, dSigmaRadius;
1421  QString strStatus;
1422  double cor_lat_m;
1423  double cor_lon_m;
1424  double cor_rad_m;
1425  int numMeasures, numRejectedMeasures;
1426  double dResidualRms;
1427 
1428  // print column headers
1429  if (m_settings->errorPropagation()) {
1430  sprintf(buf, ",,,,,3-d,3-d,3-d,Sigma,Sigma,Sigma,Correction,Correction,Correction,Coordinate,"
1431  "Coordinate,Coordinate\nPoint,Point,Accepted,Rejected,Residual,Latitude,Longitude,"
1432  "Radius,Latitude,Longitude,Radius,Latitude,Longitude,Radius,X,Y,Z\nLabel,Status,"
1433  "Measures,Measures,RMS,(dd),(dd),(km),(m),(m),(m),(m),(m),(m),(km),(km),(km)\n");
1434  }
1435  else {
1436  sprintf(buf, ",,,,,3-d,3-d,3-d,Correction,Correction,Correction,Coordinate,Coordinate,"
1437  "Coordinate\nPoint,Point,Accepted,Rejected,Residual,Latitude,Longitude,Radius,"
1438  "Latitude,Longitude,Radius,X,Y,Z\nLabel,Status,Measures,Measures,RMS,(dd),(dd),(km),"
1439  "(m),(m),(m),(km),(km),(km)\n");
1440  }
1441  fpOut << buf;
1442 
1443  for (int i = 0; i < numPoints; i++) {
1444  BundleControlPointQsp bundlecontrolpoint = m_statisticsResults->bundleControlPoints().at(i);
1445 
1446  if (!bundlecontrolpoint) {
1447  continue;
1448  }
1449 
1450  if (bundlecontrolpoint->isRejected()) {
1451  continue;
1452  }
1453 
1454  dLat = bundlecontrolpoint->adjustedSurfacePoint().GetLatitude().degrees();
1455  dLon = bundlecontrolpoint->adjustedSurfacePoint().GetLongitude().degrees();
1456  dRadius = bundlecontrolpoint->adjustedSurfacePoint().GetLocalRadius().kilometers();
1457  dX = bundlecontrolpoint->adjustedSurfacePoint().GetX().kilometers();
1458  dY = bundlecontrolpoint->adjustedSurfacePoint().GetY().kilometers();
1459  dZ = bundlecontrolpoint->adjustedSurfacePoint().GetZ().kilometers();
1460  numMeasures = bundlecontrolpoint->numberOfMeasures();
1461  numRejectedMeasures = bundlecontrolpoint->numberOfRejectedMeasures();
1462  dResidualRms = bundlecontrolpoint->residualRms();
1463 
1464  // point corrections and initial sigmas
1465  boost::numeric::ublas::bounded_vector< double, 3 > corrections = bundlecontrolpoint->
1466  corrections();
1467  // Now use the local radius to convert radians to meters instead of the target body equatorial radius
1468  cor_lat_m = bundlecontrolpoint->adjustedSurfacePoint().LatitudeToMeters(corrections[0]);
1469  cor_lon_m = bundlecontrolpoint->adjustedSurfacePoint().LongitudeToMeters(corrections[1]);
1470  cor_rad_m = corrections[2]*1000.0;
1471 
1472  if (bundlecontrolpoint->type() == ControlPoint::Fixed) {
1473  strStatus = "FIXED";
1474  }
1475  else if (bundlecontrolpoint->type() == ControlPoint::Constrained) {
1476  strStatus = "CONSTRAINED";
1477  }
1478  else if (bundlecontrolpoint->type() == ControlPoint::Free) {
1479  strStatus = "FREE";
1480  }
1481  else {
1482  strStatus = "UNKNOWN";
1483  }
1484 
1485  if (m_settings->errorPropagation()) {
1486  dSigmaLat = bundlecontrolpoint->adjustedSurfacePoint().GetLatSigmaDistance().meters();
1487  dSigmaLong = bundlecontrolpoint->adjustedSurfacePoint().GetLonSigmaDistance().meters();
1488  dSigmaRadius = bundlecontrolpoint->adjustedSurfacePoint().GetLocalRadiusSigma().meters();
1489 
1490  sprintf(buf, "%s,%s,%d,%d,%6.2lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,"
1491  "%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf\n",
1492  bundlecontrolpoint->id().toLatin1().data(), strStatus.toLatin1().data(),
1493  numMeasures, numRejectedMeasures, dResidualRms, dLat, dLon, dRadius, dSigmaLat,
1494  dSigmaLong, dSigmaRadius, cor_lat_m, cor_lon_m, cor_rad_m, dX, dY, dZ);
1495  }
1496  else
1497  sprintf(buf, "%s,%s,%d,%d,%6.2lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,"
1498  "%16.8lf,%16.8lf\n",
1499  bundlecontrolpoint->id().toLatin1().data(), strStatus.toLatin1().data(),
1500  numMeasures, numRejectedMeasures, dResidualRms, dLat, dLon, dRadius, cor_lat_m,
1501  cor_lon_m, cor_rad_m, dX, dY, dZ);
1502 
1503  fpOut << buf;
1504  }
1505 
1506  fpOut.close();
1507 
1508  return true;
1509  }
1510 
1511 
1518  char buf[1056];
1519 
1520  QString ofname = "residuals.csv";
1521  ofname = m_settings->outputFilePrefix() + ofname;
1522  m_csvSavedResidualsFilename = ofname;
1523 
1524  std::ofstream fpOut(ofname.toLatin1().data(), std::ios::out);
1525  if (!fpOut) {
1526  return false;
1527  }
1528 
1529  // output column headers
1530 
1531  sprintf(buf, ",,,x image,y image,Measured,Measured,sample,line,Residual Vector\n");
1532  fpOut << buf;
1533  sprintf(buf, "Point,Image,Image,coordinate,coordinate,"
1534  "Sample,Line,residual,residual,Magnitude\n");
1535  fpOut << buf;
1536  sprintf(buf, "Label,Filename,Serial Number,(mm),(mm),"
1537  "(pixels),(pixels),(pixels),(pixels),(pixels),Rejected\n");
1538  fpOut << buf;
1539 
1540  // Setup counts and pointers
1541 
1542  int numPoints = m_statisticsResults->bundleControlPoints().size();
1543  int numMeasures = 0;
1544 
1545  BundleControlPointQsp bundleControlPoint;
1546  BundleMeasureQsp bundleMeasure;
1547 
1548  for (int i = 0; i < numPoints; i++) {
1549  bundleControlPoint = m_statisticsResults->bundleControlPoints().at(i);
1550  numMeasures = bundleControlPoint->size();
1551 
1552  if (bundleControlPoint->rawControlPoint()->IsIgnored()) {
1553  continue;
1554  }
1555 
1556  for (int j = 0; j < numMeasures; j++) {
1557  bundleMeasure = bundleControlPoint->at(j);
1558 
1559  Camera *measureCamera = bundleMeasure->camera();
1560  if (!measureCamera) {
1561  continue;
1562  }
1563 
1564  if (bundleMeasure->isRejected()) {
1565  sprintf(buf, "%s,%s,%s,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,*\n",
1566  bundleControlPoint->id().toLatin1().data(),
1567  bundleMeasure->parentBundleImage()->fileName().toLatin1().data(),
1568  bundleMeasure->cubeSerialNumber().toLatin1().data(),
1569  bundleMeasure->focalPlaneMeasuredX(),
1570  bundleMeasure->focalPlaneMeasuredY(),
1571  bundleMeasure->sample(),
1572  bundleMeasure->line(),
1573  bundleMeasure->sampleResidual(),
1574  bundleMeasure->lineResidual(),
1575  bundleMeasure->residualMagnitude());
1576  }
1577  else {
1578  sprintf(buf, "%s,%s,%s,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf\n",
1579  bundleControlPoint->id().toLatin1().data(),
1580  bundleMeasure->parentBundleImage()->fileName().toLatin1().data(),
1581  bundleMeasure->cubeSerialNumber().toLatin1().data(),
1582  bundleMeasure->focalPlaneMeasuredX(),
1583  bundleMeasure->focalPlaneMeasuredY(),
1584  bundleMeasure->sample(),
1585  bundleMeasure->line(),
1586  bundleMeasure->sampleResidual(),
1587  bundleMeasure->lineResidual(),
1588  bundleMeasure->residualMagnitude());
1589  }
1590  fpOut << buf;
1591  }
1592  }
1593 
1594  fpOut.close();
1595 
1596  return true;
1597  }
1598 
1599 
1616  void BundleSolutionInfo::save(QXmlStreamWriter &stream, const Project *project,
1617  FileName newProjectRoot) const {
1618 
1619  // TODO: comment below not clear, why is this done?
1620  // This is done for unitTest which has no Project
1621  // SHOULD WE BE CREATING A SERIALIZED PROJECT AS INPUT TO THIS UNIT TEST?
1622  QString relativePath;
1623  QString relativeBundlePath;
1624  FileName bundleSolutionInfoRoot;
1625 
1626  if (project) {
1627  bundleSolutionInfoRoot = FileName(Project::bundleSolutionInfoRoot(newProjectRoot.expanded()) +
1628  "/" + runTime());
1629  QString oldPath = project->bundleSolutionInfoRoot(project->projectRoot()) + "/" + runTime();
1630  QString newPath = project->bundleSolutionInfoRoot(newProjectRoot.toString()) + "/" + runTime();
1631  // If project is being saved to new area, create directory and copy files
1632  if (oldPath != newPath) {
1633  // Create project folder for BundleSolutionInfo
1634  QDir bundleDir(newPath);
1635  if (!bundleDir.mkpath(bundleDir.path())) {
1636  throw IException(IException::Io,
1637  QString("Failed to create directory [%1]")
1638  .arg(bundleSolutionInfoRoot.path()),
1639  _FILEINFO_);
1640  }
1641  QString oldFile = oldPath + "/" + FileName(m_outputControl->fileName()).name();
1642  QString newFile = newPath + "/" + FileName(m_outputControl->fileName()).name();
1643  if (!QFile::copy(oldFile, newFile)) {
1644  throw IException(IException::Io,
1645  QString("Failed to copy file [%1] to new file [%2]")
1646  .arg(m_outputControl->fileName()).arg(newFile),
1647  _FILEINFO_);
1648  }
1649  newFile = newPath + "/" + FileName(m_txtBundleOutputFilename).name();
1650  if (!QFile::copy(m_txtBundleOutputFilename, newFile)) {
1651  throw IException(IException::Io,
1652  QString("Failed to copy file [%1] to new file [%2]")
1653  .arg(m_txtBundleOutputFilename).arg(newFile),
1654  _FILEINFO_);
1655  }
1656  newFile = newPath + "/" + FileName(m_csvSavedImagesFilename).name();
1657  if (!QFile::copy(m_csvSavedImagesFilename, newFile)) {
1658  throw IException(IException::Io,
1659  QString("Failed to copy file [%1] to new file [%2]")
1660  .arg(m_csvSavedImagesFilename).arg(newFile),
1661  _FILEINFO_);
1662  }
1663  newFile = newPath + "/" + FileName(m_csvSavedPointsFilename).name();
1664  if (!QFile::copy(m_csvSavedPointsFilename, newFile)) {
1665  throw IException(IException::Io,
1666  QString("Failed to copy file [%1] to new file [%2]")
1667  .arg(m_csvSavedPointsFilename).arg(newFile),
1668  _FILEINFO_);
1669  }
1670  newFile = newPath + "/" + FileName(m_csvSavedResidualsFilename).name();
1671  if (!QFile::copy(m_csvSavedResidualsFilename, newFile)) {
1672  throw IException(IException::Io,
1673  QString("Failed to copy file [%1] to new file [%2]")
1674  .arg(m_csvSavedResidualsFilename).arg(newFile),
1675  _FILEINFO_);
1676  }
1677  }
1678 
1679  // Create relativePath
1680  relativePath = m_inputControlNetFileName->expanded().remove(project->newProjectRoot());
1681  // Get rid of any preceding "/" , but add on ending "/"
1682  if (relativePath.startsWith("/")) {
1683  relativePath.remove(0,1);
1684  }
1685 
1686  // Create relativeBundlePath for bundleSolutionInfo
1687  relativeBundlePath = newPath.remove(project->newProjectRoot());
1688  // Get rid of any preceding "/" , but add on ending "/"
1689  if (relativeBundlePath.startsWith("/")) {
1690  relativeBundlePath.remove(0,1);
1691  }
1692  relativeBundlePath += "/";
1693  }
1694 
1695  // TODO: so, we can do the stuff below if project is NULL?
1696 
1697  stream.writeStartElement("bundleSolutionInfo");
1698  // save ID, cnet file name, and run time to stream
1699  stream.writeStartElement("generalAttributes");
1700  stream.writeTextElement("id", m_id->toString());
1701  stream.writeTextElement("name", m_name);
1702  stream.writeTextElement("runTime", runTime());
1703 
1704  stream.writeTextElement("inputFileName",
1705  relativePath);
1706  stream.writeTextElement("bundleOutTXT",
1707  relativeBundlePath + FileName(m_txtBundleOutputFilename).name());
1708  stream.writeTextElement("imagesCSV",
1709  relativeBundlePath + FileName(m_csvSavedImagesFilename).name());
1710  stream.writeTextElement("pointsCSV",
1711  relativeBundlePath + FileName(m_csvSavedPointsFilename).name());
1712  stream.writeTextElement("residualsCSV",
1713  relativeBundlePath + FileName(m_csvSavedResidualsFilename).name());
1714  stream.writeEndElement(); // end general attributes
1715 
1716  // save settings to stream
1717  m_settings->save(stream, project);
1718 
1719  // save statistics to stream
1720  m_statisticsResults->save(stream, project);
1721 
1722  if (project) {
1723  // save adjusted images lists to stream
1724  if (!m_adjustedImages->isEmpty()) {
1725  stream.writeStartElement("imageLists");
1726  for (int i = 0; i < m_adjustedImages->count(); i++) {
1727  m_adjustedImages->at(i)->save(stream, project, bundleSolutionInfoRoot);
1728  }
1729  stream.writeEndElement();
1730  }
1731 
1732  // save output control
1733  stream.writeStartElement("outputControl");
1734  m_outputControl->save(stream, project, relativeBundlePath);
1735  stream.writeEndElement();
1736  }
1737 
1738  stream.writeEndElement(); //end bundleSolutionInfo
1739  }
1740 
1741 
1750  Project *project) {
1751  m_xmlHandlerBundleSolutionInfo = bundleSolutionInfo;
1752  m_xmlHandlerProject = project;
1754  }
1755 
1756 
1761  }
1762 
1763 
1772  m_xmlHandlerCharacters += ch;
1773  return XmlStackedHandler::characters(ch);
1774  }
1775 
1776 
1787  bool BundleSolutionInfo::XmlHandler::startElement(const QString &namespaceURI,
1788  const QString &localName,
1789  const QString &qName,
1790  const QXmlAttributes &atts) {
1791  m_xmlHandlerCharacters = "";
1792 
1793  if (XmlStackedHandler::startElement(namespaceURI, localName, qName, atts)) {
1794 
1795  if (localName == "bundleSettings") {
1796  m_xmlHandlerBundleSolutionInfo->m_settings =
1797  BundleSettingsQsp(new BundleSettings(m_xmlHandlerProject, reader()));
1798  }
1799  else if (localName == "bundleResults") {
1800  m_xmlHandlerBundleSolutionInfo->m_statisticsResults = new BundleResults(m_xmlHandlerProject,
1801  reader());
1802  }
1803  else if (localName == "imageList") {
1804  m_xmlHandlerBundleSolutionInfo->m_adjustedImages->append(
1805  new ImageList(m_xmlHandlerProject, reader()));
1806  }
1807  else if (localName == "outputControl") {
1808  FileName outputControlPath = FileName(m_xmlHandlerProject->bundleSolutionInfoRoot() + "/"
1809  + m_xmlHandlerBundleSolutionInfo->runTime());
1810 
1811  m_xmlHandlerBundleSolutionInfo->m_outputControl = new Control(outputControlPath, reader());
1812  }
1813  }
1814  return true;
1815  }
1816 
1817 
1827  bool BundleSolutionInfo::XmlHandler::endElement(const QString &namespaceURI,
1828  const QString &localName,
1829  const QString &qName) {
1830  // This is done for unitTest which has no Project
1831  QString projectRoot;
1832  if (m_xmlHandlerProject) {
1833  projectRoot = m_xmlHandlerProject->projectRoot() + "/";
1834  }
1835 
1836  if (localName == "id") {
1837  // all constructors assign a Uuid - we need to give it a one from the XML
1838  assert(m_xmlHandlerBundleSolutionInfo->m_id);
1839  delete m_xmlHandlerBundleSolutionInfo->m_id;
1840  m_xmlHandlerBundleSolutionInfo->m_id = new QUuid(m_xmlHandlerCharacters);
1841  }
1842  else if (localName == "name") {
1843  m_xmlHandlerBundleSolutionInfo->m_name = m_xmlHandlerCharacters;
1844  }
1845  else if (localName == "runTime") {
1846  m_xmlHandlerBundleSolutionInfo->m_runTime = m_xmlHandlerCharacters;
1847  }
1848  else if (localName == "inputFileName") {
1849  assert(m_xmlHandlerBundleSolutionInfo->m_inputControlNetFileName == NULL);
1850  m_xmlHandlerBundleSolutionInfo->m_inputControlNetFileName = new FileName(
1851  projectRoot + m_xmlHandlerCharacters);
1852  }
1853  else if (localName == "bundleOutTXT") {
1854  m_xmlHandlerBundleSolutionInfo->m_txtBundleOutputFilename =
1855  projectRoot + m_xmlHandlerCharacters;
1856  }
1857  else if (localName == "imagesCSV") {
1858  m_xmlHandlerBundleSolutionInfo->m_csvSavedImagesFilename =
1859  projectRoot + m_xmlHandlerCharacters;
1860  }
1861  else if (localName == "pointsCSV") {
1862  m_xmlHandlerBundleSolutionInfo->m_csvSavedPointsFilename =
1863  projectRoot + m_xmlHandlerCharacters;
1864  }
1865  else if (localName == "residualsCSV") {
1866  m_xmlHandlerBundleSolutionInfo->m_csvSavedResidualsFilename =
1867  projectRoot + m_xmlHandlerCharacters;
1868  }
1869 
1870  m_xmlHandlerCharacters = "";
1871  return XmlStackedHandler::endElement(namespaceURI, localName, qName);
1872  }
1873 
1874 
1884  SurfacePoint::CoordIndex coordIdx) const {
1885  QString coordName;
1886  switch (m_settings->controlPointCoordTypeReports()) {
1888  switch (coordIdx) {
1889  case SurfacePoint::One:
1890  coordName = " Latitude";
1891  break;
1892  case SurfacePoint::Two:
1893  coordName = "Longitude";
1894  break;
1895  case SurfacePoint::Three:
1896  coordName = " Radius";
1897  break;
1898  default:
1899  IString msg = "Unknown surface point index enum ["
1900  + toString(coordIdx) + "].";
1901  throw IException(IException::Programmer, msg, _FILEINFO_);
1902  break;
1903  }
1904  break;
1906  switch (coordIdx) {
1907  case SurfacePoint::One:
1908  coordName = "POINT X";
1909  break;
1910  case SurfacePoint::Two:
1911  coordName = "POINT Y";
1912  break;
1913  case SurfacePoint::Three:
1914  coordName = "POINT Z";
1915  break;
1916  default:
1917  IString msg = "Unknown surface point index enum ["
1918  + toString(coordIdx) + "].";
1919  throw IException(IException::Programmer, msg, _FILEINFO_);
1920  break;
1921  }
1922  break;
1923  default:
1924  IString msg = "Unknown surface point coordinate type enum ["
1925  + toString(m_settings->controlPointCoordTypeReports()) + "].";
1926  throw IException(IException::Programmer, msg, _FILEINFO_);
1927  break;
1928  }
1929  return coordName;
1930  }
1931 }
Isis::BundleResults::minSigmaCoord2PointId
QString minSigmaCoord2PointId() const
Returns the minimum sigma point id for coordinate 2.
Definition: BundleResults.cpp:1045
Isis::BundleResults::numberUnknownParameters
int numberUnknownParameters() const
Returns the number of unknown parameters.
Definition: BundleResults.cpp:1215
Isis::BundleResults::numberConstrainedPointParameters
int numberConstrainedPointParameters() const
Returns the number of constrained point parameters.
Definition: BundleResults.cpp:1185
Isis::BundleResults::iterations
int iterations() const
Returns the number of iterations taken by the BundleAdjust.
Definition: BundleResults.cpp:1302
Isis::BundleResults::maxSigmaCoord2PointId
QString maxSigmaCoord2PointId() const
Returns the maximum sigma point id for coordinate 2.
Definition: BundleResults.cpp:1055
Isis::BundleSolutionInfo::savedPointsFilename
QString savedPointsFilename()
Returns filename of output bundle points csv file.
Definition: BundleSolutionInfo.cpp:146
Isis::BundleSolutionInfo::XmlHandler
This class is used to read an images.xml file into an image list.
Definition: BundleSolutionInfo.h:225
Isis::BundleResults::converged
bool converged() const
Returns whether or not the bundle adjustment converged.
Definition: BundleResults.cpp:1265
Isis::BundleObservationSolveSettings::spkDegree
int spkDegree() const
Accesses the degree of the polynomial fit to the original camera position (spkDegree).
Definition: BundleObservationSolveSettings.cpp:1143
Isis::Statistics
This class is used to accumulate statistics on double arrays.
Definition: Statistics.h:94
Isis::IException::Io
@ Io
A type of error that occurred when performing an actual I/O operation.
Definition: IException.h:155
Isis::Statistics::AddData
void AddData(const double *data, const unsigned int count)
Add an array of doubles to the accumulators and counters.
Definition: Statistics.cpp:141
Isis::BundleSolutionInfo::outputImagesCSVHeader
bool outputImagesCSVHeader(std::ofstream &fpOut, BundleObservationQsp observations)
Outputs the header for the bundleout_images.csv file.
Definition: BundleSolutionInfo.cpp:403
Isis::BundleSolutionInfo::outputPointsCSV
bool outputPointsCSV()
Outputs point data to a csv file.
Definition: BundleSolutionInfo.cpp:1404
Isis::BundleObservationVector::instrumentIds
QList< QString > instrumentIds() const
Get a list of all instrument IDs that there are observations for.
Definition: BundleObservationVector.cpp:238
Isis::BundleResults::maximumLikelihoodModelWFunc
MaximumLikelihoodWFunctions maximumLikelihoodModelWFunc(int modelIndex) const
Returns the maximum likelihood model at the given index.
Definition: BundleResults.cpp:1375
Isis::BundleSolutionInfo::savedResidualsFilename
QString savedResidualsFilename()
Returns filename of output bundle residuals csv file.
Definition: BundleSolutionInfo.cpp:156
Isis::BundleResults::numberConstrainedImageParameters
int numberConstrainedImageParameters() const
Returns the number of constrained image parameters.
Definition: BundleResults.cpp:1195
Isis::BundleSolutionInfo::XmlHandler::characters
virtual bool characters(const QString &ch)
Adds characters to m_xmlHandlerCharacters.
Definition: BundleSolutionInfo.cpp:1771
Isis::BundleResults::numberObservations
int numberObservations() const
Returns the number of observations.
Definition: BundleResults.cpp:1165
Isis::BundleSolutionInfo::addAdjustedImages
void addAdjustedImages(ImageList *images)
Adds a list of images that were adjusted (their labels were updated).
Definition: BundleSolutionInfo.cpp:166
Isis::BundleSolutionInfo::m_inputControlNetFileName
FileName * m_inputControlNetFileName
Input control network file name.
Definition: BundleSolutionInfo.h:254
Isis::StatCumProbDistDynCalc::min
double min()
Returns the maximum observation so far included in the dynamic calculation.
Definition: StatCumProbDistDynCalc.cpp:160
Isis::BundleObservationSolveSettings::aprioriPointingSigmas
QList< double > aprioriPointingSigmas() const
Accesses the a priori pointing sigmas.
Definition: BundleObservationSolveSettings.cpp:945
QList
This is free and unencumbered software released into the public domain.
Definition: BoxcarCachingAlgorithm.h:13
Isis::BundleSolutionInfo::m_id
QUuid * m_id
A unique ID for this BundleSolutionInfo object (useful for others to reference this object when savin...
Definition: BundleSolutionInfo.h:251
Isis::BundleResults::maxSigmaCoord3Distance
Distance maxSigmaCoord3Distance() const
Returns the maximum sigma distance for coordinate 3.
Definition: BundleResults.cpp:1015
Project.h
Isis::BundleSolutionInfo::updateFileName
void updateFileName(Project *)
TODO: change description below to something more like english.
Definition: BundleSolutionInfo.cpp:195
Isis::FileName::name
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
Definition: FileName.cpp:162
Isis::BundleResults::rmsImageResiduals
QList< Statistics > rmsImageResiduals() const
Returns the list of RMS image residuals statistics.
Definition: BundleResults.cpp:895
Isis::BundleResults::sigmaCoord1StatisticsRms
double sigmaCoord1StatisticsRms() const
Returns the RMS of the adjusted sigmas for coordinate 1.
Definition: BundleResults.cpp:1085
Isis::BundleSolutionInfo::outputControlNetFileName
QString outputControlNetFileName() const
Returns the name of the output control network.
Definition: BundleSolutionInfo.cpp:284
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
Isis::BundleResults::elapsedTimeErrorProp
double elapsedTimeErrorProp() const
Returns the elapsed time for error propagation.
Definition: BundleResults.cpp:1255
Isis::IException::Unknown
@ Unknown
A type of error that cannot be classified as any of the other error types.
Definition: IException.h:118
Isis::XmlStackedHandlerReader::pushContentHandler
virtual void pushContentHandler(XmlStackedHandler *newHandler)
Push a contentHandler and maybe continue parsing...
Definition: XmlStackedHandlerReader.cpp:55
Isis::BundleSolutionInfo::name
QString name() const
Returns the name of the bundle.
Definition: BundleSolutionInfo.cpp:387
Isis::BundleSolutionInfo::outputImagesCSV
bool outputImagesCSV()
Outputs the bundleout_images.csv file which contains Jigsaw data about the images within each observa...
Definition: BundleSolutionInfo.cpp:1085
Isis::BundleSolutionInfo::XmlHandler::m_xmlHandlerCharacters
QString m_xmlHandlerCharacters
List of characters that have been handled.
Definition: BundleSolutionInfo.h:244
Isis::BundleResults::minSigmaCoord1PointId
QString minSigmaCoord1PointId() const
Returns the minimum sigma point id for coordinate 1.
Definition: BundleResults.cpp:1025
Isis::BundleSolutionInfo::surfacePointCoordName
QString surfacePointCoordName(SurfacePoint::CoordinateType type, SurfacePoint::CoordIndex coordInx) const
Determine the control point coordinate name.
Definition: BundleSolutionInfo.cpp:1883
Isis::iTime::CurrentLocalTime
static QString CurrentLocalTime()
Returns the current local time This time is taken directly from the system clock, so if the system cl...
Definition: iTime.cpp:513
Isis::Project::cnetRoot
static QString cnetRoot(QString projectRoot)
Appends the root directory name 'cnets' to the project.
Definition: Project.cpp:2019
Isis::BundleResults::maxSigmaCoord1Distance
Distance maxSigmaCoord1Distance() const
Returns the maximum sigma distance for coordinate 1.
Definition: BundleResults.cpp:975
Isis::BundleSolutionInfo::setName
void setName(QString name)
Sets the name of the bundle.
Definition: BundleSolutionInfo.cpp:376
Isis::BundleObservationSolveSettings::ckDegree
int ckDegree() const
Accesses the degree of polynomial fit to original camera angles (ckDegree).
Definition: BundleObservationSolveSettings.cpp:903
Isis::BundleResults::minSigmaCoord3Distance
Distance minSigmaCoord3Distance() const
Returns the minimum sigma distance for coordinate 3.
Definition: BundleResults.cpp:1005
Isis::BundleSolutionInfo::savedBundleOutputFilename
QString savedBundleOutputFilename()
Returns bundleout text filename.
Definition: BundleSolutionInfo.cpp:126
Isis::Control
This represents an ISIS control net in a project-based GUI interface.
Definition: Control.h:66
Isis::BundleResults::sigma0
double sigma0() const
Returns the Sigma0 of the bundle adjustment.
Definition: BundleResults.cpp:1235
Isis::BundleSolutionInfo::savedImagesFilename
QString savedImagesFilename()
Returns filename of output bundle images csv file.
Definition: BundleSolutionInfo.cpp:136
QSharedPointer< BundleSettings >
Isis::BundleSolutionInfo::XmlHandler::~XmlHandler
~XmlHandler()
Destructor.
Definition: BundleSolutionInfo.cpp:1760
Isis::Camera
Definition: Camera.h:236
Isis::StatCumProbDistDynCalc::max
double max()
Returns the maximum observation so far included in the dynamic calculation.
Definition: StatCumProbDistDynCalc.cpp:143
Isis::BundleSolutionInfo::m_outputControl
Control * m_outputControl
Output control.
Definition: BundleSolutionInfo.h:255
Isis::BundleResults::bundleControlPoints
QVector< BundleControlPointQsp > & bundleControlPoints()
Returns a reference to the BundleControlPoint vector.
Definition: BundleResults.cpp:1275
Isis::BundleResults::rmsImageLineResiduals
QList< Statistics > rmsImageLineResiduals() const
Returns the list of RMS image line residuals statistics.
Definition: BundleResults.cpp:885
QStringList
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
Isis::XmlStackedHandlerReader
Manage a stack of content handlers for reading XML files.
Definition: XmlStackedHandlerReader.h:30
Isis::SurfacePoint::coordinateTypeToString
static QString coordinateTypeToString(CoordinateType type)
Converts the given SurfacePoint::CoordinateType enumeration to a string.
Definition: SurfacePoint.cpp:1389
Isis::BundleSolutionInfo::outputHeader
bool outputHeader(std::ofstream &fpOut)
Output header for bundle results file.
Definition: BundleSolutionInfo.cpp:479
Isis::Control::save
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Method to write this Control object's member data to an XML stream.
Definition: Control.cpp:373
Isis::BundleSolutionInfo::setOutputControl
void setOutputControl(Control *outputControl)
Returns the name of the output control network.
Definition: BundleSolutionInfo.cpp:298
Isis::BundleResults::elapsedTime
double elapsedTime() const
Returns the elapsed time for the bundle adjustment.
Definition: BundleResults.cpp:1245
Isis::Project
The main project for ipce.
Definition: Project.h:289
Isis::BundleSolutionInfo::XmlHandler::endElement
virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName)
Handle an XML end element.
Definition: BundleSolutionInfo.cpp:1827
Isis::BundleObservationVector::observationsByInstId
QList< BundleObservationQsp > observationsByInstId(QString instrumentId) const
Get all of the observations with a specific instrument ID.
Definition: BundleObservationVector.cpp:247
Isis::ImageList
Internalizes a list of images and allows for operations on the entire list.
Definition: ImageList.h:55
Isis::MaximumLikelihoodWFunctions::weightedResidualCutoff
QString weightedResidualCutoff()
Method to return a string represtentation of the weighted residual cutoff (if it exists) for the Maxi...
Definition: MaximumLikelihoodWFunctions.cpp:399
Isis::BundleSolutionInfo::inputControlNetFileName
QString inputControlNetFileName() const
Returns the name of the input control network.
Definition: BundleSolutionInfo.cpp:274
Isis::ControlPoint::Fixed
@ Fixed
A Fixed point is a Control Point whose lat/lon is well established and should not be changed.
Definition: ControlPoint.h:371
Isis::BundleSolutionInfo::~BundleSolutionInfo
~BundleSolutionInfo()
Destructor.
Definition: BundleSolutionInfo.cpp:95
Isis::BundleResults::observations
const BundleObservationVector & observations() const
Returns a reference to the observations used by the BundleAdjust.
Definition: BundleResults.cpp:1312
Isis::FileName::expanded
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Definition: FileName.cpp:196
Isis::SurfacePoint::Rectangular
@ Rectangular
Body-fixed rectangular x/y/z coordinates.
Definition: SurfacePoint.h:141
Isis::Statistics::Rms
double Rms() const
Computes and returns the rms.
Definition: Statistics.cpp:365
Isis::MaximumLikelihoodWFunctions::modelToString
static QString modelToString(Model model)
Static method to return a string represtentation for a given MaximumLikelihoodWFunctions::Model enum.
Definition: MaximumLikelihoodWFunctions.cpp:355
Isis::BundleResults::maxSigmaCoord1PointId
QString maxSigmaCoord1PointId() const
Returns the maximum sigma point id for coordinate 1.
Definition: BundleResults.cpp:1035
Isis::SurfacePoint::CoordinateType
CoordinateType
Defines the coordinate typ, units, and coordinate index for some of the output methods.
Definition: SurfacePoint.h:139
Isis::BundleSolutionInfo::bundleResults
BundleResults bundleResults()
Returns the bundle results.
Definition: BundleSolutionInfo.cpp:349
Isis::FileName::dir
QDir dir() const
Returns the path of the file's parent directory as a QDir object.
Definition: FileName.cpp:465
Isis::BundleSolutionInfo::m_settings
BundleSettingsQsp m_settings
Bundle settings.
Definition: BundleSolutionInfo.h:257
Isis::BundleObservationSolveSettings::aprioriPositionSigmas
QList< double > aprioriPositionSigmas() const
Accesses the a priori position sigmas.
Definition: BundleObservationSolveSettings.cpp:1185
Isis::BundleSolutionInfo::setOutputStatistics
void setOutputStatistics(BundleResults statisticsResults)
Sets the stat results.
Definition: BundleSolutionInfo.cpp:176
Isis::BundleResults::maxSigmaCoord3PointId
QString maxSigmaCoord3PointId() const
Returns the maximum sigma point id for coordinate 3.
Definition: BundleResults.cpp:1075
Isis::BundleSolutionInfo::XmlHandler::startElement
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
Handle an XML start element.
Definition: BundleSolutionInfo.cpp:1787
Isis::ControlPoint::Constrained
@ Constrained
A Constrained point is a Control Point whose lat/lon/radius is somewhat established and should not be...
Definition: ControlPoint.h:376
Isis::BundleSolutionInfo
Container class for BundleAdjustment results.
Definition: BundleSolutionInfo.h:159
Isis::BundleResults::outputControlNet
ControlNetQsp outputControlNet() const
Returns a shared pointer to the output control network.
Definition: BundleResults.cpp:1287
Isis::BundleSettingsQsp
QSharedPointer< BundleSettings > BundleSettingsQsp
Definition for a BundleSettingsQsp, a shared pointer to a BundleSettings object.
Definition: BundleSettings.h:404
Isis::BundleSolutionInfo::runTime
QString runTime() const
Returns the run time.
Definition: BundleSolutionInfo.cpp:264
Isis::BundleSolutionInfo::adjustedImages
QList< ImageList * > adjustedImages() const
Returns the list of images that were adjusted after a bundle.
Definition: BundleSolutionInfo.cpp:222
Isis::BundleSolutionInfo::m_adjustedImages
QList< ImageList * > * m_adjustedImages
Adjusted image list.
Definition: BundleSolutionInfo.h:260
Isis::BundleResults::sigmaCoord3StatisticsRms
double sigmaCoord3StatisticsRms() const
Returns the RMS of the adjusted sigmas for coordinate 3.
Definition: BundleResults.cpp:1105
Isis::BundleResults::maxSigmaCoord2Distance
Distance maxSigmaCoord2Distance() const
Returns the maximum sigma distance for coordinate 2.
Definition: BundleResults.cpp:995
Isis::BundleSolutionInfo::m_images
QList< ImageList * > * m_images
Input image list.
Definition: BundleSolutionInfo.h:259
Isis::BundleSolutionInfo::setRunTime
void setRunTime(QString runTime)
Sets the run time, and the name if a name is not already set.
Definition: BundleSolutionInfo.cpp:242
Isis::BundleObservationSolveSettings::solvePositionOverHermite
bool solvePositionOverHermite() const
Whether or not the polynomial for solving will be fit over an existing Hermite spline.
Definition: BundleObservationSolveSettings.cpp:1175
Isis::Project::newProjectRoot
QString newProjectRoot() const
Get the top-level folder of the new project.
Definition: Project.cpp:1675
Isis::BundleSolutionInfo::id
QString id() const
Get a unique, identifying string associated with this BundleSolutionInfo object.
Definition: BundleSolutionInfo.cpp:232
Isis::BundleObservationSolveSettings::spkSolveDegree
int spkSolveDegree() const
Accesses the degree of thecamera position polynomial being fit to in the bundle adjustment (spkSolveD...
Definition: BundleObservationSolveSettings.cpp:1154
Isis::BundleSettings
Container class for BundleAdjustment settings.
Definition: BundleSettings.h:125
Isis::BundleObservationSolveSettings::numberCameraAngleCoefficientsSolved
int numberCameraAngleCoefficientsSolved() const
Accesses the number of camera angle coefficients in the solution.
Definition: BundleObservationSolveSettings.cpp:924
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::BundleResults::minSigmaCoord1Distance
Distance minSigmaCoord1Distance() const
Returns the minimum sigma distance for coordinate 1.
Definition: BundleResults.cpp:965
Isis::BundleResults::sigmaCoord2StatisticsRms
double sigmaCoord2StatisticsRms() const
Returns the RMS of the adjusted sigmas for coordinate 2.
Definition: BundleResults.cpp:1095
Isis::FileName::toString
QString toString() const
Returns a QString of the full file name including the file path, excluding the attributes with any Is...
Definition: FileName.cpp:515
Isis::BundleSolutionInfo::imageList
QList< ImageList * > imageList()
Returns the images used in the bundle.
Definition: BundleSolutionInfo.cpp:366
Isis::BundleSolutionInfo::m_runTime
QString m_runTime
Run time of the bundle adjustment.
Definition: BundleSolutionInfo.h:253
Isis::BundleResults::setCorrMatImgsAndParams
void setCorrMatImgsAndParams(QMap< QString, QStringList > imgsAndParams)
Set the images and their associated parameters of the correlation matrix.
Definition: BundleResults.cpp:1433
Isis::Project::projectRoot
QString projectRoot() const
Get the top-level folder of the project.
Definition: Project.cpp:1666
Isis::MaximumLikelihoodWFunctions::tweakingConstant
double tweakingConstant() const
Returns the current tweaking constant.
Definition: MaximumLikelihoodWFunctions.cpp:170
Isis::StatCumProbDistDynCalc::value
double value(double cumProb)
Provides the value of the variable that has the given cumulative probility (according the current est...
Definition: StatCumProbDistDynCalc.cpp:182
Isis::Null
const double Null
Value for an Isis Null pixel.
Definition: SpecialPixel.h:95
Isis::BundleResults::maximumLikelihoodModelQuantile
double maximumLikelihoodModelQuantile(int modelIndex) const
Returns the quantile of the maximum likelihood model at the given index.
Definition: BundleResults.cpp:1387
Isis::BundleResults::minSigmaCoord3PointId
QString minSigmaCoord3PointId() const
Returns the minimum sigma point id for coordinate 3.
Definition: BundleResults.cpp:1065
Isis::BundleSolutionInfo::outputText
bool outputText()
Outputs a text file with the results of the BundleAdjust.
Definition: BundleSolutionInfo.cpp:1201
Isis::IException::Programmer
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:146
Isis::BundleSolutionInfo::setOutputControlName
void setOutputControlName(QString name)
Sets m_outputControlName.
Definition: BundleSolutionInfo.cpp:308
Isis::BundleResults::numberConstrainedTargetParameters
int numberConstrainedTargetParameters() const
Return the number of constrained target parameters.
Definition: BundleResults.cpp:1205
Isis::BundleSolutionInfo::XmlHandler::XmlHandler
XmlHandler(BundleSolutionInfo *bundleSolutionInfo, Project *project)
Create an XML Handler (reader) that can populate the BundleSolutionInfo class data.
Definition: BundleSolutionInfo.cpp:1749
Isis::BundleSolutionInfo::m_statisticsResults
BundleResults * m_statisticsResults
Bundle statistical results.
Definition: BundleSolutionInfo.h:258
Isis::BundleSolutionInfo::save
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Saves the BundleSolutionInfo to the project.
Definition: BundleSolutionInfo.cpp:1616
Isis::ControlPoint::Free
@ Free
A Free point is a Control Point that identifies common measurements between two or more cubes.
Definition: ControlPoint.h:384
Isis::BundleObservationSolveSettings::ckSolveDegree
int ckSolveDegree() const
Accesses the degree of the camera angles polynomial being fit to in the bundle adjustment (ckSolveDeg...
Definition: BundleObservationSolveSettings.cpp:914
Isis::Distance::meters
double meters() const
Get the distance in meters.
Definition: Distance.cpp:85
Isis::Project::bundleSolutionInfoRoot
QString bundleSolutionInfoRoot() const
Accessor for the root directory of the results data.
Definition: Project.cpp:2243
QMap< QString, QStringList >
Isis::BundleObservationSolveSettings
This class is used to modify and manage solve settings for 1 to many BundleObservations.
Definition: BundleObservationSolveSettings.h:82
Isis::BundleResults::numberRejectedObservations
int numberRejectedObservations() const
Returns the number of observation that were rejected.
Definition: BundleResults.cpp:1155
Isis::SurfacePoint::Latitudinal
@ Latitudinal
Planetocentric latitudinal (lat/lon/rad) coordinates.
Definition: SurfacePoint.h:140
Isis::IString
Adds specific functionality to C++ strings.
Definition: IString.h:165
Isis::BundleResults
A container class for statistical results from a BundleAdjust solution.
Definition: BundleResults.h:82
Isis::BundleSolutionInfo::control
Control * control() const
Returns bundle output Control object.
Definition: BundleSolutionInfo.cpp:327
Isis::BundleResults::minSigmaCoord2Distance
Distance minSigmaCoord2Distance() const
Returns the minimum sigma distance for coordinate 2.
Definition: BundleResults.cpp:985
QObject
Isis::BundleSolutionInfo::m_name
QString m_name
Name of the bundle. Defaults to the id.
Definition: BundleSolutionInfo.h:252
Isis::BundleObservationSolveSettings::solveTwist
bool solveTwist() const
Accesses the flag for solving for twist.
Definition: BundleObservationSolveSettings.cpp:893
Isis::BundleResults::save
void save(QXmlStreamWriter &stream, const Project *project) const
Saves the BundleResults object to an XML file.
Definition: BundleResults.cpp:1457
Isis::BundleSolutionInfo::outputControlName
QString outputControlName() const
Returns m_outputControlName.
Definition: BundleSolutionInfo.cpp:318
Isis::BundleObservationSolveSettings::solvePolyOverPointing
bool solvePolyOverPointing() const
Whether or not the solve polynomial will be fit over the existing pointing polynomial.
Definition: BundleObservationSolveSettings.cpp:935
Isis::Project::bundleSolutionInfoRoot
static QString bundleSolutionInfoRoot(QString projectRoot)
Appends the root directory name 'bundle' to the project results directory.
Definition: Project.cpp:2233
Isis::BundleResults::rmsImageSampleResiduals
QList< Statistics > rmsImageSampleResiduals() const
Returns the list of RMS image sample residuals statistics.
Definition: BundleResults.cpp:875
Isis::BundleResults::residualsCumulativeProbabilityDistribution
StatCumProbDistDynCalc residualsCumulativeProbabilityDistribution() const
Returns the cumulative probability distribution of the residuals used for reporting.
Definition: BundleResults.cpp:1353
Isis::BundleSolutionInfo::bundleSettings
BundleSettingsQsp bundleSettings()
Returns bundle settings.
Definition: BundleSolutionInfo.cpp:337
Isis::FileName::path
QString path() const
Returns the path of the file name.
Definition: FileName.cpp:103
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::BundleSolutionInfo::XmlHandler::m_xmlHandlerBundleSolutionInfo
BundleSolutionInfo * m_xmlHandlerBundleSolutionInfo
The bundleSolutionInfo object.
Definition: BundleSolutionInfo.h:242
Isis::BundleObservationSolveSettings::numberCameraPositionCoefficientsSolved
int numberCameraPositionCoefficientsSolved() const
Accesses the number of camera position coefficients in the solution.
Definition: BundleObservationSolveSettings.cpp:1164
Isis::BundleSolutionInfo::outputResiduals
bool outputResiduals()
Outputs image coordinate residuals to a csv file.
Definition: BundleSolutionInfo.cpp:1517
Isis::Control::fileName
QString fileName() const
Access the name of the control network file associated with this Control.
Definition: Control.cpp:272