Isis 3.0 Programmer Reference
Back | Home
BundleSolutionInfo.cpp
1 #include "BundleSolutionInfo.h"
2 
3 #include <QDataStream>
4 #include <QDebug>
5 #include <QList>
6 #include <QStringList>
7 #include <QUuid>
8 #include <QXmlStreamWriter>
9 
10 #include <hdf5_hl.h> // in the hdf5 library
11 #include <hdf5.h>
12 #include <H5Cpp.h>
13 
14 #include "BundleResults.h"
15 #include "ControlMeasure.h"
16 #include "ControlNet.h"
17 #include "ControlPoint.h"
18 #include "FileName.h"
19 #include "ImageList.h"
20 #include "IString.h"
21 #include "iTime.h"
22 #include "Project.h"
23 #include "PvlKeyword.h"
24 #include "PvlObject.h"
25 #include "StatCumProbDistDynCalc.h"
26 #include "XmlStackedHandlerReader.h"
27 
28 namespace Isis {
29 
38  BundleSolutionInfo::BundleSolutionInfo(BundleSettingsQsp inputSettings,
39  FileName controlNetworkFileName,
40  BundleResults outputStatistics,
41  QObject *parent) : QObject(parent) {
42  m_id = NULL;
43  m_id = new QUuid(QUuid::createUuid());
44 
45  m_runTime = "";
46 
48  m_controlNetworkFileName = new FileName(controlNetworkFileName);
49 
50  m_settings = inputSettings;
51 
52  m_statisticsResults = NULL;
53  m_statisticsResults = new BundleResults(outputStatistics);
54 
55  m_images = NULL;
57  }
58 
59 
67  BundleSolutionInfo::BundleSolutionInfo(Project *project,
68  XmlStackedHandlerReader *xmlReader,
69  QObject *parent) : QObject(parent) {
70  //TODO does xml stuff need project???
71  m_id = NULL;
72  // what about the rest of the member data ? should we set defaults ??? CREATE INITIALIZE METHOD
73 
74  xmlReader->pushContentHandler(new XmlHandler(this, project));
75  xmlReader->setErrorHandler(new XmlHandler(this, project));
76  }
77 
84  BundleSolutionInfo::BundleSolutionInfo(FileName bundleSolutionInfoFile) {
85  m_id = NULL;
86  m_id = new QUuid(QUuid::createUuid());
87 
88  m_statisticsResults = NULL;
90 
92 
93  m_images = NULL;
94  m_images = new QList<ImageList *>;// change to QList<QStringList> ???
95 
96  openH5File(bundleSolutionInfoFile);
97  }
98 
104  BundleSolutionInfo::BundleSolutionInfo(const BundleSolutionInfo &src)
105  : m_id(new QUuid(src.m_id->toString())),
106  m_runTime(src.m_runTime),
107  m_controlNetworkFileName(new FileName(src.m_controlNetworkFileName->expanded())),
108  m_settings(new BundleSettings(*src.m_settings)),
109  m_statisticsResults(new BundleResults(*src.m_statisticsResults)),
110  m_images(new QList<ImageList *>(*src.m_images)) { // is this correct???
111 
112  // m_images = NULL;
113  // m_images = new QList<ImageList *>;
114  // for (int i = 0; i < src.m_images->size(); i++) {
115  // m_images->append(src.m_images->at(i));
116  // }
117 
118  }
119 
120 
125  delete m_id;
126  m_id = NULL;
127 
130 
131  delete m_statisticsResults;
132  m_statisticsResults = NULL;
133 
134  delete m_images;
135  m_images = NULL;
136  }
137 
138 
147 
148  if (&src != this) {
149 
150  delete m_id;
151  m_id = NULL;
152  m_id = new QUuid(src.m_id->toString());
153 
154  m_runTime = src.m_runTime;
155 
159 
160  m_settings = src.m_settings;
161 
162  delete m_statisticsResults;
163  m_statisticsResults = NULL;
165 
166  delete m_images;
167  m_images = NULL;
169  }
170  return *this;
171  }
172 
173 
180  delete m_statisticsResults;
181  m_statisticsResults = NULL;
182  m_statisticsResults = new BundleResults(statisticsResults);
183  }
184 
194  PvlObject BundleSolutionInfo::pvlObject(QString resultsName, QString settingsName,
195  QString statisticsName) {
196 
197  PvlObject pvl(resultsName);
198  pvl += PvlKeyword("RunTime", runTime());
199  if (m_controlNetworkFileName->expanded() != "") {
200  pvl += PvlKeyword("OutputControlNetwork", controlNetworkFileName());
201  }
202  pvl += bundleSettings()->pvlObject(settingsName);
203  pvl += bundleResults().pvlObject(statisticsName);
204  return pvl;
205 
206  }
207 
208 
209 
226  void BundleSolutionInfo::save(QXmlStreamWriter &stream, const Project *project,
227  FileName newProjectRoot) const {
228 
229  stream.writeStartElement("bundleSolutionInfo");
230  // save ID, cnet file name, and run time to stream
231  stream.writeStartElement("generalAttributes");
232  stream.writeTextElement("id", m_id->toString());
233  stream.writeTextElement("runTime", runTime());
234  stream.writeTextElement("fileName", m_controlNetworkFileName->expanded());
235  stream.writeEndElement(); // end general attributes
236 
237  // save settings to stream
238  m_settings->save(stream, project);
239 
240  // save statistics to stream
241  m_statisticsResults->save(stream, project);
242 
243  // save image lists to stream
244  if ( !m_images->isEmpty() ) {
245  stream.writeStartElement("imageLists");
246 
247  for (int i = 0; i < m_images->count(); i++) {
248  m_images->at(i)->save(stream, project, "");
249  }
250 
251  stream.writeEndElement();
252  }
253  stream.writeEndElement(); //end bundleSolutionInfo
254  }
255 
256 
263  void BundleSolutionInfo::save(QXmlStreamWriter &stream, const Project *project) const {
264 
265  stream.writeStartElement("bundleSolutionInfo");
266  // save ID, cnet file name, and run time to stream
267  stream.writeStartElement("generalAttributes");
268  stream.writeTextElement("id", m_id->toString());
269  stream.writeTextElement("runTime", runTime());
270  stream.writeTextElement("fileName", m_controlNetworkFileName->expanded());
271  stream.writeEndElement(); // end general attributes
272 
273  // save settings to stream
274  m_settings->save(stream, project);
275 
276  // save statistics to stream
277  m_statisticsResults->save(stream, project);
278 
279  // save image lists to stream
280  if ( !m_images->isEmpty() ) {
281  stream.writeStartElement("imageLists");
282 
283  for (int i = 0; i < m_images->count(); i++) {
284  m_images->at(i)->save(stream, project, "");
285  }
286 
287  stream.writeEndElement();
288  }
289  stream.writeEndElement(); //end bundleSolutionInfo
290  }
291 
303 
304  //TODO do we need to close anything here?
305 
306  FileName oldFileName(*m_controlNetworkFileName);
307  FileName newName(project->cnetRoot() + "/" +
308  oldFileName.dir().dirName() + "/" + oldFileName.name());
309  *m_controlNetworkFileName = newName.expanded();
310  }
311 
312 
313 
322  Project *project) {
323  m_xmlHandlerBundleSolutionInfo = bundleSolutionInfo;
324  m_xmlHandlerProject = NULL;
325  m_xmlHandlerProject = project;
327  m_xmlHandlerImages = NULL;
329  }
330 
331 
336  // bundleSolutionInfo passed in is "this" delete+null will cause problems,no?
337 // delete m_xmlHandlerBundleSolutionInfo;
338 // m_xmlHandlerBundleSolutionInfo = NULL;
339 
340  // we do not delete this pointer since it was set to a passed in pointer in constructor and we
341  // don't own it... is that right???
342 // delete m_xmlHandlerProject;
343  m_xmlHandlerProject = NULL;
344 
345  delete m_xmlHandlerImages;
346  m_xmlHandlerImages = NULL;
347 
348  delete m_xmlHandlerBundleResults;
349  m_xmlHandlerBundleResults = NULL;
350  }
351 
352 
363  bool BundleSolutionInfo::XmlHandler::startElement(const QString &namespaceURI,
364  const QString &localName,
365  const QString &qName,
366  const QXmlAttributes &atts) {
367  m_xmlHandlerCharacters = "";
368 
369  if (XmlStackedHandler::startElement(namespaceURI, localName, qName, atts)) {
370 
371  if (localName == "bundleSettings") {
372  m_xmlHandlerBundleSettings =
373  BundleSettingsQsp(new BundleSettings(m_xmlHandlerProject, reader()));
374  }
375  else if (localName == "bundleResults") {
376  delete m_xmlHandlerBundleResults;
377  m_xmlHandlerBundleResults = NULL;
378 
379  //TODO need to add constructor for this???
380  m_xmlHandlerBundleResults = new BundleResults(m_xmlHandlerProject, reader());
381  }
382  else if (localName == "imageList") {
383  m_xmlHandlerImages->append(new ImageList(m_xmlHandlerProject, reader()));
384  }
385  }
386  return true;
387  }
388 
389 
398  m_xmlHandlerCharacters += ch;
399  return XmlStackedHandler::characters(ch);
400  }
401 
402 
412  bool BundleSolutionInfo::XmlHandler::endElement(const QString &namespaceURI,
413  const QString &localName,
414  const QString &qName) {
415  if (localName == "id") {
416  m_xmlHandlerBundleSolutionInfo->m_id = NULL;
417  m_xmlHandlerBundleSolutionInfo->m_id = new QUuid(m_xmlHandlerCharacters);
418  }
419  else if (localName == "runTime") {
420  m_xmlHandlerBundleSolutionInfo->m_runTime = m_xmlHandlerCharacters;
421  }
422  else if (localName == "fileName") {
423  m_xmlHandlerBundleSolutionInfo->m_controlNetworkFileName = NULL;
424  m_xmlHandlerBundleSolutionInfo->m_controlNetworkFileName = new FileName(m_xmlHandlerCharacters);
425  }
426  else if (localName == "bundleSettings") {
427  m_xmlHandlerBundleSolutionInfo->m_settings =
428  BundleSettingsQsp(new BundleSettings(*m_xmlHandlerBundleSettings));
429  }
430  else if (localName == "bundleResults") {
431  m_xmlHandlerBundleSolutionInfo->m_statisticsResults = new BundleResults(*m_xmlHandlerBundleResults);
432  delete m_xmlHandlerBundleResults;
433  m_xmlHandlerBundleResults = NULL;
434  }
435  if (localName == "imageLists") {
436  for (int i = 0; i < m_xmlHandlerImages->size(); i++) {
437  m_xmlHandlerBundleSolutionInfo->m_images->append(m_xmlHandlerImages->at(i));
438  }
439  m_xmlHandlerImages->clear();
440  }
441  m_xmlHandlerCharacters = "";
442  return XmlStackedHandler::endElement(namespaceURI, localName, qName);
443  }
444 
445 
451  QString BundleSolutionInfo::id() const {
452  return m_id->toString().remove(QRegExp("[{}]"));
453  }
454 
455 
462  // ??? validate that a valid time has been given???
463  // try {
464  // iTime time(runTime);
465  // }
466  // catch (...) {
467  // throw IException(IException::Unknown,
468  // "Invalid bundle adjustment run time [" + runTime + ].",
469  // _FILEINFO_);
470  // }
471  m_runTime = runTime;
472  }
473 
474 
480  QString BundleSolutionInfo::runTime() const {
481  return m_runTime;
482  }
483 
484 
491  return m_controlNetworkFileName->expanded();
492  }
493 
494 
501  return m_settings;
502  }
503 
504 
513  if (m_statisticsResults) {
514  return *m_statisticsResults;
515  }
516  else {
518  "Results for this bundle is NULL.",
519  _FILEINFO_);
520  }
521  }
522 
523 
524 
525 
526 
527 
538  bool BundleSolutionInfo::outputImagesCSVHeader(std::ofstream &fpOut) {
539 
540  if (!fpOut) {
541  return false;
542  }
543 
544  char buf[1056];
545 
546  // setup column headers
547  std::vector<QString> outputColumns;
548 
549  outputColumns.push_back("Image,");
550  outputColumns.push_back("rms,");
551  outputColumns.push_back("rms,");
552  outputColumns.push_back("rms,");
553 
554  BundleObservationSolveSettings obsSettings = m_settings->observationSolveSettings(0);
555 
556  int numberCamPosCoefSolved = obsSettings.numberCameraPositionCoefficientsSolved();
557  int numberCamAngleCoefSolved = obsSettings.numberCameraAngleCoefficientsSolved();
558 
559  int nCoeff = 1;
560  if (numberCamPosCoefSolved > 0)
561  nCoeff = numberCamPosCoefSolved;
562 
563  for (int i = 0; i < nCoeff; i++) {
564  for (int j = 0; j < 5; j++) {
565  if (nCoeff == 1)
566  outputColumns.push_back("X,");
567  else {
568  QString str = "X(t" + toString(i) + "),";
569  outputColumns.push_back(str);
570  }
571  }
572  }
573  for (int i = 0; i < nCoeff; i++) {
574  for (int j = 0; j < 5; j++) {
575  if (nCoeff == 1)
576  outputColumns.push_back("Y,");
577  else {
578  QString str = "Y(t" + toString(i) + "),";
579  outputColumns.push_back(str);
580  }
581  }
582  }
583  for (int i = 0; i < nCoeff; i++) {
584  for (int j = 0; j < 5; j++) {
585  if (nCoeff == 1) {
586  outputColumns.push_back("Z,");
587  }
588  else {
589  QString str = "Z(t" + toString(i) + "),";
590  outputColumns.push_back(str);
591  }
592  }
593  if (!i)
594  break;
595  }
596 
597  for (int i = 0; i < numberCamAngleCoefSolved; i++) {
598  for (int j = 0; j < 5; j++) {
599  if (numberCamAngleCoefSolved == 1)
600  outputColumns.push_back("RA,");
601  else {
602  QString str = "RA(t" + toString(i) + "),";
603  outputColumns.push_back(str);
604  }
605  }
606  }
607  for (int i = 0; i < numberCamAngleCoefSolved; i++) {
608  for (int j = 0; j < 5; j++) {
609  if (numberCamAngleCoefSolved == 1)
610  outputColumns.push_back("DEC,");
611  else {
612  QString str = "DEC(t" + toString(i) + "),";
613  outputColumns.push_back(str);
614  }
615  }
616  }
617  for (int i = 0; i < numberCamAngleCoefSolved; i++) {
618  for (int j = 0; j < 5; j++) {
619  if (numberCamAngleCoefSolved == 1) {
620  outputColumns.push_back("TWIST,");
621  }
622  else {
623  QString str = "TWIST(t" + toString(i) + "),";
624  outputColumns.push_back(str);
625  }
626  }
627  }
628 
629  // print first column header to buffer and output to file
630  int ncolumns = outputColumns.size();
631  for (int i = 0; i < ncolumns; i++) {
632  QString str = outputColumns.at(i);
633  sprintf(buf, "%s", (const char*)str.toLatin1().data());
634  fpOut << buf;
635  }
636  sprintf(buf, "\n");
637  fpOut << buf;
638 
639  outputColumns.clear();
640  outputColumns.push_back("Filename,");
641 
642  outputColumns.push_back("sample res,");
643  outputColumns.push_back("line res,");
644  outputColumns.push_back("total res,");
645 
646  // Initially account for X,Y,Z (3)
647  int nparams = 3;
648  // See how many position coeffients we solved for to make more headers (t0, t1, ...)
649  if (numberCamPosCoefSolved)
650  nparams = 3 * numberCamPosCoefSolved;
651 
652  // Initially account for RA,DEC,TWIST (3)
653  int numCameraAnglesSolved = 3;
654  // See how many angle coefficients we solved for to make more headers (t0, t1, ...)
655  nparams += numCameraAnglesSolved*numberCamAngleCoefSolved;
656  for (int i = 0; i < nparams; i++) {
657  outputColumns.push_back("Initial,");
658  outputColumns.push_back("Correction,");
659  outputColumns.push_back("Final,");
660  outputColumns.push_back("Apriori Sigma,");
661  outputColumns.push_back("Adj Sigma,");
662  }
663 
664  // print second column header to buffer and output to file
665  ncolumns = outputColumns.size();
666  for (int i = 0; i < ncolumns; i++) {
667  QString str = outputColumns.at(i);
668  sprintf(buf, "%s", (const char*)str.toLatin1().data());
669  fpOut << buf;
670  }
671  sprintf(buf, "\n");
672  fpOut << buf;
673 
674  return true;
675  }
676 
677 
678 
691  bool BundleSolutionInfo::outputHeader(std::ofstream &fpOut) {
692 
693  if (!fpOut) {
694  return false;
695  }
696 
697  char buf[1056];
698  int numObservations = m_statisticsResults->observations().size();
699  int numImages = 0;
700  for (int i = 0; i < numObservations; i++) {
701  numImages += m_statisticsResults->observations().at(i)->size();
702  }
703  int numValidPoints = m_statisticsResults->outputControlNet()->GetNumValidPoints();
704  int numInnerConstraints = 0;
705  int numDistanceConstraints = 0;
706  int numDegreesOfFreedom = m_statisticsResults->numberObservations()
711 
712  int convergenceCriteria = 1;
713 
714  sprintf(buf, "JIGSAW: BUNDLE ADJUSTMENT\n=========================\n");
715  fpOut << buf;
716  sprintf(buf, "\n Run Time: %s",
717  Isis::iTime::CurrentLocalTime().toLatin1().data());
718  fpOut << buf;
719  sprintf(buf, "\n Network Filename: %s",
720  m_controlNetworkFileName->expanded().toLatin1().data());
721  fpOut << buf;
722  sprintf(buf, "\n Network Id: %s",
723  m_statisticsResults->outputControlNet()->GetNetworkId().toLatin1().data());
724  fpOut << buf;
725  sprintf(buf, "\n Network Description: %s",\
726  m_statisticsResults->outputControlNet()->Description().toLatin1().data());
727  fpOut << buf;
728  sprintf(buf, "\n Target: %s",
729  m_statisticsResults->outputControlNet()->GetTarget().toLatin1().data());
730  fpOut << buf;
731  sprintf(buf, "\n\n Linear Units: kilometers");
732  fpOut << buf;
733  sprintf(buf, "\n Angular Units: decimal degrees");
734  fpOut << buf;
735  sprintf(buf, "\n\nINPUT: SOLVE OPTIONS\n====================\n");
736  fpOut << buf;
737 
738  m_settings->solveObservationMode() ?
739  sprintf(buf, "\n OBSERVATIONS: ON"):
740  sprintf(buf, "\n OBSERVATIONS: OFF");
741  fpOut << buf;
742 
743  m_settings->solveRadius() ?
744  sprintf(buf, "\n RADIUS: ON"):
745  sprintf(buf, "\n RADIUS: OFF");
746  fpOut << buf;
747 
748  m_settings->solveTargetBody() ?
749  sprintf(buf, "\n TARGET BODY: ON"):
750  sprintf(buf, "\n TARGET BODY: OFF");
751  fpOut << buf;
752 
753  m_settings->updateCubeLabel() ?
754  sprintf(buf, "\n UPDATE: YES"):
755  sprintf(buf, "\n UPDATE: NO");
756  fpOut << buf;
757 
758  m_settings->errorPropagation() ?
759  sprintf(buf, "\n ERROR PROPAGATION: ON"):
760  sprintf(buf, "\n ERROR PROPAGATION: OFF");
761  fpOut << buf;
762 
763  if (m_settings->outlierRejection()) {
764  sprintf(buf, "\n OUTLIER REJECTION: ON");
765  fpOut << buf;
766  sprintf(buf, "\n REJECTION MULTIPLIER: %lf",
767  m_settings->outlierRejectionMultiplier());
768  fpOut << buf;
769 
770  }
771  else {
772  sprintf(buf, "\n OUTLIER REJECTION: OFF");
773  fpOut << buf;
774  sprintf(buf, "\n REJECTION MULTIPLIER: N/A");
775  fpOut << buf;
776  }
777 
778  sprintf(buf, "\n\nMAXIMUM LIKELIHOOD ESTIMATION\n============================\n");
779  fpOut << buf;
780 
781  for (int tier = 0; tier < 3; tier++) {
782  if (tier < m_statisticsResults->numberMaximumLikelihoodModels()) {
783  sprintf(buf, "\n Tier %d Enabled: TRUE", tier);
784  fpOut << buf;
785  sprintf(buf, "\n Maximum Likelihood Model: %s",
788  maximumLikelihoodModelWFunc(tier).model()).toLatin1().data());
789  fpOut << buf;
790  sprintf(buf, "\n Quantile used for tweaking constant: %lf",
792  fpOut << buf;
793  sprintf(buf, "\n Quantile weighted R^2 Residual value: %lf",
795  fpOut << buf;
796  sprintf(buf, "\n Approx. weighted Residual cutoff: %s",
798  .weightedResidualCutoff().toLatin1().data());
799  fpOut << buf;
800  if (tier != 2) fpOut << "\n";
801  }
802  else {
803  sprintf(buf, "\n Tier %d Enabled: FALSE", tier);
804  fpOut << buf;
805  }
806  }
807 
808  sprintf(buf, "\n\nINPUT: CONVERGENCE CRITERIA\n===========================\n");
809  fpOut << buf;
810  sprintf(buf, "\n SIGMA0: %e",
811  m_settings->convergenceCriteriaThreshold());
812  fpOut << buf;
813  sprintf(buf, "\n MAXIMUM ITERATIONS: %d",
814  m_settings->convergenceCriteriaMaximumIterations());
815  fpOut << buf;
816 
817  //TODO Should it be checked that positionSigmas.size() == positionSolveDegree and
818  // pointingSigmas.size() == pointingSolveDegree somewhere? JAM
819 
820  //TODO How do we output this information when using multiple solve settings? JAM
821 
822  BundleObservationSolveSettings globalSettings = m_settings->observationSolveSettings(0);
823  int pointingSolveDegree = globalSettings.numberCameraAngleCoefficientsSolved();
824  QList<double> pointingSigmas = globalSettings.aprioriPointingSigmas();
825  int positionSolveDegree = globalSettings.numberCameraPositionCoefficientsSolved();
826  QList<double> positionSigmas = globalSettings.aprioriPositionSigmas();
827 
828  sprintf(buf, "\n\nINPUT: CAMERA POINTING OPTIONS\n==============================\n");
829  fpOut << buf;
830  switch (pointingSolveDegree) {
831  case 0:
832  sprintf(buf,"\n CAMSOLVE: NONE");
833  break;
834  case 1:
835  sprintf(buf,"\n CAMSOLVE: ANGLES");
836  break;
837  case 2:
838  sprintf(buf,"\n CAMSOLVE: ANGLES, VELOCITIES");
839  break;
840  case 3:
841  sprintf(buf,"\n CAMSOLVE: ANGLES, VELOCITIES, ACCELERATIONS");
842  break;
843  default:
844  sprintf(buf,"\n CAMSOLVE: ALL POLYNOMIAL COEFFICIENTS (%d)"
845  "\n CKDEGREE: %d"
846  "\n CKSOLVEDEGREE: %d",
847  pointingSolveDegree,
848  globalSettings.ckDegree(),
849  globalSettings.ckSolveDegree());
850  break;
851  }
852  fpOut << buf;
853  globalSettings.solveTwist() ?
854  sprintf(buf, "\n TWIST: ON"):
855  sprintf(buf, "\n TWIST: OFF");
856  fpOut << buf;
857  globalSettings.solvePolyOverPointing() ?
858  sprintf(buf, "\n POLYNOMIAL OVER EXISTING POINTING: ON"):
859  sprintf(buf, "\nPOLYNOMIAL OVER EXISTING POINTING : OFF");
860  fpOut << buf;
861 
862  sprintf(buf, "\n\nINPUT: SPACECRAFT OPTIONS\n=========================\n");
863  fpOut << buf;
864  switch (positionSolveDegree) {
865  case 0:
866  sprintf(buf,"\n SPSOLVE: NONE");
867  break;
868  case 1:
869  sprintf(buf,"\n SPSOLVE: POSITION");
870  break;
871  case 2:
872  sprintf(buf,"\n SPSOLVE: POSITION, VELOCITIES");
873  break;
874  case 3:
875  sprintf(buf,"\n SPSOLVE: POSITION, VELOCITIES, ACCELERATIONS");
876  break;
877  default:
878  sprintf(buf,"\n SPSOLVE: ALL POLYNOMIAL COEFFICIENTS (%d)"
879  "\n SPKDEGREE: %d"
880  "\n SPKSOLVEDEGREE: %d",
881  positionSolveDegree,
882  globalSettings.spkDegree(),
883  globalSettings.spkSolveDegree());
884  break;
885  }
886  fpOut << buf;
887  globalSettings.solvePositionOverHermite() ?
888  sprintf(buf, "\n POLYNOMIAL OVER HERMITE SPLINE: ON"):
889  sprintf(buf, "\nPOLYNOMIAL OVER HERMITE SPLINE : OFF");
890  fpOut << buf;
891 
892  sprintf(buf, "\n\nINPUT: GLOBAL IMAGE PARAMETER UNCERTAINTIES\n===========================================\n");
893  fpOut << buf;
894  (m_settings->globalLatitudeAprioriSigma() == Isis::Null) ?
895  sprintf(buf,"\n POINT LATITUDE SIGMA: N/A"):
896  sprintf(buf,"\n POINT LATITUDE SIGMA: %lf (meters)",
897  m_settings->globalLatitudeAprioriSigma());
898  fpOut << buf;
899  (m_settings->globalLongitudeAprioriSigma() == Isis::Null) ?
900  sprintf(buf,"\n POINT LONGITUDE SIGMA: N/A"):
901  sprintf(buf,"\n POINT LONGITUDE SIGMA: %lf (meters)",
902  m_settings->globalLongitudeAprioriSigma());
903  fpOut << buf;
904  (m_settings->globalRadiusAprioriSigma() == Isis::Null) ?
905  sprintf(buf,"\n POINT RADIUS SIGMA: N/A"):
906  sprintf(buf,"\n POINT RADIUS SIGMA: %lf (meters)",
907  m_settings->globalRadiusAprioriSigma());
908  fpOut << buf;
909  (positionSolveDegree < 1 || positionSigmas[0] == Isis::Null) ?
910  sprintf(buf,"\n SPACECRAFT POSITION SIGMA: N/A"):
911  sprintf(buf,"\n SPACECRAFT POSITION SIGMA: %lf (meters)",
912  positionSigmas[0]);
913  fpOut << buf;
914 
915  (positionSolveDegree < 2 || positionSigmas[1] == Isis::Null) ?
916  sprintf(buf,"\n SPACECRAFT VELOCITY SIGMA: N/A"):
917  sprintf(buf,"\n SPACECRAFT VELOCITY SIGMA: %lf (m/s)",
918  positionSigmas[1]);
919  fpOut << buf;
920 
921  (positionSolveDegree < 3 || positionSigmas[2] == Isis::Null) ?
922  sprintf(buf,"\n SPACECRAFT ACCELERATION SIGMA: N/A"):
923  sprintf(buf,"\n SPACECRAFT ACCELERATION SIGMA: %lf (m/s/s)",
924  positionSigmas[2]);
925  fpOut << buf;
926 
927  (pointingSolveDegree < 1 || pointingSigmas[0] == Isis::Null) ?
928  sprintf(buf,"\n CAMERA ANGLES SIGMA: N/A"):
929  sprintf(buf,"\n CAMERA ANGLES SIGMA: %lf (dd)",
930  pointingSigmas[0]);
931  fpOut << buf;
932 
933  (pointingSolveDegree < 2 || pointingSigmas[1] == Isis::Null) ?
934  sprintf(buf,"\n CAMERA ANGULAR VELOCITY SIGMA: N/A"):
935  sprintf(buf,"\n CAMERA ANGULAR VELOCITY SIGMA: %lf (dd/s)",
936  pointingSigmas[1]);
937  fpOut << buf;
938 
939  (pointingSolveDegree < 3 || pointingSigmas[2] == Isis::Null) ?
940  sprintf(buf,"\n CAMERA ANGULAR ACCELERATION SIGMA: N/A"):
941  sprintf(buf,"\n CAMERA ANGULAR ACCELERATION SIGMA: %lf (dd/s/s)",
942  pointingSigmas[2]);
943  fpOut << buf;
944 
945  if (m_settings->solveTargetBody()) {
946  sprintf(buf, "\n\nINPUT: TARGET BODY OPTIONS\n==============================\n");
947  fpOut << buf;
948 
949  if (m_settings->solvePoleRA() && m_settings->solvePoleDec()) {
950  sprintf(buf,"\n POLE: RIGHT ASCENSION");
951  fpOut << buf;
952  sprintf(buf,"\n : DECLINATION\n");
953  fpOut << buf;
954  }
955  else if (m_settings->solvePoleRA()) {
956  sprintf(buf,"\n POLE: RIGHT ASCENSION\n");
957  fpOut << buf;
958  }
959  else if (m_settings->solvePoleDec()) {
960  sprintf(buf,"\n POLE: DECLINATION\n");
961  fpOut << buf;
962  }
963 
964  if (m_settings->solvePM() || m_settings->solvePMVelocity()
965  || m_settings->solvePMAcceleration()) {
966  sprintf(buf,"\n PRIME MERIDIAN: W0 (OFFSET)");
967  fpOut << buf;
968 
969  if (m_settings->solvePMVelocity()) {
970  sprintf(buf,"\n : WDOT (SPIN RATE)");
971  fpOut << buf;
972  }
973  if (m_settings->solvePMAcceleration()) {
974  sprintf(buf,"\n :W ACCELERATION");
975  fpOut << buf;
976  }
977  }
978 
979  if (m_settings->solveTriaxialRadii() || m_settings->solveMeanRadius()) {
980  if (m_settings->solveMeanRadius()) {
981  sprintf(buf,"\n RADII: MEAN");
982  fpOut << buf;
983  }
984  else if (m_settings->solveTriaxialRadii()) {
985  sprintf(buf,"\n RADII: TRIAXIAL");
986  fpOut << buf;
987  }
988  }
989  }
990 
991  sprintf(buf, "\n\nJIGSAW: RESULTS\n===============\n");
992  fpOut << buf;
993  sprintf(buf, "\n Images: %6d",numImages);
994  fpOut << buf;
995  sprintf(buf, "\n Points: %6d",numValidPoints);
996  fpOut << buf;
997 
998  sprintf(buf, "\n Total Measures: %6d",
1001  fpOut << buf;
1002 
1003  sprintf(buf, "\n Total Observations: %6d",
1006  fpOut << buf;
1007 
1008  sprintf(buf, "\n Good Observations: %6d",
1010  fpOut << buf;
1011 
1012  sprintf(buf, "\n Rejected Observations: %6d",
1014  fpOut << buf;
1015 
1017  sprintf(buf, "\n Constrained Point Parameters: %6d",
1019  fpOut << buf;
1020  }
1021 
1023  sprintf(buf, "\n Constrained Image Parameters: %6d",
1025  fpOut << buf;
1026  }
1027 
1029  sprintf(buf, "\n Constrained Target Parameters: %6d",
1031  fpOut << buf;
1032  }
1033 
1034  sprintf(buf, "\n Unknowns: %6d",
1036  fpOut << buf;
1037 
1038  if (numInnerConstraints > 0) {
1039  sprintf(buf, "\n Inner Constraints: %6d", numInnerConstraints);
1040  fpOut << buf;
1041  }
1042 
1043  if (numDistanceConstraints > 0) {
1044  sprintf(buf, "\n Distance Constraints: %d", numDistanceConstraints);
1045  fpOut << buf;
1046  }
1047 
1048  sprintf(buf, "\n Degrees of Freedom: %6d", numDegreesOfFreedom);
1049  fpOut << buf;
1050 
1051  sprintf(buf, "\n Convergence Criteria: %6.3g",
1052  m_settings->convergenceCriteriaThreshold());
1053  fpOut << buf;
1054 
1055  if (convergenceCriteria == 1) {
1056  sprintf(buf, "(Sigma0)");
1057  fpOut << buf;
1058  }
1059 
1060  sprintf(buf, "\n Iterations: %6d", m_statisticsResults->iterations());
1061  fpOut << buf;
1062 
1063  if (m_statisticsResults->iterations() >= m_settings->convergenceCriteriaMaximumIterations()) {
1064  sprintf(buf, "(Maximum reached)");
1065  fpOut << buf;
1066  }
1067 
1068  sprintf(buf, "\n Sigma0: %30.20lf\n", m_statisticsResults->sigma0());
1069  fpOut << buf;
1070  sprintf(buf, " Error Propagation Elapsed Time: %6.4lf (seconds)\n",
1072  fpOut << buf;
1073  sprintf(buf, " Total Elapsed Time: %6.4lf (seconds)\n",
1075  fpOut << buf;
1078  > 100) {
1079  sprintf(buf, "\n Residual Percentiles:\n");
1080  fpOut << buf;
1081 
1082  // residual prob distribution values are calculated/printed
1083  // even if there is no maximum likelihood estimation
1084  try {
1085  for (int bin = 1;bin < 34;bin++) {
1086  double cumProb = double(bin) / 100.0;
1087  double resValue =
1089  residualsCumulativeProbabilityDistribution().value(cumProb);
1090  double resValue33 =
1092  residualsCumulativeProbabilityDistribution().value(cumProb + 0.33);
1093  double resValue66 =
1095  residualsCumulativeProbabilityDistribution().value(cumProb + 0.66);
1096  sprintf(buf, " Percentile %3d: %+8.3lf"
1097  " Percentile %3d: %+8.3lf"
1098  " Percentile %3d: %+8.3lf\n",
1099  bin, resValue,
1100  bin + 33, resValue33,
1101  bin + 66, resValue66);
1102  fpOut << buf;
1103  }
1104  }
1105  catch (IException &e) {
1106  QString msg = "Failed to output residual percentiles for bundleout";
1107  throw IException(e, IException::Io, msg, _FILEINFO_);
1108  }
1109  try {
1110  sprintf(buf, "\n Residual Box Plot:");
1111  fpOut << buf;
1112  sprintf(buf, "\n minimum: %+8.3lf",
1114  fpOut << buf;
1115  sprintf(buf, "\n Quartile 1: %+8.3lf",
1117  fpOut << buf;
1118  sprintf(buf, "\n Median: %+8.3lf",
1120  fpOut << buf;
1121  sprintf(buf, "\n Quartile 3: %+8.3lf",
1123  fpOut << buf;
1124  sprintf(buf, "\n maximum: %+8.3lf\n",
1126  fpOut << buf;
1127  }
1128  catch (IException &e) {
1129  QString msg = "Failed to output residual box plot for bundleout";
1130  throw IException(e, IException::Io, msg, _FILEINFO_);
1131  }
1132  }
1133 
1134  sprintf(buf, "\nIMAGE MEASURES SUMMARY\n==========================\n\n");
1135  fpOut << buf;
1136 
1137  int numMeasures;
1138  int numRejectedMeasures;
1139  int numUsed;
1140  int imageIndex = 0;
1141 
1142  for (int i = 0; i < numObservations; i++) {
1143 
1144  int numImagesInObservation = m_statisticsResults->observations().at(i)->size();
1145 
1146  for (int j = 0; j < numImagesInObservation; j++) {
1147 
1148  BundleImageQsp bundleImage = m_statisticsResults->observations().at(i)->at(j);
1149 
1150  double rmsSampleResiduals = m_statisticsResults->
1151  rmsImageSampleResiduals()[imageIndex].Rms();
1152  double rmsLineResiduals = m_statisticsResults->
1153  rmsImageLineResiduals()[imageIndex].Rms();
1154  double rmsLandSResiduals = m_statisticsResults->
1155  rmsImageResiduals()[imageIndex].Rms();
1156 
1157  numMeasures = m_statisticsResults->outputControlNet()->
1158  GetNumberOfValidMeasuresInImage(
1159  bundleImage->serialNumber());
1160 
1161  numRejectedMeasures = m_statisticsResults->outputControlNet()->
1162  GetNumberOfJigsawRejectedMeasuresInImage(
1163  bundleImage->serialNumber());
1164 
1165  numUsed = numMeasures - numRejectedMeasures;
1166 
1167  if (numUsed == numMeasures) {
1168  sprintf(buf, "%s %5d of %5d %6.3lf %6.3lf %6.3lf\n",
1169  bundleImage->fileName().toLatin1().data(),
1170  (numMeasures-numRejectedMeasures), numMeasures,
1171  rmsSampleResiduals, rmsLineResiduals, rmsLandSResiduals);
1172  }
1173  else {
1174  sprintf(buf, "%s %5d of %5d* %6.3lf %6.3lf %6.3lf\n",
1175  bundleImage->fileName().toLatin1().data(),
1176  (numMeasures-numRejectedMeasures), numMeasures,
1177  rmsSampleResiduals, rmsLineResiduals, rmsLandSResiduals);
1178  }
1179  fpOut << buf;
1180  imageIndex++;
1181  }
1182  }
1183 
1184  return true;
1185  }
1186 
1187 
1200 
1201  char buf[1056];
1202  int imgIndex = 0;
1203 
1204  QList<Statistics> rmsImageSampleResiduals = m_statisticsResults->rmsImageSampleResiduals();
1205  QList<Statistics> rmsImageLineResiduals = m_statisticsResults->rmsImageLineResiduals();
1207 
1208  QString ofname = "bundleout_images.csv";
1209  ofname = m_settings->outputFilePrefix() + ofname;
1210 
1211  std::ofstream fpOut(ofname.toLatin1().data(), std::ios::out);
1212  if (!fpOut) {
1213  return false;
1214  }
1215 
1216 
1217  BundleObservationQsp observation;
1218 
1219  int nObservations = m_statisticsResults->observations().size();
1220 
1221  outputImagesCSVHeader(fpOut);
1222 
1223  bool errorProp = false;
1224  if (m_statisticsResults->converged() && m_settings->errorPropagation()) {
1225  errorProp = true;
1226  }
1227 
1228  for (int i = 0; i < nObservations;i++ ) {
1229  observation = m_statisticsResults->observations().at(i);
1230 
1231  if(!observation) {
1232  continue;
1233  }
1234 
1235  int numImages = observation->size();
1236 
1237  for (int j = 0; j < numImages; j++) {
1238 
1239  BundleImageQsp image = observation->at(j);
1240 
1241 
1242  sprintf(buf, "%s", image->fileName().toLatin1().data());
1243  fpOut << buf;
1244  sprintf(buf,",");
1245  fpOut << buf;
1246 
1247  fpOut << toString(rmsImageSampleResiduals[imgIndex].Rms()).toLatin1().data();
1248  sprintf(buf,",");
1249  fpOut << buf;
1250 
1251  fpOut << toString(rmsImageLineResiduals[imgIndex].Rms()).toLatin1().data();
1252  sprintf(buf,",");
1253  fpOut << buf;
1254 
1255  fpOut << toString(rmsImageResiduals[imgIndex].Rms()).toLatin1().data();
1256  sprintf(buf,",");
1257  fpOut << buf;
1258 
1259 
1260  QString observationString =
1261  observation->formatBundleOutputString(errorProp,true);
1262 
1263  //Removes trailing commas
1264  if (observationString.right(1)==",") {
1265  observationString.truncate(observationString.length()-1);
1266  }
1267 
1268  fpOut << (const char*) observationString.toLatin1().data();
1269  sprintf(buf,"\n");
1270  fpOut << buf;
1271  imgIndex++;
1272 
1273  }
1274  }
1275 
1276  fpOut.close();
1277  return true;
1278  }
1279 
1280 
1281 
1288 
1289  QString ofname = "bundleout.txt";
1290  ofname = m_settings->outputFilePrefix() + ofname;
1291 
1292  std::ofstream fpOut(ofname.toLatin1().data(), std::ios::out);
1293  if (!fpOut) {
1294  return false;
1295  }
1296 
1297  char buf[1056];
1298  BundleObservationQsp observation;
1299 
1300  int nObservations = m_statisticsResults->observations().size();
1301 
1302  outputHeader(fpOut);
1303 
1304  bool berrorProp = false;
1305  if (m_statisticsResults->converged() && m_settings->errorPropagation()) {
1306  berrorProp = true;
1307  }
1308 
1309  // output target body header if solving for target
1310  if (m_settings->solveTargetBody()) {
1311  sprintf(buf, "\nTARGET BODY\n==========================\n");
1312  fpOut << buf;
1313 
1314  sprintf(buf, "\n Target Initial Total "
1315  "Final Initial Final\n"
1316  "Parameter Value Correction "
1317  "Value Accuracy Accuracy\n");
1318  fpOut << buf;
1319 
1320  QString targetString =
1321  m_settings->bundleTargetBody()->formatBundleOutputString(berrorProp);
1322  fpOut << (const char*)targetString.toLatin1().data();
1323  }
1324 
1325  // output image exterior orientation header
1326  sprintf(buf, "\nIMAGE EXTERIOR ORIENTATION\n==========================\n");
1327  fpOut << buf;
1328 
1329  QMap<QString, QStringList> imagesAndParameters;
1330 
1331  if (m_settings->solveTargetBody()) {
1332  imagesAndParameters.insert( "target", m_settings->bundleTargetBody()->parameterList() );
1333  }
1334 
1335  for (int i = 0; i < nObservations; i++) {
1336 
1337  observation = m_statisticsResults->observations().at(i);
1338  if (!observation) {
1339  continue;
1340  }
1341 
1342  int numImages = observation->size();
1343  for (int j = 0; j < numImages; j++) {
1344  BundleImageQsp image = observation->at(j);
1345  sprintf(buf, "\nImage Full File Name: %s\n", image->fileName().toLatin1().data());
1346  fpOut << buf;
1347  sprintf(buf, "\nImage Serial Number: %s\n", image->serialNumber().toLatin1().data());
1348  fpOut << buf;
1349 
1350  sprintf(buf, "\n Image Initial Total "
1351  "Final Initial Final\n"
1352  "Parameter Value Correction "
1353  "Value Accuracy Accuracy\n");
1354  fpOut << buf;
1355 
1356  QString observationString =
1357  observation->formatBundleOutputString(berrorProp);
1358  fpOut << (const char*)observationString.toLatin1().data();
1359 
1360  // Build list of images and parameters for correlation matrix.
1361  foreach ( QString image, observation->imageNames() ) {
1362  imagesAndParameters.insert( image, observation->parameterList() );
1363  }
1364  }
1365  }
1366 
1367  // Save list of images and their associated parameters for CorrelationMatrix to use in ice.
1368  m_statisticsResults->setCorrMatImgsAndParams(imagesAndParameters);
1369 
1370  // Save list of images and their associated parameters for CorrelationMatrix to use in ice.
1371  m_statisticsResults->setCorrMatImgsAndParams(imagesAndParameters);
1372 
1373  // output point uncertainty statistics if error propagation is on
1374  if (berrorProp) {
1375  sprintf(buf, "\n\n\nPOINTS UNCERTAINTY SUMMARY\n==========================\n\n");
1376  fpOut << buf;
1377  sprintf(buf, " RMS Sigma Latitude(m)%20.8lf\n",
1379  fpOut << buf;
1380  sprintf(buf, " MIN Sigma Latitude(m)%20.8lf at %s\n",
1382  m_statisticsResults->minSigmaLatitudePointId().toLatin1().data());
1383  fpOut << buf;
1384  sprintf(buf, " MAX Sigma Latitude(m)%20.8lf at %s\n\n",
1386  m_statisticsResults->maxSigmaLatitudePointId().toLatin1().data());
1387  fpOut << buf;
1388  sprintf(buf, "RMS Sigma Longitude(m)%20.8lf\n",
1390  fpOut << buf;
1391  sprintf(buf, "MIN Sigma Longitude(m)%20.8lf at %s\n",
1393  m_statisticsResults->minSigmaLongitudePointId().toLatin1().data());
1394  fpOut << buf;
1395  sprintf(buf, "MAX Sigma Longitude(m)%20.8lf at %s\n\n",
1397  m_statisticsResults->maxSigmaLongitudePointId().toLatin1().data());
1398  fpOut << buf;
1399  if ( m_settings->solveRadius() ) {
1400  sprintf(buf, " RMS Sigma Radius(m)%20.8lf\n",
1402  fpOut << buf;
1403  sprintf(buf, " MIN Sigma Radius(m)%20.8lf at %s\n",
1405  m_statisticsResults->minSigmaRadiusPointId().toLatin1().data());
1406  fpOut << buf;
1407  sprintf(buf, " MAX Sigma Radius(m)%20.8lf at %s\n",
1409  m_statisticsResults->maxSigmaRadiusPointId().toLatin1().data());
1410  fpOut << buf;
1411  }
1412  else {
1413  sprintf(buf, " RMS Sigma Radius(m) N/A\n");
1414  fpOut << buf;
1415  sprintf(buf, " MIN Sigma Radius(m) N/A\n");
1416  fpOut << buf;
1417  sprintf(buf, " MAX Sigma Radius(m) N/A\n");
1418  fpOut << buf;
1419  }
1420  }
1421 
1422  // output point summary data header
1423  sprintf(buf, "\n\nPOINTS SUMMARY\n==============\n%103s"
1424  "Sigma Sigma Sigma\n"
1425  " Label Status Rays RMS"
1426  " Latitude Longitude Radius"
1427  " Latitude Longitude Radius\n", "");
1428  fpOut << buf;
1429 
1430  int nPoints = m_statisticsResults->bundleControlPoints().size();
1431  for (int i = 0; i < nPoints; i++) {
1432  BundleControlPointQsp bundleControlPoint = m_statisticsResults->bundleControlPoints().at(i);
1433 
1434  QString pointSummaryString =
1435  bundleControlPoint->formatBundleOutputSummaryString(berrorProp);
1436  fpOut << (const char*)pointSummaryString.toLatin1().data();
1437  }
1438 
1439  // output point detail data header
1440  sprintf(buf, "\n\nPOINTS DETAIL\n=============\n\n");
1441  fpOut << buf;
1442 
1443  bool solveRadius = m_settings->solveRadius();
1444 
1445  for (int i = 0; i < nPoints; i++) {
1446  BundleControlPointQsp bundleControlPoint = m_statisticsResults->bundleControlPoints().at(i);
1447 
1448  QString pointDetailString =
1449  bundleControlPoint->formatBundleOutputDetailString(berrorProp,
1451  solveRadius);
1452  fpOut << (const char*)pointDetailString.toLatin1().data();
1453  }
1454 
1455  fpOut.close();
1456 
1457  return true;
1458  }
1459 
1460 
1467  char buf[1056];
1468 
1469  QString ofname = "bundleout_points.csv";
1470  ofname = m_settings->outputFilePrefix() + ofname;
1471 
1472  std::ofstream fpOut(ofname.toLatin1().data(), std::ios::out);
1473  if (!fpOut) {
1474  return false;
1475  }
1476 
1477  int numPoints = m_statisticsResults->bundleControlPoints().size();
1478 
1479  double dLat, dLon, dRadius;
1480  double dX, dY, dZ;
1481  double dSigmaLat, dSigmaLong, dSigmaRadius;
1482  QString strStatus;
1483  double cor_lat_m;
1484  double cor_lon_m;
1485  double cor_rad_m;
1486  int numMeasures, numRejectedMeasures;
1487  double dResidualRms;
1488 
1489  // print column headers
1490  if (m_settings->errorPropagation()) {
1491  sprintf(buf, "Point,Point,Accepted,Rejected,Residual,3-d,3-d,3-d,Sigma,"
1492  "Sigma,Sigma,Correction,Correction,Correction,Coordinate,"
1493  "Coordinate,Coordinate\nID,,,,,Latitude,Longitude,Radius,"
1494  "Latitude,Longitude,Radius,Latitude,Longitude,Radius,X,Y,Z\n"
1495  "Label,Status,Measures,Measures,RMS,(dd),(dd),(km),(m),(m),(m),"
1496  "(m),(m),(m),(km),(km),(km)\n");
1497  }
1498  else {
1499  sprintf(buf, "Point,Point,Accepted,Rejected,Residual,3-d,3-d,3-d,"
1500  "Correction,Correction,Correction,Coordinate,Coordinate,"
1501  "Coordinate\n,,,,,Latitude,Longitude,Radius,Latitude,"
1502  "Longitude,Radius,X,Y,Z\nLabel,Status,Measures,Measures,"
1503  "RMS,(dd),(dd),(km),(m),(m),(m),(km),(km),(km)\n");
1504  }
1505  fpOut << buf;
1506 
1507  for (int i = 0; i < numPoints; i++) {
1508  BundleControlPointQsp bundlecontrolpoint = m_statisticsResults->bundleControlPoints().at(i);
1509 
1510  if (!bundlecontrolpoint) {
1511  continue;
1512  }
1513 
1514  if (bundlecontrolpoint->isRejected()) {
1515  continue;
1516  }
1517 
1518  dLat = bundlecontrolpoint->adjustedSurfacePoint().GetLatitude().degrees();
1519  dLon = bundlecontrolpoint->adjustedSurfacePoint().GetLongitude().degrees();
1520  dRadius = bundlecontrolpoint->adjustedSurfacePoint().GetLocalRadius().kilometers();
1521  dX = bundlecontrolpoint->adjustedSurfacePoint().GetX().kilometers();
1522  dY = bundlecontrolpoint->adjustedSurfacePoint().GetY().kilometers();
1523  dZ = bundlecontrolpoint->adjustedSurfacePoint().GetZ().kilometers();
1524  numMeasures = bundlecontrolpoint->numberOfMeasures();
1525  numRejectedMeasures = bundlecontrolpoint->numberOfRejectedMeasures();
1526  dResidualRms = bundlecontrolpoint->residualRms();
1527 
1528  // point corrections and initial sigmas
1529  boost::numeric::ublas::bounded_vector< double, 3 > corrections = bundlecontrolpoint->
1530  corrections();
1531  cor_lat_m = corrections[0]*m_statisticsResults->radiansToMeters();
1532  cor_lon_m = corrections[1]*m_statisticsResults->radiansToMeters()*cos(dLat*Isis::DEG2RAD);
1533  cor_rad_m = corrections[2]*1000.0;
1534 
1535  if (bundlecontrolpoint->type() == ControlPoint::Fixed) {
1536  strStatus = "FIXED";
1537  }
1538  else if (bundlecontrolpoint->type() == ControlPoint::Constrained) {
1539  strStatus = "CONSTRAINED";
1540  }
1541  else if (bundlecontrolpoint->type() == ControlPoint::Free) {
1542  strStatus = "FREE";
1543  }
1544  else {
1545  strStatus = "UNKNOWN";
1546  }
1547 
1548  if (m_settings->errorPropagation()) {
1549  dSigmaLat = bundlecontrolpoint->adjustedSurfacePoint().GetLatSigmaDistance().meters();
1550  dSigmaLong = bundlecontrolpoint->adjustedSurfacePoint().GetLonSigmaDistance().meters();
1551  dSigmaRadius = bundlecontrolpoint->adjustedSurfacePoint().GetLocalRadiusSigma().meters();
1552 
1553  sprintf(buf, "%s,%s,%d,%d,%6.2lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,"
1554  "%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf\n",
1555  bundlecontrolpoint->id().toLatin1().data(), strStatus.toLatin1().data(),
1556  numMeasures, numRejectedMeasures, dResidualRms, dLat, dLon, dRadius, dSigmaLat,
1557  dSigmaLong, dSigmaRadius, cor_lat_m, cor_lon_m, cor_rad_m, dX, dY, dZ);
1558  }
1559  else
1560  sprintf(buf, "%s,%s,%d,%d,%6.2lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,"
1561  "%16.8lf,%16.8lf\n",
1562  bundlecontrolpoint->id().toLatin1().data(), strStatus.toLatin1().data(),
1563  numMeasures, numRejectedMeasures, dResidualRms, dLat, dLon, dRadius, cor_lat_m,
1564  cor_lon_m, cor_rad_m, dX, dY, dZ);
1565 
1566  fpOut << buf;
1567  }
1568 
1569  fpOut.close();
1570 
1571  return true;
1572  }
1573 
1574 
1581  char buf[1056];
1582 
1583  QString ofname = "residuals.csv";
1584  ofname = m_settings->outputFilePrefix() + ofname;
1585 
1586  std::ofstream fpOut(ofname.toLatin1().data(), std::ios::out);
1587  if (!fpOut) {
1588  return false;
1589  }
1590 
1591  // output column headers
1592 
1593  sprintf(buf, ",,,x image,y image,Measured,Measured,sample,line,Residual Vector\n");
1594  fpOut << buf;
1595  sprintf(buf, "Point,Image,Image,coordinate,coordinate,"
1596  "Sample,Line,residual,residual,Magnitude\n");
1597  fpOut << buf;
1598  sprintf(buf, "Label,Filename,Serial Number,(mm),(mm),"
1599  "(pixels),(pixels),(pixels),(pixels),(pixels),Rejected\n");
1600  fpOut << buf;
1601 
1602  // Setup counts and pointers
1603 
1604  int numPoints = m_statisticsResults->bundleControlPoints().size();
1605  int numMeasures = 0;
1606 
1607  BundleControlPointQsp bundleControlPoint;
1608  BundleMeasureQsp bundleMeasure;
1609 
1610  for (int i = 0; i < numPoints; i++) {
1611  bundleControlPoint = m_statisticsResults->bundleControlPoints().at(i);
1612  numMeasures = bundleControlPoint->size();
1613 
1614  if (bundleControlPoint->rawControlPoint()->IsIgnored()) {
1615  continue;
1616  }
1617 
1618  for (int j = 0; j < numMeasures; j++) {
1619  bundleMeasure = bundleControlPoint->at(j);
1620 
1621  Camera *measureCamera = bundleMeasure->camera();
1622  if (!measureCamera) {
1623  continue;
1624  }
1625 
1626  if (bundleMeasure->isRejected()) {
1627  sprintf(buf, "%s,%s,%s,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,*\n",
1628  bundleControlPoint->id().toLatin1().data(),
1629  bundleMeasure->parentBundleImage()->fileName().toLatin1().data(),
1630  bundleMeasure->cubeSerialNumber().toLatin1().data(),
1631  bundleMeasure->focalPlaneMeasuredX(),
1632  bundleMeasure->focalPlaneMeasuredY(),
1633  bundleMeasure->sample(),
1634  bundleMeasure->line(),
1635  bundleMeasure->sampleResidual(),
1636  bundleMeasure->lineResidual(),
1637  bundleMeasure->residualMagnitude());
1638  }
1639  else {
1640  sprintf(buf, "%s,%s,%s,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf,%16.8lf\n",
1641  bundleControlPoint->id().toLatin1().data(),
1642  bundleMeasure->parentBundleImage()->fileName().toLatin1().data(),
1643  bundleMeasure->cubeSerialNumber().toLatin1().data(),
1644  bundleMeasure->focalPlaneMeasuredX(),
1645  bundleMeasure->focalPlaneMeasuredY(),
1646  bundleMeasure->sample(),
1647  bundleMeasure->line(),
1648  bundleMeasure->sampleResidual(),
1649  bundleMeasure->lineResidual(),
1650  bundleMeasure->residualMagnitude());
1651  }
1652  fpOut << buf;
1653  }
1654  }
1655 
1656  fpOut.close();
1657 
1658  return true;
1659  }
1660 
1661 
1669  QDataStream &BundleSolutionInfo::write(QDataStream &stream) const {
1670  stream << m_id->toString()
1671  << m_runTime
1672  << m_controlNetworkFileName->expanded()
1673  << *m_settings
1674  << *m_statisticsResults;
1675  //TODO add this capability to Image and ImageList
1676  // << *m_images;
1677  return stream;
1678  }
1679 
1680 
1688  QDataStream &BundleSolutionInfo::read(QDataStream &stream) {
1689 
1690  QString id;
1691  stream >> id;
1692  delete m_id;
1693  m_id = NULL;
1694  m_id = new QUuid(id);
1695 
1696  stream >> m_runTime;
1697 
1698  QString controlNetworkFileName;
1699  stream >> controlNetworkFileName;
1700  delete m_controlNetworkFileName;
1701  m_controlNetworkFileName = NULL;
1702  m_controlNetworkFileName = new FileName(controlNetworkFileName);
1703 
1704  BundleSettings settings;
1705  stream >> settings;
1706  m_settings = BundleSettingsQsp(new BundleSettings(settings));
1707 
1708  BundleResults statisticsResults;
1709  stream >> statisticsResults;
1710  delete m_statisticsResults;
1711  m_statisticsResults = NULL;
1712  m_statisticsResults = new BundleResults(statisticsResults);
1713 
1714  //TODO add this capability to Image and ImageList
1715  // QList<ImageList*> imageLists;
1716  // stream >> imageLists;
1717  // delete m_images;
1718  // m_images = NULL;
1719  // m_images = new QList<ImageList *>(imageLists);
1720 
1721  return stream;
1722  }
1723 
1724 
1733  QDataStream &operator<<(QDataStream &stream, const BundleSolutionInfo &bundleSolutionInfo) {
1734  return bundleSolutionInfo.write(stream);
1735  }
1736 
1737 
1746  QDataStream &operator>>(QDataStream &stream, BundleSolutionInfo &bundleSolutionInfo) {
1747  return bundleSolutionInfo.read(stream);
1748  }
1749 
1750 
1764  void BundleSolutionInfo::openH5File(FileName bundleSolutionInfoFile) {
1765 
1766  try {
1767  if (!bundleSolutionInfoFile.fileExists()) {
1768  QString msg = "No file with the given name was found.";
1769  throw IException(IException::Io, msg, _FILEINFO_);
1770  }
1771 
1772  if (QString::compare(bundleSolutionInfoFile.extension(), "hdf", Qt::CaseInsensitive) != 0) {
1773  QString msg = "The given file is unsupported for constructing BundleSolutionInfo objects. "
1774  "Supported file types include [hdf].";
1775  throw IException(IException::Io, msg, _FILEINFO_);
1776  }
1777 
1778  // catch H5 exceptions and rethrow
1779  try {
1780  /*
1781  * Turn off the auto-printing when failure occurs so that we can
1782  * handle the errors appropriately
1783  */
1784 // H5::Exception::dontPrint();//??? uncomment
1785 
1786  /*
1787  * Create and open an H5File object with read-only access. This will throw an
1788  * H5 exception if the open fails.
1789  *
1790  * The static H5Fopen() function will returns a negative file ID if it fails. So, in this
1791  * case, we would have to take the extra step of checking whether the return
1792  * is negative.
1793  */
1794 
1795  const H5std_string hdfFileName(bundleSolutionInfoFile.expanded().toStdString());
1796  H5::H5File hdfFile( hdfFileName, H5F_ACC_RDONLY ); // valgrind: Invalid read of size 4
1797 
1798  // get the BundleSolutionInfo group
1799  QString root = "/";
1800  QString bundleRunGroupName = root + "BundleSolutionInfo";
1801  H5::Group bundleRunGroup = hdfFile.openGroup(bundleRunGroupName.toLatin1());
1802 
1803  /*
1804  * Add basic attributes
1805  */
1806  H5std_string attValue;
1807 
1808  Attribute att = bundleRunGroup.openAttribute("runTime");
1809  H5::StrType strDataType(H5::PredType::C_S1, att.getStorageSize());
1810  att.read(strDataType, attValue);
1811  m_runTime = QString::fromStdString(attValue);
1812 
1813  att = bundleRunGroup.openAttribute("controlNetworkFileName");
1814  strDataType = H5::StrType(H5::PredType::C_S1, att.getStorageSize());
1815  att.read(strDataType, attValue);
1816  m_controlNetworkFileName = new FileName(QString::fromStdString(attValue));
1817 
1818  m_settings->openH5Group(bundleRunGroup, bundleRunGroupName);
1819  m_statisticsResults->openH5Group(bundleRunGroup, bundleRunGroupName);
1820 
1821  // ???Let's just save off the image list file names for now...
1822  QString imagesGroupName = bundleRunGroupName + "/imageLists";
1823  H5::Group imagesGroup = bundleRunGroup.openGroup(imagesGroupName.toLatin1());
1824  int imagesGroupSize = (int)imagesGroup.getNumObjs();
1825 
1826  for (int i = 0; i < imagesGroupSize; i++) {
1827  H5std_string listGroupName = imagesGroup.getObjnameByIdx(i);
1828  H5::Group listGroup = imagesGroup.openGroup(listGroupName);
1829 
1830  H5std_string attValue;
1831  att = listGroup.openAttribute("path");
1832  strDataType = H5::StrType(H5::PredType::C_S1, att.getStorageSize());
1833  att.read(strDataType, attValue);
1834  QString listPath = QString::fromStdString(attValue);
1835  QString listName = QString::fromStdString(listGroupName).remove(imagesGroupName + "/");
1836 
1837  ImageList *imageList = new ImageList(listName, listPath);
1838 
1839  att = listGroup.openAttribute("fileNames");
1840  strDataType = H5::StrType(H5::PredType::C_S1, att.getStorageSize());
1841  att.read(strDataType, attValue);
1842  QStringList fileList = QString::fromStdString(attValue).split(",");
1843  for (int j = 0; j < fileList.size();j++) {
1844  imageList->append(new Image(fileList[j]));
1845  }
1846 
1847  m_images->append(imageList);// delete and null imageList???
1848 
1849  }
1850  #if 0
1851 
1852  QString imagesGroupName = bundleRunGroupName + "/imageLists";
1853  H5::Group imagesGroup = bundleRunGroup.openGroup(imagesGroupName.toLatin1());
1854  int imagesGroupSize = (int)imagesGroup.getNumObjs();
1855 
1856  for (int i = 0; i < imagesGroupSize; i++) {
1857  H5std_string listGroupName = imagesGroup.getObjnameByIdx(i);
1858  H5::Group listGroup = imagesGroup.openGroup(listGroupName);
1859 
1860  H5std_string attValue;
1861  att = listGroup.openAttribute("path");
1862  strDataType = H5::StrType(H5::PredType::C_S1, att.getStorageSize());
1863  att.read(strDataType, attValue);
1864  QString listPath = QString::fromStdString(attValue);
1865  QString listName = QString::fromStdString(listGroupName).remove(imagesGroupName + "/");
1866 
1867  ImageList *imageList = new ImageList(listName, listPath);
1868  imageList->openH5Group(bundleRunGroup, bundleRunGroupName);
1869  m_images.append(imageList);
1870  }
1871 #endif
1872 
1873  }
1874  catch (H5::Exception error) { //?? how to improve printed msg using major/minor error codes?
1875  QString msg = "H5 Exception Message: " + QString::fromStdString(error.getDetailMsg());
1876  IException hpfError(IException::Unknown, msg, _FILEINFO_);
1877  msg = "H5 exception handler has detected an error when invoking the function "
1878  + QString::fromStdString(error.getFuncName()) + ".";
1879  throw IException(hpfError, IException::Unknown, msg, _FILEINFO_);
1880  }
1881  }
1882  catch (IException &e) {
1883  QString msg = "Unable to read bundle solution information from the given HDF5 file ["
1884  + bundleSolutionInfoFile.expanded() + "].";
1885  throw IException(e, IException::Unknown, msg, _FILEINFO_);
1886  }
1887  }
1888 
1889 
1900  void BundleSolutionInfo::createH5File(FileName outputFileName) const {
1901 
1902  try {
1903  if (outputFileName.fileExists()) {
1904  QString msg = "A file already exists with the given name ["
1905  + outputFileName.expanded() + "].";
1906  throw IException(IException::Io, msg, _FILEINFO_);
1907  }
1908 
1909  // Try block to detect exceptions raised by any of the calls inside it
1910  try {
1911  /*
1912  * Turn off the auto-printing when failure occurs so that we can
1913  * handle the errors appropriately
1914  */
1915  //H5::Exception::dontPrint();
1916 
1917  /*
1918  * Create a new file using H5F_ACC_EXCL access,
1919  * default file creation properties, and default file
1920  * access properties.
1921  */
1922  const H5std_string hdfFileName(outputFileName.expanded().toStdString());
1923 // const H5std_string hdfFileName("./BundleSolutionInfo.hdf");
1924  H5::H5File hdfFile(hdfFileName, H5F_ACC_EXCL); // valgrind: Invalid read of size 4???
1925 
1926  // create BundleSolutionInfo group
1927  QString root = "/";
1928  QString bundleRunGroupName = root + "BundleSolutionInfo";
1929  H5::Group bundleRunGroup = hdfFile.createGroup(bundleRunGroupName.toLatin1());
1930 
1931  /*
1932  * Add basic attributes
1933  */
1934  Attribute att;
1935  H5::DataSpace spc(H5S_SCALAR); // single value space
1936  QString attValue = "";
1937 
1938  H5::StrType strDataType(H5::PredType::C_S1, m_runTime.length());
1939  att = bundleRunGroup.createAttribute("runTime", strDataType, spc);
1940  att.write(strDataType, m_runTime.toStdString());
1941 
1942  attValue = m_controlNetworkFileName->expanded();
1943  strDataType = H5::StrType(H5::PredType::C_S1, attValue.length());
1944  att = bundleRunGroup.createAttribute("controlNetworkFileName", strDataType, spc);
1945  att.write(strDataType, attValue.toStdString());
1946 
1947  m_settings->createH5Group(bundleRunGroup, bundleRunGroupName);
1948  m_statisticsResults->createH5Group(bundleRunGroup, bundleRunGroupName);
1949 
1950  // Let's just save off the image list file names for now...
1951  QString imagesGroupName = bundleRunGroupName + "/imageLists";
1952  H5::Group imagesGroup = bundleRunGroup.createGroup(imagesGroupName.toLatin1());
1953 
1954  QString listGroupName = "";
1955  int stringSize = 0;
1956 
1957  for (int i = 0; i < m_images->size(); i++) {
1958  listGroupName = imagesGroupName + "/" + (*m_images)[i]->name();
1959 
1960  H5::Group listGroup = imagesGroup.createGroup(listGroupName.toLatin1());
1961 
1962  attValue = (*m_images)[i]->path();
1963  strDataType = H5::StrType(H5::PredType::C_S1, attValue.length());
1964  att = listGroup.createAttribute("path", strDataType, spc);
1965  att.write(strDataType, attValue.toStdString());
1966 
1967  QStringList fileList;
1968  for (int j = 0; j < (*m_images)[i]->size(); j++) {
1969  fileList += (*(*m_images)[i])[j]->fileName(); //???
1970  }
1971 
1972  QString fileNames = fileList.join(",");
1973  stringSize = qMax(fileNames.length(), 1);
1974  strDataType = H5::StrType(H5::PredType::C_S1, stringSize);
1975  att = listGroup.createAttribute("fileNames", strDataType, spc);
1976  att.write(strDataType, fileNames.toStdString());
1977 
1978  }
1979  }
1980  catch (H5::Exception error) { //??? how to improve printed msg using major/minor error codes?
1981  QString msg = "H5 Exception Message: " + QString::fromStdString(error.getDetailMsg());
1982  IException hpfError(IException::Unknown, msg, _FILEINFO_);
1983  msg = "H5 exception handler has detected an error when invoking the function "
1984  + QString::fromStdString(error.getFuncName()) + ".";
1985  throw IException(hpfError, IException::Unknown, msg, _FILEINFO_);
1986  }
1987  }
1988  catch (IException &e) {
1989  throw IException(e,
1991  "Unable to save bundle solution information to an HDF5 file.",
1992  _FILEINFO_);
1993  }
1994  }
1995 
1996 }
void save(QXmlStreamWriter &stream, const Project *project) const
Saves the BundleResults object to an XML file.
double sigmaLongitudeStatisticsRms() const
Returns the RMS of the adjusted longitude sigmas.
void setRunTime(QString runTime)
Sets the run time.
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
Handle an XML start element.
double max()
Returns the maximum observation so far included in the dynamic calculation.
void updateFileName(Project *)
Change the on-disk file name for the control network used to be where the control network ought to be...
double tweakingConstant() const
Returns the current tweaking constant.
Internalizes a list of images and allows for operations on the entire list.
Definition: ImageList.h:44
QString minSigmaRadiusPointId() const
Returns the minimum sigma radius point id.
bool outputText()
Outputs a text file with the results of the BundleAdjust.
const double Null
Value for an Isis Null pixel.
Definition: SpecialPixel.h:109
QSharedPointer< BundleSettings > BundleSettingsQsp
Definition for a BundleSettingsQsp, a shared pointer to a BundleSettings object.
The main project for cnetsuite.
Definition: Project.h:105
QList< double > aprioriPointingSigmas() const
Accesses the a priori pointing sigmas.
int iterations() const
Returns the number of iterations taken by the BundleAdjust.
int spkSolveDegree() const
Accesses the degree of thecamera position polynomial being fit to in the bundle adjustment (spkSolveD...
A Constrained point is a Control Point whose lat/lon/radius is somewhat established and should not be...
Definition: ControlPoint.h:361
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:519
A Fixed point is a Control Point whose lat/lon is well established and should not be changed...
Definition: ControlPoint.h:356
File name manipulation and expansion.
Definition: FileName.h:111
QString minSigmaLongitudePointId() const
Returns the minimum sigma longitude point id.
XmlHandler(BundleSolutionInfo *bundleSolutionInfo, Project *project)
Create an XML Handler (reader) that can populate the BundleSolutionInfo class data.
const BundleObservationVector & observations() const
Returns a reference to the observations used by the BundleAdjust.
Container class for BundleAdjustment results.
QString maxSigmaRadiusPointId() const
Returns the maximum sigma radius point id.
BundleSettingsQsp m_settings
The settings from the bundle adjust.
BundleSettingsQsp bundleSettings()
Returns the bundle settings.
QString maxSigmaLongitudePointId() const
Returns the maximum sigma longitude point id.
double value(double cumProb)
Provides the value of the variable that has the given cumulative probility (according the current est...
int numberConstrainedTargetParameters() const
Return the number of constrained target parameters.
QString weightedResidualCutoff()
Method to return a string represtentation of the weighted residual cutoff (if it exists) for the Maxi...
bool outputHeader(std::ofstream &fpOut)
Output header for bundle results file.
QString id() const
Get a unique, identifying string associated with this BundleSolutionInfo object.
int numberCameraAngleCoefficientsSolved() const
Accesses the number of camera angle coefficients in the solution.
Distance minSigmaLatitudeDistance() const
Returns the minimum sigma latitude distance.
const double DEG2RAD(0.017453292519943295769237)
Multiplier for converting from degrees to radians.
bool solvePositionOverHermite() const
Whether or not the polynomial for solving will be fit over an existing Hermite spline.
double sigma0() const
Returns the Sigma0 of the bundle adjustment.
QString runTime() const
Returns the run time.
QList< ImageList * > * m_images
The list of images that were adjusted.
BundleSolutionInfo & operator=(const BundleSolutionInfo &src)
Creates an equal operator for BundleSolutionInfos.
QList< ImageList * > * m_xmlHandlerImages
List of pointers to images.
double sigmaLatitudeStatisticsRms() const
Returns the RMS of the adjusted latitude sigmas.
int numberCameraPositionCoefficientsSolved() const
Accesses the number of camera position coefficients in the solution.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:226
A type of error that occurred when performing an actual I/O operation.
Definition: IException.h:163
bool outputImagesCSV()
Outputs the bundleout_images.csv file which contains Jigsaw data about the images within each observa...
static QString cnetRoot(QString projectRoot)
Appends the root directory name &#39;cnets&#39; to the project.
Definition: Project.cpp:1220
bool solveTwist() const
Accesses the flag for solving for twist.
QSharedPointer< BundleObservation > BundleObservationQsp
Typdef for BundleObservation QSharedPointer.
ControlNetQsp outputControlNet() const
Returns a shared pointer to the output control network.
void setOutputStatistics(BundleResults statisticsResults)
Sets the stat results.
bool outputImagesCSVHeader(std::ofstream &fpOut)
Outputs the header for the bundleout_images.csv file.
A Free point is a Control Point that identifies common measurements between two or more cubes...
Definition: ControlPoint.h:369
double elapsedTimeErrorProp() const
Returns the elapsed time for error propagation.
QVector< BundleControlPointQsp > & bundleControlPoints()
Returns a reference to the BundleControlPoint vector.
BundleResults * m_statisticsResults
The results of the bundle adjust.
BundleSolutionInfo * m_xmlHandlerBundleSolutionInfo
The bundleSolutionInfo object.
double meters() const
Get the distance in meters.
Definition: Distance.cpp:97
int numberRejectedObservations() const
Returns the number of observation that were rejected.
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Saves the BundleSolutionInfo to the project.
StatCumProbDistDynCalc residualsCumulativeProbabilityDistribution() const
Returns the cumulative probability distribution of the residuals used for reporting.
void createH5File(FileName outputFileName) const
Creates a new file using H5F_ACC_EXCL.
PvlObject pvlObject(QString resultsName="BundleSolutionInfo", QString settingsName="InputSettings", QString statisticsName="StatisticsResults")
Writes the results from BundleAdjust to a Pvl.
BundleResults * m_xmlHandlerBundleResults
Results from the bundle adjust.
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:38
std::istream & operator>>(std::istream &is, CSVReader &csv)
Input read operator for input stream sources.
Definition: CSVReader.cpp:463
QList< Statistics > rmsImageResiduals() const
Returns the list of RMS image residuals statistics.
QUuid * m_id
A unique ID for this BundleSolutionInfo object (useful for others to reference this object when savin...
A single keyword-value pair.
Definition: PvlKeyword.h:98
This class is used to read an images.xml file into an image list.
Container class for BundleAdjustment settings.
A type of error that cannot be classified as any of the other error types.
Definition: IException.h:126
QString maxSigmaLatitudePointId() const
Returns the maximum sigma latitude point id.
int ckSolveDegree() const
Accesses the degree of the camera angles polynomial being fit to in the bundle adjustment (ckSolveDeg...
double sigmaRadiusStatisticsRms() const
Returns the RMS of the adjusted raidus sigmas.
This represents a cube in a project-based GUI interface.
Definition: Image.h:91
QString m_xmlHandlerCharacters
List of characters that have been handled.
QDataStream & read(QDataStream &stream)
Reads the data from the stream.
Distance minSigmaRadiusDistance() const
Returns the minimum sigma redius distance.
QList< double > aprioriPositionSigmas() const
Accesses the a priori position sigmas.
void append(Image *const &value)
Appends an image to the image list.
Definition: ImageList.cpp:150
void openH5Group(H5::CommonFG &locationObject, QString locationName)
Reads from an hdf5 group.
void setCorrMatImgsAndParams(QMap< QString, QStringList > imgsAndParams)
Set the images and their associated parameters of the correlation matrix.
QString minSigmaLatitudePointId() const
Returns the minimum sigma latitude point id.
This class is used to modify and manage solve settings for 1 to many BundleObservations.
bool converged() const
Returns whether or not the bundle adjustment converged.
int numberObservations() const
Returns the number of observations.
virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName)
Handle an XML end element.
QString controlNetworkFileName() const
Returns the name of the control network.
Distance maxSigmaLongitudeDistance() const
Returns the maximum sigma longitude distance.
int numberConstrainedImageParameters() const
Returns the number of constrained image parameters.
bool outputResiduals()
Outputs image coordinate residuals to a csv file.
QString m_runTime
The run time of the bundle adjust.
Distance maxSigmaLatitudeDistance() const
Returns the maximum sigma latitude distance.
QSharedPointer< BundleMeasure > BundleMeasureQsp
Definition for BundleMeasureQsp, a shared pointer to a BundleMeasure.
BundleResults bundleResults()
Returns the bundle results.
virtual bool characters(const QString &ch)
Adds characters to m_xmlHandlerCharacters.
int numberUnknownParameters() const
Returns the number of unknown parameters.
QList< Statistics > rmsImageSampleResiduals() const
Returns the list of RMS image sample residuals statistics.
Isis exception class.
Definition: IException.h:99
FileName * m_controlNetworkFileName
The name of the control network.
double min()
Returns the maximum observation so far included in the dynamic calculation.
A container class for statistical results from a BundleAdjust solution.
Definition: BundleResults.h:90
Distance maxSigmaRadiusDistance() const
Returns the maximum sigma redius distance.
PvlObject pvlObject(QString name="BundleResults") const
Saves the BundleResults object as a PvlObject.
double elapsedTime() const
Returns the elapsed time for the bundle adjustment.
QList< Statistics > rmsImageLineResiduals() const
Returns the list of RMS image line residuals statistics.
static QString modelToString(Model model)
Static method to return a string represtentation for a given MaximumLikelihoodWFunctions::Model enum...
Distance minSigmaLongitudeDistance() const
Returns the minimum sigma longitude distance.
void openH5File(FileName outputFileName)
Reads the settings and results from another BundleSolutionInfo.
QDebug operator<<(QDebug debug, const Hillshade &hillshade)
Print this class out to a QDebug object.
Definition: Hillshade.cpp:308
QDataStream & write(QDataStream &stream) const
Writes the data to the stream.
QSharedPointer< BundleControlPoint > BundleControlPointQsp
Definition for BundleControlPointQSP, a shared pointer to a BundleControlPoint.
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:74
bool solvePolyOverPointing() const
Whether or not the solve polynomial will be fit over the existing pointing polynomial.
int numberConstrainedPointParameters() const
Returns the number of constrained point parameters.
double radiansToMeters() const
Returns the radians to meters conversion factor for the target body.
his enables stack-based XML parsing of XML files.
int spkDegree() const
Accesses the degree of the polynomial fit to the original camera position (spkDegree).
MaximumLikelihoodWFunctions maximumLikelihoodModelWFunc(int modelIndex) const
Returns the maximum likelihood model at the given index.
int ckDegree() const
Accesses the degree of polynomial fit to original camera angles (ckDegree).
bool outputPointsCSV()
Outputs point data to a csv file.
double maximumLikelihoodModelQuantile(int modelIndex) const
Returns the quantile of the maximum likelihood model at the given index.

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:15:15