Isis 3 Programmer Reference
BundleSettings.cpp
1 #include "BundleSettings.h"
2 
3 #include <QDataStream>
4 #include <QDebug>
5 #include <QList>
6 #include <QString>
7 #include <QtGlobal> // qMax()
8 #include <QUuid>
9 #include <QXmlStreamWriter>
10 #include <QXmlInputSource>
11 
13 #include "IException.h"
14 #include "IString.h"
15 #include "Project.h" // currently used for xml handler
16 #include "PvlKeyword.h"
17 #include "PvlObject.h"
18 #include "SpecialPixel.h"
19 #include "XmlStackedHandlerReader.h"
20 
21 namespace Isis {
22 
32  init();
33  BundleObservationSolveSettings defaultSolveSettings;
34  m_observationSolveSettings.append(defaultSolveSettings);
35  }
36 
43  m_validateNetwork = true;
44 
45  m_solveObservationMode = false;
46  m_solveRadius = false;
47  m_updateCubeLabel = false;
48  m_errorPropagation = false;
49  m_createInverseMatrix = false;
50  m_cubeList = "";
51  m_outlierRejection = false;
53 
54  // Parameter Uncertainties (Weighting)
55  // The units are meters for either coordinate type
59 
60  // Convergence Criteria
64 
65  // Maximum Likelihood Estimation Options no default in the constructor - must be set.
66  m_maximumLikelihood.clear();
67 
68  // Self Calibration ??? (from ipce only)
69 
70  // Target Body
71  m_solveTargetBody = false;
72 // m_solveTargetBodyPolePosition = false;
73 // m_solveTargetBodyZeroMeridian = false;
74 // m_solveTargetBodyRotationRate = false;
75 // m_solveTargetBodyRadiusMethod = None;
76 
77  // Control Points
80 
81  // Output Options
82  m_outputFilePrefix = "";
83  }
84 
85 
103  XmlStackedHandlerReader *xmlReader) {
104  init();
105  xmlReader->setErrorHandler(new XmlHandler(this, project));
106  xmlReader->pushContentHandler(new XmlHandler(this, project));
107  }
108 
109 
117  : m_validateNetwork(other.m_validateNetwork),
118  m_cubeList(other.m_cubeList),
119  m_solveObservationMode(other.m_solveObservationMode),
120  m_solveRadius(other.m_solveRadius),
121  m_updateCubeLabel(other.m_updateCubeLabel),
122  m_errorPropagation(other.m_errorPropagation),
123  m_createInverseMatrix(other.m_createInverseMatrix),
124  m_outlierRejection(other.m_outlierRejection),
125  m_outlierRejectionMultiplier(other.m_outlierRejectionMultiplier),
126  m_globalPointCoord1AprioriSigma(other.m_globalPointCoord1AprioriSigma),
127  m_globalPointCoord2AprioriSigma(other.m_globalPointCoord2AprioriSigma),
128  m_globalPointCoord3AprioriSigma(other.m_globalPointCoord3AprioriSigma),
129  m_observationSolveSettings(other.m_observationSolveSettings),
130  m_convergenceCriteria(other.m_convergenceCriteria),
131  m_convergenceCriteriaThreshold(other.m_convergenceCriteriaThreshold),
132  m_convergenceCriteriaMaximumIterations(other.m_convergenceCriteriaMaximumIterations),
133  m_maximumLikelihood(other.m_maximumLikelihood),
134  m_solveTargetBody(other.m_solveTargetBody),
135  m_bundleTargetBody(other.m_bundleTargetBody),
136  m_cpCoordTypeReports(other.m_cpCoordTypeReports),
137  m_cpCoordTypeBundle(other.m_cpCoordTypeBundle),
138  m_outputFilePrefix(other.m_outputFilePrefix){
139  }
140 
141 
146  }
147 
148 
162  if (&other != this) {
164  m_cubeList = other.m_cubeList;
175  m_observationSolveSettings = other.m_observationSolveSettings;
185  }
186  return *this;
187  }
188 
189 
202  }
203 
204 
216  return m_validateNetwork;
217  }
218 
219 
226  void BundleSettings::setCubeList(QString cubeList) {
227  m_cubeList = cubeList;
228  }
229 
230 
236  QString BundleSettings::cubeList() const {
237  return m_cubeList;
238  }
239 
240 
241  // =============================================================================================//
242  // ======================== Solve Options ======================================================//
243  // =============================================================================================//
244 
261  void BundleSettings::setSolveOptions(bool solveObservationMode,
262  bool updateCubeLabel,
263  bool errorPropagation,
264  bool solveRadius,
265  SurfacePoint::CoordinateType coordTypeBundle,
266  SurfacePoint::CoordinateType coordTypeReports,
267  double globalPointCoord1AprioriSigma,
268  double globalPointCoord2AprioriSigma,
269  double globalPointCoord3AprioriSigma) {
274  m_cpCoordTypeReports = coordTypeReports;
275  m_cpCoordTypeBundle = coordTypeBundle;
276  // m_cpCoordTypeBundle = SurfacePoint::Latitudinal;
277 
278  if (globalPointCoord1AprioriSigma > 0.0) { // otherwise, we leave as default Isis::Null
280  }
281  else {
283  }
284 
285  if (globalPointCoord2AprioriSigma > 0.0) {
287  }
288  else {
290  }
291 
292  // This is ugly. *** TODO *** Revisit this section to try to find a cleaner solution.
293  // I think we will have to do similar checking other places.
294  // See pvlObject, save, (DAC 03-29-2017)
295  if (coordTypeBundle == SurfacePoint::Latitudinal) {
298  }
299  else {
301  }
302  }
303  else if (coordTypeBundle == SurfacePoint::Rectangular) {
304  if (globalPointCoord3AprioriSigma > 0.0) {
306  }
307  else {
309  }
310  }
311  }
312 
313 
321  void BundleSettings::setOutlierRejection(bool outlierRejection, double multiplier) {
323  if (m_outlierRejection) {
324  m_outlierRejectionMultiplier = multiplier;
325  }
326  else {
328  }
329  }
330 
331 
340  QList<BundleObservationSolveSettings> obsSolveSettingsList) {
341  m_observationSolveSettings = obsSolveSettingsList;
342  }
343 
344 
354  return (m_cpCoordTypeReports);
355  }
356 
357 
368  return (m_cpCoordTypeBundle);
369  }
370 
371 
385  }
386 
387 
396  return m_outlierRejection;
397  }
398 
399 
407  return m_solveObservationMode;
408  }
409 
410 
418  return m_solveRadius;
419  }
420 
421 
430  return m_updateCubeLabel;
431  }
432 
433 
441  return m_errorPropagation;
442  }
443 
444 
458  void BundleSettings::setCreateInverseMatrix(bool createMatrixFile) {
459  m_createInverseMatrix = createMatrixFile;
460  }
461 
462 
470  }
471 
472 
480  }
481 
482 
490  }
491 
492 
500  }
501 
502 
510  return m_observationSolveSettings.size();
511  }
512 
513 
526  BundleSettings::observationSolveSettings(QString observationNumber) const {
527 
528  BundleObservationSolveSettings defaultSolveSettings;
529 
530  for (int i = 0; i < numberSolveSettings(); i++) {
531  if (m_observationSolveSettings[i].observationNumbers().contains(observationNumber)) {
532  return m_observationSolveSettings[i];
533  }
534  }
535  return defaultSolveSettings;
536  //QString msg = "Unable to find BundleObservationSolveSettings for observation number ["
537  // + observationNumber + "].";
538  // throw IException(IException::Unknown, msg, _FILEINFO_);
539  }
540 
541 
555 
556  if (n >= 0 && n < numberSolveSettings()) {
557  return m_observationSolveSettings[n];
558  }
559  QString msg = "Unable to find BundleObservationSolveSettings with index = ["
560  + toString(n) + "].";
562  }
563 
564 
572  return m_observationSolveSettings;
573  }
574 
575 
576  // =============================================================================================//
577  // ======================== Convergence Criteria ===============================================//
578  // =============================================================================================//
579 
597  if (criteria.compare("SIGMA0", Qt::CaseInsensitive) == 0) {
598  return BundleSettings::Sigma0;
599  }
600  else if (criteria.compare("PARAMETERCORRECTIONS", Qt::CaseInsensitive) == 0) {
602  }
604  "Unknown bundle convergence criteria [" + criteria + "].",
605  _FILEINFO_);
606  }
607 
608 
622  if (criteria == Sigma0) return "Sigma0";
623  else if (criteria == ParameterCorrections) return "ParameterCorrections";
625  "Unknown convergence criteria enum [" + toString(criteria) + "].",
626  _FILEINFO_);
627  }
628 
629 
641  double threshold,
642  int maximumIterations) {
643  m_convergenceCriteria = criteria;
644  m_convergenceCriteriaThreshold = threshold;
645  m_convergenceCriteriaMaximumIterations = maximumIterations;
646  }
647 
648 
656  return m_convergenceCriteria;
657  }
658 
659 
668  }
669 
670 
681  }
682 
683 
684 
685  // =============================================================================================//
686  // ======================== Parameter Uncertainties (Weighting) ================================//
687  // =============================================================================================//
688 // void BundleSettings::setGlobalLatitudeAprioriSigma(double sigma) {
689 // m_globalLatitudeAprioriSigma = sigma;
690 // }
691 //
692 //
693 //
694 // void BundleSettings::setGlobalLongitudeAprioriSigma(double sigma) {
695 // m_globalLongitudeAprioriSigma = sigma;
696 // }
697 //
698 //
699 //
700 // void BundleSettings::setGlobalRadiiAprioriSigma(double sigma) {
701 // m_globalRadiusAprioriSigma = sigma;
702 // }
703 
704 
705  // =============================================================================================//
706  // ======================== Maximum Likelihood Estimation Options ==============================//
707  // =============================================================================================//
708 
709 
723  double maxModelCQuantile) {
724 
726  QString msg = "For bundle adjustments with multiple maximum likelihood estimators, the first "
727  "model must be of type HUBER or HUBER_MODIFIED.";
729  }
730 
731  m_maximumLikelihood.append(qMakePair(model, maxModelCQuantile));
732  }
733 
734 
745  return m_maximumLikelihood;
746  }
747 
748 
749  // =============================================================================================//
750  // ======================== Self Calibration ??? (from ipce only) =========================//
751  // =============================================================================================//
752 
753  // =============================================================================================//
754  // ======================== Target Body ??? (from ipce only) ==============================//
755  // =============================================================================================//
756 
765  }
766 
767 
775  return m_bundleTargetBody;
776  }
777 
778 
785 // bool BundleSettings::solveTargetBodyPolePosition() const {
786 // return m_solveTargetBodyPolePosition;
787 // }
788 
789 
797  if (!m_bundleTargetBody)
798  return 0;
799 
800  return m_bundleTargetBody->numberParameters();
801  }
802 
803 
811  if (!m_bundleTargetBody) {
812  return false;
813  }
814  else {
815  return (m_bundleTargetBody->numberParameters() > 0);
816  }
817  }
818 
819 
829  if (!m_bundleTargetBody) {
830  return false;
831  }
832  return m_bundleTargetBody->solvePoleRA();
833  }
834 
835 
845  if (!m_bundleTargetBody) {
846  return false;
847  }
848  return m_bundleTargetBody->solvePoleRAVelocity();
849  }
850 
851 
861  if (!m_bundleTargetBody) {
862  return false;
863  }
864  return m_bundleTargetBody->solvePoleDec();
865  }
866 
867 
877  if (!m_bundleTargetBody) {
878  return false;
879  }
880  return m_bundleTargetBody->solvePoleDecVelocity();
881  }
882 
883 
892  bool BundleSettings::solvePM() const {
893  if (!m_bundleTargetBody) {
894  return false;
895  }
896  return m_bundleTargetBody->solvePM();
897  }
898 
899 
909  if (!m_bundleTargetBody) {
910  return false;
911  }
912  return m_bundleTargetBody->solvePMVelocity();
913  }
914 
915 
925  if (!m_bundleTargetBody) {
926  return false;
927  }
928  return m_bundleTargetBody->solvePMAcceleration();
929  }
930 
931 
941  if (!m_bundleTargetBody) {
942  return false;
943  }
944  return m_bundleTargetBody->solveTriaxialRadii();
945  }
946 
947 
957  if (!m_bundleTargetBody) {
958  return false;
959  }
960  return m_bundleTargetBody->solveMeanRadius();
961  }
962 
963 
964 // void BundleSettings::setTargetBodySolveOptions(bool solveTargetBodyPolePosition,
965 // double aprioriRaPole, double sigmaRaPole,
966 // double aprioriDecPole, double sigmaDecPole,
967 // bool solveTargetBodyZeroMeridian,
968 // double aprioriW0, double sigmaW0,
969 // bool solveTargetBodyRotationRate,
970 // double aprioriWDot, double sigmaWDot,
971 // TargetRadiiSolveMethod solveRadiiMethod,
972 // double aprioriRadiusA, double sigmaRadiusA,
973 // double aprioriRadiusB, double sigmaRadiusB,
974 // double aprioriRadiusC, double sigmaRadiusC,
975 // double aprioriMeanRadius, double sigmaMeanRadius) {
976 
977 
978 // m_solveTargetBody = true;
979 // m_solveTargetBodyPolePosition = solveTargetBodyPolePosition;
980 // m_aprioriRaPole = aprioriRaPole;
981 // m_sigmaRaPole = sigmaRaPole;
982 // m_aprioriDecPole = aprioriDecPole;
983 // m_sigmaDecPole = sigmaDecPole;
984 // m_solveTargetBodyZeroMeridian =solveTargetBodyZeroMeridian;
985 // m_aprioriW0 = aprioriW0;
986 // m_sigmaW0 = sigmaW0;
987 // m_solveTargetBodyRotationRate = solveTargetBodyRotationRate;
988 // m_aprioriWDot = aprioriWDot;
989 // m_sigmaWDot = sigmaWDot;
990 // m_solveTargetBodyRadiusMethod = solveRadiiMethod;
991 // m_aprioriRadiusA = aprioriRadiusA;
992 // m_sigmaRadiusA = sigmaRadiusA;
993 // m_aprioriRadiusB = aprioriRadiusB;
994 // m_sigmaRadiusB = sigmaRadiusB;
995 // m_aprioriRadiusC = aprioriRadiusC;
996 // m_sigmaRadiusC = sigmaRadiusC;
997 // m_aprioriMeanRadius = aprioriMeanRadius;
998 // m_sigmaMeanRadius = sigmaMeanRadius;
999 
1000 // m_bundleTargetBody->setSolveSettings(solveTargetBodyPolePosition, aprioriRaPole, sigmaRaPole,
1001 // aprioriDecPole, sigmaDecPole, solveTargetBodyZeroMeridian,
1002 // aprioriW0, sigmaW0, solveTargetBodyRotationRate,
1003 // aprioriWDot, sigmaWDot, solveRadiiMethod, aprioriRadiusA,
1004 // sigmaRadiusA, aprioriRadiusB, sigmaRadiusB, aprioriRadiusC,
1005 // sigmaRadiusC, aprioriMeanRadius, sigmaMeanRadius);
1006 // }
1007 
1008 
1009  // =============================================================================================//
1010  // ========================= Output Options (from Jigsaw only) ================================//
1011  // =============================================================================================//
1017  void BundleSettings::setOutputFilePrefix(QString outputFilePrefix) {
1019  }
1020 
1021 
1032  return m_outputFilePrefix;
1033  }
1034 
1035 
1045  void BundleSettings::save(QXmlStreamWriter &stream, const Project *project) const {
1046  stream.writeStartElement("bundleSettings");
1047 
1048  stream.writeStartElement("globalSettings");
1049 
1050  stream.writeTextElement("validateNetwork", toString(validateNetwork()));
1051 
1052  stream.writeStartElement("solveOptions");
1053  stream.writeAttribute("solveObservationMode", toString(solveObservationMode()));
1054  stream.writeAttribute("solveRadius", toString(solveRadius()));
1055  stream.writeAttribute("controlPointCoordTypeReports", toString(controlPointCoordTypeReports()));
1056  stream.writeAttribute("controlPointCoordTypeBundle", toString(controlPointCoordTypeBundle()));
1057  stream.writeAttribute("updateCubeLabel", toString(updateCubeLabel()));
1058  stream.writeAttribute("errorPropagation", toString(errorPropagation()));
1059  stream.writeAttribute("createInverseMatrix", toString(createInverseMatrix()));
1060  stream.writeEndElement();
1061 
1062  stream.writeStartElement("aprioriSigmas");
1064  stream.writeAttribute("pointCoord1", "N/A");
1065  }
1066  else {
1067  stream.writeAttribute("pointCoord1", toString(globalPointCoord1AprioriSigma()));
1068  }
1070  stream.writeAttribute("pointCoord2", "N/A");
1071  }
1072  else {
1073  stream.writeAttribute("pointCoord2", toString(globalPointCoord2AprioriSigma()));
1074  }
1076  stream.writeAttribute("pointCoord3", "N/A");
1077  }
1078  else {
1079  stream.writeAttribute("pointCoord3", toString(globalPointCoord3AprioriSigma()));
1080  }
1081  stream.writeEndElement();
1082 
1083  stream.writeStartElement("outlierRejectionOptions");
1084  stream.writeAttribute("rejection", toString(outlierRejection()));
1085  if (outlierRejection()) {
1086  stream.writeAttribute("multiplier", toString(outlierRejectionMultiplier()));
1087  }
1088  else {
1089  stream.writeAttribute("multiplier", "N/A");
1090  }
1091  stream.writeEndElement();
1092 
1093  stream.writeStartElement("convergenceCriteriaOptions");
1094  stream.writeAttribute("convergenceCriteria",
1096  stream.writeAttribute("threshold",
1098  stream.writeAttribute("maximumIterations",
1100  stream.writeEndElement();
1101 
1102  stream.writeStartElement("maximumLikelihoodEstimation");
1103  for (int i = 0; i < m_maximumLikelihood.size(); i++) {
1104  stream.writeStartElement("model");
1105  stream.writeAttribute("type",
1107  stream.writeAttribute("quantile", toString(m_maximumLikelihood[i].second));
1108  stream.writeEndElement();
1109  }
1110  stream.writeEndElement();
1111 
1112  stream.writeStartElement("outputFileOptions");
1113  stream.writeAttribute("fileNamePrefix", outputFilePrefix());
1114  stream.writeEndElement();
1115 
1116  stream.writeEndElement(); // end global settings
1117 
1118  if (!m_observationSolveSettings.isEmpty()) {
1119  stream.writeStartElement("observationSolveSettingsList");
1120  for (int i = 0; i < m_observationSolveSettings.size(); i++) {
1121  m_observationSolveSettings[i].save(stream, project);
1122  }
1123  stream.writeEndElement();
1124  }
1125  else {
1126  // throw error??? should not write if no observation settings...
1127  }
1128  stream.writeEndElement();
1129  }
1130 
1131 
1141  m_xmlHandlerBundleSettings = bundleSettings;
1142  m_xmlHandlerProject = project;
1143  m_xmlHandlerCharacters = "";
1144  m_xmlHandlerObservationSettings.clear();
1145  }
1146 
1147 
1152  }
1153 
1154 
1170  bool BundleSettings::XmlHandler::startElement(const QString &namespaceURI,
1171  const QString &localName,
1172  const QString &qName,
1173  const QXmlAttributes &attributes) {
1174  m_xmlHandlerCharacters = "";
1175 
1176  if (XmlStackedHandler::startElement(namespaceURI, localName, qName, attributes)) {
1177 
1178  if (localName == "solveOptions") {
1179 
1180  QString solveObservationModeStr = attributes.value("solveObservationMode");
1181  if (!solveObservationModeStr.isEmpty()) {
1182  m_xmlHandlerBundleSettings->m_solveObservationMode = toBool(solveObservationModeStr);
1183  }
1184 
1185  QString solveRadiusStr = attributes.value("solveRadius");
1186  if (!solveRadiusStr.isEmpty()) {
1187  m_xmlHandlerBundleSettings->m_solveRadius = toBool(solveRadiusStr);
1188  }
1189 
1190  QString coordTypeReportsStr = attributes.value("controlPointCoordinateTypeReports");
1191  if (!coordTypeReportsStr.isEmpty()) {
1192  m_xmlHandlerBundleSettings->m_cpCoordTypeReports =
1193  SurfacePoint::stringToCoordinateType(coordTypeReportsStr);
1194  }
1195 
1196  QString coordTypeBundleStr = attributes.value("controlPointCoordinateTypeBundle");
1197  if (!coordTypeBundleStr.isEmpty()) {
1198  m_xmlHandlerBundleSettings->m_cpCoordTypeBundle =
1199  SurfacePoint::stringToCoordinateType(coordTypeBundleStr);
1200  }
1201 
1202  QString updateCubeLabelStr = attributes.value("updateCubeLabel");
1203  if (!updateCubeLabelStr.isEmpty()) {
1204  m_xmlHandlerBundleSettings->m_updateCubeLabel = toBool(updateCubeLabelStr);
1205  }
1206 
1207  QString errorPropagationStr = attributes.value("errorPropagation");
1208  if (!errorPropagationStr.isEmpty()) {
1209  m_xmlHandlerBundleSettings->m_errorPropagation = toBool(errorPropagationStr);
1210  }
1211 
1212  QString createInverseMatrixStr = attributes.value("createInverseMatrix");
1213  if (!createInverseMatrixStr.isEmpty()) {
1214  m_xmlHandlerBundleSettings->m_createInverseMatrix = toBool(createInverseMatrixStr);
1215  }
1216  }
1217  else if (localName == "aprioriSigmas") {
1218 
1219  QString globalPointCoord1AprioriSigmaStr = attributes.value("pointCoord1");
1220  m_xmlHandlerBundleSettings->m_globalPointCoord1AprioriSigma = Isis::Null;
1221  // TODO: why do I need to init this one and not other sigmas???
1222  if (!globalPointCoord1AprioriSigmaStr.isEmpty()) {
1223  if (globalPointCoord1AprioriSigmaStr == "N/A") {
1224  m_xmlHandlerBundleSettings->m_globalPointCoord1AprioriSigma = Isis::Null;
1225  }
1226  else {
1227  m_xmlHandlerBundleSettings->m_globalPointCoord1AprioriSigma
1228  = toDouble(globalPointCoord1AprioriSigmaStr);
1229  }
1230  }
1231 
1232  QString globalPointCoord2AprioriSigmaStr = attributes.value("pointCoord2");
1233  if (!globalPointCoord2AprioriSigmaStr.isEmpty()) {
1234  if (globalPointCoord2AprioriSigmaStr == "N/A") {
1235  m_xmlHandlerBundleSettings->m_globalPointCoord2AprioriSigma = Isis::Null;
1236  }
1237  else {
1238  m_xmlHandlerBundleSettings->m_globalPointCoord2AprioriSigma
1239  = toDouble(globalPointCoord2AprioriSigmaStr);
1240  }
1241  }
1242 
1243  QString globalPointCoord3AprioriSigmaStr = attributes.value("radius");
1244  if (!globalPointCoord3AprioriSigmaStr.isEmpty()) {
1245  if (globalPointCoord3AprioriSigmaStr == "N/A") {
1246  m_xmlHandlerBundleSettings->m_globalPointCoord3AprioriSigma = Isis::Null;
1247  }
1248  else {
1249  m_xmlHandlerBundleSettings->m_globalPointCoord3AprioriSigma
1250  = toDouble(globalPointCoord3AprioriSigmaStr);
1251  }
1252  }
1253  }
1254  else if (localName == "outlierRejectionOptions") {
1255  QString outlierRejectionStr = attributes.value("rejection");
1256  if (!outlierRejectionStr.isEmpty()) {
1257  m_xmlHandlerBundleSettings->m_outlierRejection = toBool(outlierRejectionStr);
1258  }
1259 
1260  QString outlierRejectionMultiplierStr = attributes.value("multiplier");
1261  if (!outlierRejectionMultiplierStr.isEmpty()) {
1262  if (outlierRejectionMultiplierStr != "N/A") {
1263  m_xmlHandlerBundleSettings->m_outlierRejectionMultiplier
1264  = toDouble(outlierRejectionMultiplierStr);
1265  }
1266  else {
1267  m_xmlHandlerBundleSettings->m_outlierRejectionMultiplier = 3.0;
1268  }
1269  }
1270  }
1271  else if (localName == "convergenceCriteriaOptions") {
1272 
1273  QString convergenceCriteriaStr = attributes.value("convergenceCriteria");
1274  if (!convergenceCriteriaStr.isEmpty()) {
1275  m_xmlHandlerBundleSettings->m_convergenceCriteria
1276  = stringToConvergenceCriteria(convergenceCriteriaStr);
1277  }
1278 
1279  QString convergenceCriteriaThresholdStr = attributes.value("threshold");
1280  if (!convergenceCriteriaThresholdStr.isEmpty()) {
1281  m_xmlHandlerBundleSettings->m_convergenceCriteriaThreshold
1282  = toDouble(convergenceCriteriaThresholdStr);
1283  }
1284 
1285  QString convergenceCriteriaMaximumIterationsStr = attributes.value("maximumIterations");
1286  if (!convergenceCriteriaMaximumIterationsStr.isEmpty()) {
1287  m_xmlHandlerBundleSettings->m_convergenceCriteriaMaximumIterations
1288  = toInt(convergenceCriteriaMaximumIterationsStr);
1289  }
1290  }
1291  else if (localName == "model") {
1292  QString type = attributes.value("type");
1293  QString quantile = attributes.value("quantile");
1294  if (!type.isEmpty() && !quantile.isEmpty()) {
1295  m_xmlHandlerBundleSettings->m_maximumLikelihood.append(
1296  qMakePair(MaximumLikelihoodWFunctions::stringToModel(type),
1297  toDouble(quantile)));
1298  }
1299  }
1300  else if (localName == "outputFileOptions") {
1301  QString outputFilePrefixStr = attributes.value("fileNamePrefix");
1302  if (!outputFilePrefixStr.isEmpty()) {
1303  m_xmlHandlerBundleSettings->m_outputFilePrefix = outputFilePrefixStr;
1304  }
1305  }
1306  else if (localName == "bundleObservationSolveSettings") {
1307  m_xmlHandlerObservationSettings.append(
1308  new BundleObservationSolveSettings(m_xmlHandlerProject, reader()));
1309  }
1310  }
1311  return true;
1312  }
1313 
1314 
1321  bool BundleSettings::XmlHandler::characters(const QString &ch) {
1322  m_xmlHandlerCharacters += ch;
1323  return XmlStackedHandler::characters(ch);
1324  }
1325 
1326 
1336  bool BundleSettings::XmlHandler::endElement(const QString &namespaceURI, const QString &localName,
1337  const QString &qName) {
1338  if (!m_xmlHandlerCharacters.isEmpty()) {
1339  if (localName == "validateNetwork") {
1340  m_xmlHandlerBundleSettings->m_validateNetwork = toBool(m_xmlHandlerCharacters);
1341  }
1342  else if (localName == "observationSolveSettingsList") {
1343  for (int i = 0; i < m_xmlHandlerObservationSettings.size(); i++) {
1344  m_xmlHandlerBundleSettings->m_observationSolveSettings.append(
1345  *m_xmlHandlerObservationSettings[i]);
1346  }
1347  m_xmlHandlerObservationSettings.clear();
1348  }
1349 
1350  m_xmlHandlerCharacters = "";
1351  }
1352  return XmlStackedHandler::endElement(namespaceURI, localName, qName);
1353  }
1354 
1355 
1362  bool BundleSettings::XmlHandler::fatalError(const QXmlParseException &exception) {
1363  qDebug() << "Parse error with BundleSettings at line " << exception.lineNumber()
1364  << ", " << "column " << exception.columnNumber() << ": "
1365  << qPrintable(exception.message());
1366  return false;
1367  }
1368 }
bool m_createInverseMatrix
Indicates whether to create the inverse matrix file.
bool solveMeanRadius() const
This method is used to determine whether the bundle adjustment will solve for target body mean radius...
BundleTargetBodyQsp m_bundleTargetBody
A pointer to the target body settings and information.
const double Null
Value for an Isis Null pixel.
Definition: SpecialPixel.h:110
The value of sigma0 will be used to determine that the bundle adjustment has converged.
The main project for ipce.
Definition: Project.h:289
SurfacePoint::CoordinateType m_cpCoordTypeBundle
Indicates the coordinate type used for control points in the bundle adjustment.
void setObservationSolveOptions(QList< BundleObservationSolveSettings > obsSolveSettingsList)
Add the list of solve options for each observation.
bool m_solveObservationMode
Indicates whether to solve for observation mode.
static QString convergenceCriteriaToString(ConvergenceCriteria criteria)
Converts the given BundleSettings::ConvergenceCriteria enumeration to a string.
double convergenceCriteriaThreshold() const
Retrieves the convergence threshold to be used to solve the bundle adjustment.
bool errorPropagation() const
This method is used to determine whether this bundle adjustment will perform error propagation...
QList< QPair< MaximumLikelihoodWFunctions::Model, double > > maximumLikelihoodEstimatorModels() const
Retrieves the list of maximum likelihood estimator (MLE) models with their corresponding C-Quantiles...
void setOutputFilePrefix(QString outputFilePrefix)
Set the output file prefix for the bundle adjustment.
int toInt(const QString &string)
Global function to convert from a string to an integer.
Definition: IString.cpp:108
ConvergenceCriteria m_convergenceCriteria
Enumeration used to indicate what criteria to use to determine bundle adjustment convergence.
void setConvergenceCriteria(ConvergenceCriteria criteria, double threshold, int maximumIterations)
Set the convergence criteria options for the bundle adjustment.
SurfacePoint::CoordinateType controlPointCoordTypeBundle() const
Indicates the control point coordinate type for the actual bundle adjust.
int numberTargetBodyParameters() const
This method is used to determine whether the bundle adjustment will solve for target body pole positi...
double m_outlierRejectionMultiplier
The multiplier value for outlier rejection.
bool validateNetwork() const
This method is used to determine whether to validate the network before the bundle adjustment...
QString outputFilePrefix() const
Retrieve the output file prefix.
bool solvePMAcceleration() const
This method is used to determine whether the bundle adjustment will solve for target body prime merid...
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
bool updateCubeLabel() const
This method is used to determine whether this bundle adjustment will update the cube labels...
virtual bool characters(const QString &ch)
Add a character from an XML element to the content handler.
SurfacePoint::CoordinateType m_cpCoordTypeReports
Indicates the coordinate type for outputting control points in reports.
bool solvePoleDecVelocity() const
This method is used to determine whether the bundle adjustment will solve for target body pole declin...
QString m_outputFilePrefix
The prefix for all output files.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:226
int numberSolveSettings() const
Retrieves the number of observation solve settings.
void setCubeList(QString fileName)
BundleSettings::setCubeList.
bool solvePoleDec() const
This method is used to determine whether the bundle adjustment will solve for target body pole declin...
void save(QXmlStreamWriter &stream, const Project *project) const
This method is used to write a BundleSettings object in an XML format.
Model
The supported maximum likelihood estimation models.
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition: IString.cpp:164
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:162
bool m_validateNetwork
Indicates whether the network should be validated.
ConvergenceCriteria convergenceCriteria() const
Retrieves the convergence criteria to be used to solve the bundle adjustment.
double m_globalPointCoord3AprioriSigma
The global a priori sigma for radius or Z.
bool fatalError(const QXmlParseException &exception)
Format an error message indicating a problem with BundleSettings.
double globalPointCoord2AprioriSigma() const
Retrieves the global a priori sigma for 2nd coordinate of points for this bundle. ...
void setCreateInverseMatrix(bool createMatrix)
Turn the creation of the inverse correlation matrix file on or off.
virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName)
Handle end tags for the BundleSettings serialized XML.
Planetocentric latitudinal (lat/lon/rad) coordinates.
Definition: SurfacePoint.h:156
A modification to Huber&#39;s method propsed by William J.J.
~BundleSettings()
Destroys the BundleSettings object.
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
Handle an XML start element.
bool outlierRejection() const
This method is used to determine whether outlier rejection will be performed on this bundle adjustmen...
XmlHandler(BundleSettings *bundleSettings, Project *project)
Create an XML Handler (reader) that can populate the BundleSettings class data.
void setBundleTargetBody(BundleTargetBodyQsp bundleTargetBody)
Sets the target body for the bundle adjustment.
void init()
Set Default vales for a BundleSettings object.
void addMaximumLikelihoodEstimatorModel(MaximumLikelihoodWFunctions::Model model, double cQuantile)
Add a maximum likelihood estimator (MLE) model to the bundle adjustment.
bool m_updateCubeLabel
Indicates whether to update cubes.
BundleSettings()
Constructs a BundleSettings object.
QList< QPair< MaximumLikelihoodWFunctions::Model, double > > m_maximumLikelihood
Model and C-Quantile for each of the three maximum likelihood estimations.
All parameter corrections will be used to determine that the bundle adjustment has converged...
SurfacePoint::CoordinateType controlPointCoordTypeReports() const
Indicates the control point coordinate type for reports.
int convergenceCriteriaMaximumIterations() const
Retrieves the maximum number of iterations allowed to solve the bundle adjustment.
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:40
virtual void pushContentHandler(XmlStackedHandler *newHandler)
Push a contentHandler and maybe continue parsing...
Container class for BundleAdjustment settings.
A type of error that cannot be classified as any of the other error types.
Definition: IException.h:134
QList< BundleObservationSolveSettings > observationSolveSettings() const
Retrieves solve settings for the observation corresponding to the given index.
void setValidateNetwork(bool validate)
Sets the internal flag to indicate whether to validate the network before the bundle adjustment...
BundleSettings & operator=(const BundleSettings &other)
Assignment operator to allow proper copying of the &#39;other&#39; BundleSettings object to this one...
This class is needed to read/write BundleSettings from/to an XML formateed file.
bool IsSpecial(const double d)
Returns if the input pixel is special.
Definition: SpecialPixel.h:212
double m_convergenceCriteriaThreshold
Tolerance value corresponding to the selected convergence criteria.
Body-fixed rectangular x/y/z coordinates.
Definition: SurfacePoint.h:157
CoordinateType
Defines the coordinate typ, units, and coordinate index for some of the output methods.
Definition: SurfacePoint.h:155
This class is used to modify and manage solve settings for 1 to many BundleObservations.
bool validate(const NaifVertex &v)
Verifies that the given NaifVector or NaifVertex is 3 dimensional.
Definition: NaifDskApi.cpp:45
bool solveRadius() const
This method is used to determine whether this bundle adjustment will solve for radius.
static CoordinateType stringToCoordinateType(QString type)
This method converts the given string value to a SurfacePoint::CoordinateType enumeration.
bool solvePMVelocity() const
This method is used to determine whether the bundle adjustment will solve for target body prime merid...
bool solveTriaxialRadii() const
This method is used to determine whether the bundle adjustment will solve for target body triaxial ra...
static ConvergenceCriteria stringToConvergenceCriteria(QString criteria)
Converts the given string value to a BundleSettings::ConvergenceCriteria enumeration.
bool m_outlierRejection
Indicates whether to perform automatic outlier detection/rejection.
bool solveTargetBody() const
This method is used to determine whether the bundle adjustment will solve for target body...
~XmlHandler()
Destroys BundleSettings::XmlHandler object.
bool m_solveRadius
Indicates whether to solve for point radii.
int m_convergenceCriteriaMaximumIterations
Maximum number of iterations before quitting the bundle adjustment if it has not yet converged to the...
bool toBool(const QString &string)
Global function to convert from a string to a boolean.
Definition: IString.cpp:53
double m_globalPointCoord1AprioriSigma
The global a priori sigma for latitude or X.
Isis exception class.
Definition: IException.h:107
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
double outlierRejectionMultiplier() const
Retrieves the outlier rejection multiplier for the bundle adjustment.
bool solvePM() const
This method is used to determine whether the bundle adjustment will solve for target body prime merid...
bool solvePoleRAVelocity() const
This method is used to determine whether the bundle adjustment will solve for target body pole right ...
double globalPointCoord3AprioriSigma() const
Retrieves the global a priori sigma 3rd coordinate of points for this bundle.
bool createInverseMatrix() const
Indicates if the settings will allow the inverse correlation matrix to be created.
bool m_solveTargetBody
Indicates whether to solve for target body.
double m_globalPointCoord2AprioriSigma
The global a priori sigma for longitude or Y.
static QString modelToString(Model model)
Static method to return a string represtentation for a given MaximumLikelihoodWFunctions::Model enum...
void setOutlierRejection(bool outlierRejection, double multiplier=1.0)
Set the outlier rejection options for the bundle adjustment.
bool m_errorPropagation
Indicates whether to perform error propagation.
double globalPointCoord1AprioriSigma() const
Retrieves global a priori sigma for 1st coordinate of points for this bundle.
bool solveObservationMode() const
This method is used to determine whether this bundle adjustment will solve for observation mode...
Manage a stack of content handlers for reading XML files.
void setSolveOptions(bool solveObservationMode=false, bool updateCubeLabel=false, bool errorPropagation=false, bool solveRadius=false, SurfacePoint::CoordinateType coordTypeBundle=SurfacePoint::Latitudinal, SurfacePoint::CoordinateType coordTypeReports=SurfacePoint::Latitudinal, double globalPointCoord1AprioriSigma=Isis::Null, double globalPointCoord2AprioriSigma=Isis::Null, double globalPointCoord3AprioriSigma=Isis::Null)
Set the solve options for the bundle adjustment.
BundleTargetBodyQsp bundleTargetBody() const
Retrieves a pointer to target body information for the bundle adjustment.
QString cubeList() const
BundleSettings::cubeList.
bool solvePoleRA() const
This method is used to determine whether the bundle adjustment will solve for target body pole right ...
ConvergenceCriteria
This enum defines the options for the bundle adjustment&#39;s convergence.