Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

Isis 3 Programmer Reference
BundleResults.cpp
1
6
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "BundleResults.h"
10
11#include <QDataStream>
12#include <QDebug>
13#include <QString>
14#include <QStringRef>
15#include <QtGlobal> // qMax()
16#include <QUuid>
17#include <QXmlStreamWriter>
18#include <QXmlStreamReader>
19
20#include <boost/lexical_cast.hpp>
21#include <boost/numeric/ublas/io.hpp>
22#include <boost/numeric/ublas/matrix_sparse.hpp>
23#include <boost/numeric/ublas/vector_proxy.hpp>
24
25#include "Camera.h"
26#include "ControlMeasure.h"
27#include "ControlPoint.h"
28#include "CorrelationMatrix.h"
29#include "Distance.h"
30#include "FileName.h"
31#include "IString.h"
32#include "MaximumLikelihoodWFunctions.h"
33#include "Project.h"
34#include "PvlKeyword.h"
35#include "PvlObject.h"
36#include "SerialNumberList.h"
37#include "StatCumProbDistDynCalc.h"
38#include "Statistics.h"
39
40#include <iostream>
41
42using namespace boost::numeric::ublas;
43
44namespace Isis {
45
52
53 initialize();
54
58
59 // residual prob distribution is calculated even if there is no maximum likelihood estimation.
60 // so set up the solver to have a node at every percent of the distribution
62
63 }
64
73 BundleResults::BundleResults(QXmlStreamReader *xmlReader,
74 QObject *parent) : QObject(parent)
75 {
76 // TODO: does xml stuff need project???
77
78 initialize();
79
80 readBundleResults(xmlReader);
81 }
82
83 void BundleResults::readBundleResults(QXmlStreamReader *xmlReader) {
84 Q_ASSERT(xmlReader->name() == "bundleResults");
85 while(xmlReader->readNextStartElement()) {
86 if (xmlReader->qualifiedName() == "correlationMatrix") {
87 readCorrelationMatrix(xmlReader);
88 }
89 else if (xmlReader->qualifiedName() == "generalStatisticsValues") {
90 readGenStatsValues(xmlReader);
91 }
92 else if (xmlReader->qualifiedName() == "rms") {
93 readRms(xmlReader);
94 }
95 else if (xmlReader->qualifiedName() == "elapsedTime") {
96
97 QStringView time = xmlReader->attributes().value("time");
98 if (!time.isEmpty()) {
99 m_elapsedTime = time.toDouble();
100 }
101
102 QStringView errorProp = xmlReader->attributes().value("errorProp");
103 if (!errorProp.isEmpty()) {
104 m_elapsedTimeErrorProp = errorProp.toDouble();
105 }
106 xmlReader->skipCurrentElement();
107 }
108 else if (xmlReader->qualifiedName() == "minMaxSigmas") {
109 readMinMaxSigmas(xmlReader);
110 }
111 else if (xmlReader->qualifiedName() == "maximumLikelihoodEstimation") {
112 readMaxLikelihoodEstimation(xmlReader);
113 }
114
115 // ??? else if (xmlReader->qualifiedName() == "minMaxSigmaDistances") {
116 // ??? QStringRef units = xmlReader->attributes().value("units");
117 // ??? if (!QStringRef::compare(units, "meters", Qt::CaseInsensitive)) {
118 // ??? QStringRef msg = "Unable to read BundleResults xml. Sigma distances must be "
119 // ??? "provided in meters.";
120 // ??? throw IException(IException::Io, msg, _FILEINFO_);
121 // ??? }
122 // ??? }
123 else {
124 xmlReader->skipCurrentElement();
125 }
126 }
127 }
128
129 void BundleResults::readCorrelationMatrix(QXmlStreamReader *xmlReader) {
130 Q_ASSERT(xmlReader->name() == "correlationMatrix");
131 m_correlationMatrix = NULL;
132 m_correlationMatrix = new CorrelationMatrix();
133
134 QString correlationFileName = xmlReader->attributes().value("correlationFileName").toString();
135 if (!correlationFileName.isEmpty()) {
136 FileName correlationFile(correlationFileName);
137 m_correlationMatrix->setCorrelationFileName(correlationFile);
138 }
139
140 QString covarianceFileName = xmlReader->attributes().value("covarianceFileName").toString();
141 if (!covarianceFileName.isEmpty()) {
142 FileName covarianceFile(covarianceFileName);
143 m_correlationMatrix->setCovarianceFileName(covarianceFile);
144 }
145 while (xmlReader->readNextStartElement()) {
146 if (xmlReader->qualifiedName() == "image") {
147 QString correlationMatrixImageId = xmlReader->attributes().value("id").toString();
148 if (!correlationMatrixImageId.isEmpty()) {
149 m_xmlHandlerCorrelationImageId = correlationMatrixImageId;
150 }
151 }
152 else {
153 xmlReader->skipCurrentElement();
154 }
155 }
156 }
157
158 void BundleResults::readGenStatsValues(QXmlStreamReader *xmlReader) {
159 Q_ASSERT(xmlReader->name() == "generalStatisticsValues");
160 while (xmlReader->readNextStartElement()) {
161 if (xmlReader->qualifiedName() == "numberFixedPoints") {
162 m_numberFixedPoints = toInt(xmlReader->readElementText());
163 }
164 else if (xmlReader->qualifiedName() == "numberIgnoredPoints") {
165 m_numberIgnoredPoints = xmlReader->readElementText().toInt();
166 }
167 else if (xmlReader->qualifiedName() == "numberHeldImages") {
168 m_numberHeldImages = xmlReader->readElementText().toInt();
169 }
170 else if (xmlReader->qualifiedName() == "rejectionLimit") {
171 m_rejectionLimit = xmlReader->readElementText().toDouble();
172 }
173 else if (xmlReader->qualifiedName() == "numberRejectedObservations") {
174 m_numberRejectedObservations = xmlReader->readElementText().toInt();
175 }
176 else if (xmlReader->qualifiedName() == "numberLidarRangeConstraintEquations") {
177 m_numberLidarRangeConstraintEquations = xmlReader->readElementText().toInt();
178 }
179 else if (xmlReader->qualifiedName() == "numberObservations") {
180 m_numberObservations = xmlReader->readElementText().toInt();
181 }
182 else if (xmlReader->qualifiedName() == "numberImageObservations") {
183 m_numberImageObservations = xmlReader->readElementText().toInt();
184 }
185 else if (xmlReader->qualifiedName() == "numberLidarImageObservations") {
186 m_numberLidarImageObservations = xmlReader->readElementText().toInt();
187 }
188 else if (xmlReader->qualifiedName() == "numberImageParameters") {
189 m_numberImageParameters = xmlReader->readElementText().toInt();
190 }
191 else if (xmlReader->qualifiedName() == "numberConstrainedPointParameters") {
193 xmlReader->readElementText().toInt();
194 }
195 else if (xmlReader->qualifiedName() == "numberConstrainedImageParameters") {
197 xmlReader->readElementText().toInt();
198 }
199 else if (xmlReader->qualifiedName() == "numberConstrainedTargetParameters") {
201 xmlReader->readElementText().toInt();
202 }
203 else if (xmlReader->qualifiedName() == "numberUnknownParameters") {
204 m_numberUnknownParameters = xmlReader->readElementText().toInt();
205 }
206 else if (xmlReader->qualifiedName() == "degreesOfFreedom") {
207 m_degreesOfFreedom = xmlReader->readElementText().toInt();
208 }
209 else if (xmlReader->qualifiedName() == "sigma0") {
210 m_sigma0 = xmlReader->readElementText().toDouble();
211 }
212 else if (xmlReader->qualifiedName() == "converged") {
213 m_converged = toBool(xmlReader->readElementText());
214 }
215 else if (xmlReader->qualifiedName() == "iterations") {
216 m_iterations = xmlReader->readElementText().toInt();
217 }
218 else {
219 xmlReader->skipCurrentElement();
220 }
221 }
222 }
223
224 void BundleResults::readRms(QXmlStreamReader *xmlReader) {
225 Q_ASSERT(xmlReader->name() == "rms");
226 while (xmlReader->readNextStartElement()) {
227 if (xmlReader->qualifiedName() == "residuals") {
228 QStringView rx = xmlReader->attributes().value("x");
229 if (!rx.isEmpty()) {
230 m_rmsXResiduals = rx.toDouble();
231 }
232
233 QStringView ry = xmlReader->attributes().value("y");
234 if (!ry.isEmpty()) {
235 m_rmsYResiduals = ry.toDouble();
236 }
237
238 QStringView rxy = xmlReader->attributes().value("xy");
239 if (!rxy.isEmpty()) {
240 m_rmsXYResiduals = rxy.toDouble();
241 }
242 xmlReader->skipCurrentElement();
243 }
244 else if (xmlReader->qualifiedName() == "sigmas")
245 {
246 QStringView lat = xmlReader->attributes().value("lat");
247 if (!lat.isEmpty()){
248 m_rmsSigmaCoord1Stats = lat.toDouble();
249 }
250
251 QStringView lon = xmlReader->attributes().value("lon");
252 if (!lon.isEmpty()){
253 m_rmsSigmaCoord2Stats = lon.toDouble();
254 }
255
256 QStringView rad = xmlReader->attributes().value("rad");
257 if (!rad.isEmpty()){
258 m_rmsSigmaCoord3Stats = rad.toDouble();
259 }
260
261 QStringView x = xmlReader->attributes().value("x");
262 if (!x.isEmpty()){
263 m_rmsSigmaCoord1Stats = x.toDouble();
264 }
265
266 QStringView y = xmlReader->attributes().value("y");
267 if (!y.isEmpty()){
268 m_rmsSigmaCoord2Stats = y.toDouble();
269 }
270
271 QStringView z = xmlReader->attributes().value("z");
272 if (!z.isEmpty()){
273 m_rmsSigmaCoord3Stats = z.toDouble();
274 }
275 xmlReader->skipCurrentElement();
276 }
277 else if (xmlReader->qualifiedName() == "imageResidualsLists") {
278 readImageResidualsLists(xmlReader);
279 }
280 else if (xmlReader->qualifiedName() == "imageSigmasLists") {
281 readSigmasLists(xmlReader);
282 }
283 else {
284 xmlReader->skipCurrentElement();
285 }
286 }
287 }
288
289 void BundleResults::readImageResidualsLists(QXmlStreamReader *xmlReader) {
290 Q_ASSERT(xmlReader->name() == "imageResidualsLists");
291 while (xmlReader->readNextStartElement()) {
292 if (xmlReader->qualifiedName() == "residualsList") {
293 readStatsToList(m_rmsImageResiduals, xmlReader);
294 }
295 else if (xmlReader->qualifiedName() == "sampleList") {
296 readStatsToList(m_rmsImageSampleResiduals, xmlReader);
297 }
298 else if (xmlReader->qualifiedName() == "lineList") {
299 readStatsToList(m_rmsImageLineResiduals, xmlReader);
300 }
301 else if (xmlReader->qualifiedName() == "lidarResidualsList") {
302 readStatsToList(m_rmsLidarImageResiduals, xmlReader);
303 }
304 else if (xmlReader->qualifiedName() == "lidarSampleList") {
305 readStatsToList(m_rmsLidarImageSampleResiduals, xmlReader);
306 }
307 else if (xmlReader->qualifiedName() == "lidarLineList") {
308 readStatsToList(m_rmsLidarImageLineResiduals, xmlReader);
309 }
310 else {
311 xmlReader->skipCurrentElement();
312 }
313 }
314 }
315
316 void BundleResults::readSigmasLists(QXmlStreamReader *xmlReader) {
317 Q_ASSERT(xmlReader->name() == "imageSigmasLists");
318 while (xmlReader->readNextStartElement()) {
319 if (xmlReader->qualifiedName() == "xSigmas") {
320 readStatsToVector(m_rmsImageXSigmas, xmlReader);
321 }
322 else if (xmlReader->qualifiedName() == "ySigmas") {
323 readStatsToVector(m_rmsImageYSigmas, xmlReader);
324 }
325 else if (xmlReader->qualifiedName() == "zSigmas") {
326 readStatsToVector(m_rmsImageZSigmas, xmlReader);
327 }
328 else if (xmlReader->qualifiedName() == "raSigmas") {
329 readStatsToVector(m_rmsImageRASigmas, xmlReader);
330 }
331 else if (xmlReader->qualifiedName() == "decSigmas") {
332 readStatsToVector(m_rmsImageDECSigmas, xmlReader);
333 }
334 else if (xmlReader->qualifiedName() == "twistSigmas") {
335 readStatsToVector(m_rmsImageTWISTSigmas, xmlReader);
336 }
337 else {
338 xmlReader->skipCurrentElement();
339 }
340 }
341 }
342
343 void BundleResults::readStatsToList(QList<Statistics> &list, QXmlStreamReader *xmlReader) {
344 Q_ASSERT(xmlReader->attributes().hasAttribute("listSize"));
345 int listSize = xmlReader->attributes().value("listSize").toInt();
346 for (int i = 0; i < listSize; i++) {
347 xmlReader->readNextStartElement();
348 Q_ASSERT(xmlReader->name() == "statisticsItem");
349 xmlReader->readNextStartElement();
350 Q_ASSERT(xmlReader->name() == "statistics");
351 list.append(new Statistics(xmlReader));
352 xmlReader->readNextStartElement();
353 }
354 xmlReader->readNextStartElement();
355 }
356
357 void BundleResults::readStatsToVector(QVector<Statistics> &vec, QXmlStreamReader *xmlReader) {
358 Q_ASSERT(xmlReader->attributes().hasAttribute("listSize"));
359 int listSize = xmlReader->attributes().value("listSize").toInt();
360 for (int i = 0; i < listSize; i++) {
361 xmlReader->readNextStartElement();
362 Q_ASSERT(xmlReader->name() == "statisticsItem");
363 xmlReader->readNextStartElement();
364 Q_ASSERT(xmlReader->name() == "statistics");
365 vec.append(new Statistics(xmlReader));
366 xmlReader->readNextStartElement();
367 }
368 xmlReader->readNextStartElement();
369 }
370
371 void BundleResults::readMinMaxSigmas(QXmlStreamReader *xmlReader) {
372 Q_ASSERT(xmlReader->name() == "minMaxSigmas");
373 while (xmlReader->readNextStartElement()) {
374 if (xmlReader->qualifiedName() == "minLat" ||
375 xmlReader->qualifiedName() == "minX") {
377 }
378 else if (xmlReader->qualifiedName() == "maxLat" ||
379 xmlReader->qualifiedName() == "maxX") {
381 }
382 else if (xmlReader->qualifiedName() == "minLon" ||
383 xmlReader->qualifiedName() == "minY") {
385 }
386 else if (xmlReader->qualifiedName() == "maxLon" ||
387 xmlReader->qualifiedName() == "maxY") {
389 }
390 else if (xmlReader->qualifiedName() == "minRad" ||
391 xmlReader->qualifiedName() == "minZ") {
393 }
394 else if (xmlReader->qualifiedName() == "maxRad" ||
395 xmlReader->qualifiedName() == "maxZ") {
397 }
398 else {
399 xmlReader->skipCurrentElement();
400 }
401 }
402 }
403
404 void BundleResults::readSigma(Distance &dist, QString &pointId, QXmlStreamReader *xmlReader) {
405 Q_ASSERT(xmlReader->attributes().hasAttribute("value"));
406 Q_ASSERT(xmlReader->attributes().hasAttribute("pointId"));
407 QStringView sigmaValue = xmlReader->attributes().value("value");
408 if (!sigmaValue.isEmpty()) {
409 dist.setMeters(sigmaValue.toDouble());
410 }
411
412 QString sigmaPointId = xmlReader->attributes().value("pointId").toString();
413 if (!sigmaPointId.isEmpty()) {
414 pointId = sigmaPointId;
415 }
416 xmlReader->skipCurrentElement();
417 }
418
419 void BundleResults::readMaxLikelihoodEstimation(QXmlStreamReader *xmlReader) {
420 Q_ASSERT(xmlReader->name() == "maximumLikelihoodEstimation");
421 QStringView maximumLikelihoodIndex = xmlReader->attributes().value("maximumLikelihoodIndex");
422 if (!maximumLikelihoodIndex.isEmpty()) {
423 m_maximumLikelihoodIndex = maximumLikelihoodIndex.toInt();
424 }
425
427 xmlReader->attributes().value("maximumLikelihoodMedianR2Residuals");
428 if (!maximumLikelihoodMedianR2Residuals.isEmpty()) {
431 }
432 while (xmlReader->readNextStartElement()) {
433 if (xmlReader->qualifiedName() == "cumulativeProbabilityCalculator") {
434 m_cumPro = NULL;
435 xmlReader->readNextStartElement();
436 if (xmlReader->qualifiedName() == "statCumProbDistDynCalc") {
437 m_cumPro = new StatCumProbDistDynCalc(xmlReader);
438 xmlReader->skipCurrentElement();
439 xmlReader->skipCurrentElement();
440 }
441 else {
442 m_cumPro = new StatCumProbDistDynCalc();
443 }
444 }
445 else if (xmlReader->qualifiedName() == "residualsCumulativeProbabilityCalculator") {
446 m_cumProRes = NULL;
447 xmlReader->readNextStartElement();
448 if (xmlReader->qualifiedName() == "statCumProbDistDynCalc") {
449 m_cumProRes = new StatCumProbDistDynCalc(xmlReader);
450 xmlReader->skipCurrentElement();
451 xmlReader->skipCurrentElement();
452 }
453 else {
454 m_cumProRes = new StatCumProbDistDynCalc();
455 }
456 }
457 else if (xmlReader->qualifiedName() == "model") {
458 QString model = xmlReader->attributes().value("modelSelection").toString();
459 QStringView tweakingConstant = xmlReader->attributes().value("tweakingConstant");
460 QStringView quantile = xmlReader->attributes().value("quantile");
461 bool validModel = true;
462 if (model.isEmpty())
463 validModel = false;
464 if (tweakingConstant.isEmpty())
465 validModel = false;
466 if (quantile.isEmpty())
467 validModel = false;
468 if (validModel)
469 {
471 qMakePair(MaximumLikelihoodWFunctions(
472 MaximumLikelihoodWFunctions::stringToModel(model),
473 tweakingConstant.toDouble()),
474 quantile.toDouble()));
475 }
476 xmlReader->skipCurrentElement();
477 }
478 else {
479 xmlReader->skipCurrentElement();
480 }
481 }
482 }
483
511 m_sigma0(src.m_sigma0),
514 m_converged(src.m_converged),
516 m_bundleLidarPoints(src.m_bundleLidarPoints),
517 m_outNet(src.m_outNet),
527 m_rmsImageXSigmas(src.m_rmsImageXSigmas),
553 {
554 }
555
560
561 delete m_correlationMatrix;
562 m_correlationMatrix = NULL;
563
564 delete m_cumPro;
565 m_cumPro = NULL;
566
567 delete m_cumProRes;
568 m_cumProRes = NULL;
569
570 }
571
572
580
581 if (&src != this) {
582 delete m_correlationMatrix;
583 m_correlationMatrix = NULL;
585
605 m_sigma0 = src.m_sigma0;
608 m_converged = src.m_converged;
610 m_bundleLidarPoints = src.m_bundleLidarPoints;
611 m_outNet = src.m_outNet;
621 m_rmsImageXSigmas = src.m_rmsImageXSigmas;
644
645 delete m_cumPro;
646 m_cumPro = NULL;
648
649 delete m_cumProRes;
650 m_cumProRes = NULL;
652
654 }
655 return *this;
656 }
657
658
665 m_correlationMatrix = NULL;
666
667 m_numberFixedPoints = 0; // set in BA constructor->init->fillPointIndexMap
668 m_numberIgnoredPoints = 0; // set in BA constructor->init->fillPointIndexMap
669
670
671 // set in BundleAdjust init()
673
674 // members set while computing bundle stats
677 m_rmsImageResiduals.clear();
681 m_rmsImageXSigmas.clear();
682 m_rmsImageYSigmas.clear();
683 m_rmsImageZSigmas.clear();
684 m_rmsImageRASigmas.clear();
685 m_rmsImageDECSigmas.clear();
686 m_rmsImageTWISTSigmas.clear();
687
688 // Initialize coordinate sigma boundaries. Units are meters for sigmas in both
689 // latitudinal and rectangular coordinates
690 m_minSigmaCoord1Distance.setMeters(1.0e+12);
691 m_maxSigmaCoord1Distance.setMeters(0.0);
692 m_minSigmaCoord2Distance.setMeters(1.0e+12);
693 m_maxSigmaCoord2Distance.setMeters(0.0);;
694 m_minSigmaCoord3Distance.setMeters(1.0e+12);
695 m_maxSigmaCoord3Distance.setMeters(0.0);
702
706
707
708 // set by compute residuals
709 m_rmsXResiduals = 0.0;
710 m_rmsYResiduals = 0.0;
711 m_rmsXYResiduals = 0.0;
712
713 // set by compute rejection limit
714 m_rejectionLimit = 0.0;
715
716 // set by flag outliers
718
719 // set by formNormalEquations_CHOLMOD, formNormalEquations_SPECIALK, or solve
724
725// ??? unused variable ??? m_numberHeldPoints = 0;
726
727 // set by formNormalEquations_CHOLMOD, formNormalEquations_SPECIALK, or
728 // setParameterWeights (i.e. solve)
734
735 // set by initialize, formNormalEquations_CHOLMOD, formNormalEquations_SPECIALK, or solve
737
738 // solve and solve cholesky
740 m_iterations = 0;
741 m_sigma0 = 0.0;
742 m_elapsedTime = 0.0;
744 m_converged = false; // or initialze method
745
746 m_cumPro = NULL;
750 m_cumProRes = NULL;
751
752 m_observations.clear();
753 m_outNet.clear();
754 m_outLidarData.clear();
755
756 }
757
758
765 m_rmsImageXSigmas.resize(numberImages);
766 m_rmsImageYSigmas.resize(numberImages);
767 m_rmsImageZSigmas.resize(numberImages);
768 m_rmsImageRASigmas.resize(numberImages);
769 m_rmsImageDECSigmas.resize(numberImages);
770 m_rmsImageTWISTSigmas.resize(numberImages);
771 }
772
773
788
789
804
805
814 void BundleResults::setSigmaCoord1Range(Distance minCoord1Dist, Distance maxCoord1Dist,
815 QString minCoord1PointId, QString maxCoord1PointId) {
816 m_minSigmaCoord1Distance = minCoord1Dist;
817 m_maxSigmaCoord1Distance = maxCoord1Dist;
818 m_minSigmaCoord1PointId = minCoord1PointId;
819 m_maxSigmaCoord1PointId = maxCoord1PointId;
820 }
821
822
831 void BundleResults::setSigmaCoord2Range(Distance minCoord2Dist, Distance maxCoord2Dist,
832 QString minCoord2PointId, QString maxCoord2PointId) {
833 m_minSigmaCoord2Distance = minCoord2Dist;
834 m_maxSigmaCoord2Distance = maxCoord2Dist;
835 m_minSigmaCoord2PointId = minCoord2PointId;
836 m_maxSigmaCoord2PointId = maxCoord2PointId;
837 }
838
839
848 void BundleResults::setSigmaCoord3Range(Distance minCoord3Dist, Distance maxCoord3Dist,
849 QString minCoord3PointId, QString maxCoord3PointId) {
850 m_minSigmaCoord3Distance = minCoord3Dist;
851 m_maxSigmaCoord3Distance = maxCoord3Dist;
852 m_minSigmaCoord3PointId = minCoord3PointId;
853 m_maxSigmaCoord3PointId = maxCoord3PointId;
854 }
855
856
865 double rmsFromSigmaCoord1Stats,
866 double rmsFromSigmaCoord2Stats,
867 double rmsFromSigmaCoord3Stats) {
868 m_rmsSigmaCoord1Stats = rmsFromSigmaCoord1Stats;
869 m_rmsSigmaCoord2Stats = rmsFromSigmaCoord2Stats;
870 m_rmsSigmaCoord3Stats = rmsFromSigmaCoord3Stats;
871 }
872
873
882 QList< QPair< MaximumLikelihoodWFunctions::Model, double > > modelsWithQuantiles) {
883
884
885 // reinitialize variables if this setup has already been called
888
889 // residual prob distribution is calculated even if there is no maximum likelihood estimation.
890 // set up the solver to have a node at every percent of the distribution
891 m_cumProRes = NULL;
894
895 // if numberMaximumLikelihoodModels > 0, then MaximumLikeliHood Estimation is being used.
896 for (int i = 0; i < modelsWithQuantiles.size(); i++) {
897
898 // if maximum likelihood is being used, the cum prob calculator is initialized.
899 if (i == 0) {
900 m_cumPro = NULL;
902 // set up the solver to have a node at every percent of the distribution
904 }
905
906 // set up the w functions for the maximum likelihood estimation
908 qMakePair(MaximumLikelihoodWFunctions(modelsWithQuantiles[i].first),
909 modelsWithQuantiles[i].second));
910
911 }
912
913
914 //maximum likelihood estimation tiered solutions requiring multiple convergeances are supported,
915 // this index keeps track of which tier the solution is in
917 }
918
919
924// printf("Maximum Likelihood Tier: %d\n", m_maximumLikelihoodIndex);
926 // if maximum likelihood estimation is being used
927 // at the end of every iteration
928 // reset the tweaking contant to the desired quantile of the |residual| distribution
930 double tc = m_cumPro->value(quantile);
931 m_maximumLikelihoodFunctions[m_maximumLikelihoodIndex].first.setTweakingConstant(tc);
932 // print meadians of residuals
934// printf("Median of R^2 residuals: %lf\n", m_maximumLikelihoodMedianR2Residuals);
935
936 //restart the dynamic calculation of the cumulative probility distribution of |R^2 residuals|
937 // so it will be up to date for the next iteration
939 }
940 }
941
942
949 m_cumPro->setQuantiles(nodes);
950 }
951
952
959 m_cumProRes->setQuantiles(nodes);
960 }
961
962
970 m_cumPro->addObs(observationValue);
971 }
972
973
981 m_cumProRes->addObs(observationValue);
982 }
983
984
992
993
1000
1001
1010
1011
1018
1019
1026 return m_numberHeldImages;
1027 }
1028
1029
1036
1037
1046
1047
1055 void BundleResults::setRmsXYResiduals(double rx, double ry, double rxy) {
1056 m_rmsXResiduals = rx;
1057 m_rmsYResiduals = ry;
1058 m_rmsXYResiduals = rxy;
1059 }
1060
1061
1070
1071
1080
1081
1090
1091
1103
1104
1110 void BundleResults::setNumberLidarImageObservations(int numberLidarObservations) {
1111 m_numberLidarImageObservations = numberLidarObservations;
1112 }
1113
1114
1120 void BundleResults::setNumberImageParameters(int numberParameters) {
1121 m_numberImageParameters = numberParameters;
1122 }
1123
1124
1131 m_numberConstrainedPointParameters = numberParameters;
1132 }
1133
1134
1143
1144
1151
1152
1161
1162
1169
1170
1179
1180
1187
1188
1197
1198
1205 m_numberUnknownParameters = numberParameters;
1206 }
1207
1208
1214 void BundleResults::setNumberLidarRangeConstraints(int numberLidarRangeConstraints) {
1215 m_numberLidarRangeConstraintEquations = numberLidarRangeConstraints;
1216 }
1217
1218
1232
1233
1252
1253 if (m_degreesOfFreedom > 0) {
1254 m_sigma0 = dvtpv / m_degreesOfFreedom;
1255 }
1256 else if (m_degreesOfFreedom == 0 && criteria == BundleSettings::ParameterCorrections) {
1257 m_sigma0 = dvtpv;
1258 }
1259 else {
1260 QString msg = "Computed degrees of freedom [" + toString(m_degreesOfFreedom)
1261 + "] is invalid.";
1262 throw IException(IException::Io, msg, _FILEINFO_);
1263 }
1264
1265 m_sigma0 = sqrt(m_sigma0);
1266 }
1267
1268
1277
1278
1284 void BundleResults::setSigma0(double sigma0) { // old sparse
1285 m_sigma0 = sigma0;
1286 }
1287
1288
1295 m_elapsedTime = time;
1296 }
1297
1298
1307
1308
1315 m_converged = converged;
1316 }
1317
1318
1327
1328
1335 m_bundleLidarPoints = lidarPoints;
1336 }
1337
1338
1345 m_outNet = outNet;
1346 }
1347
1348
1355 m_outLidarData = outLidarData;
1356 }
1357
1358
1367
1368
1377
1378
1379
1380 //************************* Accessors **********************************************************//
1381
1390
1391
1400
1401
1410
1411
1420
1421
1430
1431
1440
1441
1448 return m_rmsImageXSigmas;
1449 }
1450
1451
1460
1461
1470
1471
1480
1481
1490
1491
1500
1501
1510
1511
1520
1521
1530
1531
1540
1541
1550
1551
1560
1561
1570
1571
1580
1581
1590
1591
1600
1601
1610
1611
1620
1621
1630
1631
1640
1641
1650
1651
1657 double BundleResults::rmsRx() const {
1658 return m_rmsXResiduals;
1659 }
1660
1661
1667 double BundleResults::rmsRy() const {
1668 return m_rmsYResiduals;
1669 }
1670
1671
1677 double BundleResults::rmsRxy() const {
1678 return m_rmsXYResiduals;
1679 }
1680
1681
1688 return m_rejectionLimit;
1689 }
1690
1691
1700
1701
1710
1711
1720
1721
1730
1731
1740
1741
1750
1751
1760
1761
1770
1771
1780
1781
1790
1791
1798 return m_degreesOfFreedom;
1799 }
1800
1801
1807 double BundleResults::sigma0() const {
1808 return m_sigma0;
1809 }
1810
1811
1818 return m_elapsedTime;
1819 }
1820
1821
1830
1831
1838 return m_converged;
1839 }
1840
1841
1850
1851
1860
1861
1870 if (!m_outNet) {
1871 throw IException(IException::Programmer,
1872 "Output Control Network has not been set.",
1873 _FILEINFO_);
1874 }
1875 return m_outNet;
1876 }
1877
1878
1889
1890
1897 return m_iterations;
1898 }
1899
1900
1909
1910
1919
1920
1929
1930
1940
1941
1950
1951
1960
1961
1972
1973
1982 return m_maximumLikelihoodFunctions[modelIndex].second;
1983 }
1984
1985
1986// QList< QPair< MaximumLikelihoodWFunctions, double > >
1987// BundleResults::maximumLikelihoodModels() const {
1988// return m_maximumLikelihoodFunctions;
1989// }
1990
1991
2000 if (m_correlationMatrix) {
2001 return *m_correlationMatrix;
2002 }
2003 else {
2004 throw IException(IException::Unknown,
2005 "Correlation matrix for this bundle is NULL.",
2006 _FILEINFO_);
2007 }
2008 }
2009
2010
2017 correlationMatrix();// throw error if null
2018 m_correlationMatrix->setCovarianceFileName(name);
2019 }
2020
2021
2028 correlationMatrix();// throw error if null
2029 m_correlationMatrix->setImagesAndParameters(imgsAndParams);
2030 }
2031
2032
2033 SurfacePoint::CoordinateType BundleResults::coordTypeReports() {
2034 // Get the coordinate type from the output net if it exists. Otherwise use the default.
2036
2037 if (m_outNet) {
2038 type = outputControlNet()->GetCoordType();
2039 }
2040
2041 return type;
2042 }
2043
2044
2051 void BundleResults::save(QXmlStreamWriter &stream, const Project *project) const {
2052 // Get the coordinate type from the output net if it exists. Otherwise use the default.
2054
2055 if (m_outNet) {
2056 coordType = outputControlNet()->GetCoordType();
2057 }
2058
2059 stream.writeStartElement("bundleResults");
2060 stream.writeStartElement("correlationMatrix");
2061 stream.writeAttribute("correlationFileName",
2062 correlationMatrix().correlationFileName().expanded());
2063 stream.writeAttribute("covarianceFileName",
2064 correlationMatrix().covarianceFileName().expanded());
2065 stream.writeStartElement("imagesAndParameters");
2066 QMapIterator<QString, QStringList> imgParamIt(*correlationMatrix().imagesAndParameters());
2067 while (imgParamIt.hasNext()) {
2068 imgParamIt.next();
2069 stream.writeStartElement("image");
2070 stream.writeAttribute("id", imgParamIt.key());
2071 QStringList parameters = imgParamIt.value();
2072 for (int i = 0; i < parameters.size(); i++) {
2073 stream.writeTextElement("parameter", parameters[i]);
2074 }
2075 stream.writeEndElement(); // end image
2076
2077 }
2078 stream.writeEndElement(); // end images and parameters
2079 stream.writeEndElement(); // end correlationMatrix
2080
2081 stream.writeStartElement("generalStatisticsValues");
2082 stream.writeTextElement("numberFixedPoints", toString(numberFixedPoints()));
2083 stream.writeTextElement("numberIgnoredPoints", toString(numberIgnoredPoints()));
2084 stream.writeTextElement("numberHeldImages", toString(numberHeldImages()));
2085 stream.writeTextElement("rejectionLimit", toString(rejectionLimit()));
2086 stream.writeTextElement("numberRejectedObservations", toString(numberRejectedObservations()));
2087 stream.writeTextElement("numberObservations", toString(numberObservations()));
2088 stream.writeTextElement("numberLidarRangeConstraintEquations", toString(numberLidarRangeConstraintEquations()));
2089 stream.writeTextElement("numberImageObservations", toString(numberImageObservations()));
2090 stream.writeTextElement("numberLidarImageObservations", toString(numberLidarImageObservations()));
2091 stream.writeTextElement("numberImageParameters", toString(numberImageParameters()));
2092 stream.writeTextElement("numberConstrainedPointParameters",
2094 stream.writeTextElement("numberConstrainedImageParameters",
2096 stream.writeTextElement("numberConstrainedTargetParameters",
2098 stream.writeTextElement("numberUnknownParameters", toString(numberUnknownParameters()));
2099 stream.writeTextElement("degreesOfFreedom", toString(degreesOfFreedom()));
2100 stream.writeTextElement("sigma0", toString(sigma0()));
2101 stream.writeTextElement("converged", toString(converged()));
2102 stream.writeTextElement("iterations", toString(iterations()));
2103 stream.writeEndElement(); // end generalStatisticsValues
2104
2105 stream.writeStartElement("rms");
2106 stream.writeStartElement("residuals");
2107 stream.writeAttribute("x", toString(rmsRx()));
2108 stream.writeAttribute("y", toString(rmsRy()));
2109 stream.writeAttribute("xy", toString(rmsRxy()));
2110 stream.writeEndElement(); // end residuals element
2111 stream.writeStartElement("sigmas");
2112
2113 // Set the label based of the coordinate type set for reports
2114 switch (coordType) {
2116 stream.writeAttribute("lat", toString(sigmaCoord1StatisticsRms()));
2117 stream.writeAttribute("lon", toString(sigmaCoord2StatisticsRms()));
2118 stream.writeAttribute("rad", toString(sigmaCoord3StatisticsRms()));
2119 break;
2121 stream.writeAttribute("x", toString(sigmaCoord1StatisticsRms()));
2122 stream.writeAttribute("y", toString(sigmaCoord2StatisticsRms()));
2123 stream.writeAttribute("z", toString(sigmaCoord3StatisticsRms()));
2124 break;
2125 default:
2126 IString msg ="Unknown surface point coordinate type enum [" + toString(coordType) + "]." ;
2127 throw IException(IException::Programmer, msg, _FILEINFO_);
2128 }
2129 stream.writeEndElement(); // end sigmas element
2130
2131 stream.writeStartElement("imageResidualsLists");
2132 stream.writeStartElement("residualsList");
2133 stream.writeAttribute("listSize", toString((int)rmsImageResiduals().size()));
2134 for (int i = 0; i < m_rmsImageResiduals.size(); i++) {
2135 stream.writeStartElement("statisticsItem");
2136 m_rmsImageResiduals[i].save(stream, project);
2137 stream.writeEndElement(); // end statistics item
2138 }
2139 stream.writeEndElement(); // end residuals list
2140 stream.writeStartElement("sampleList");
2141 stream.writeAttribute("listSize", toString((int)rmsImageSampleResiduals().size()));
2142 for (int i = 0; i < m_rmsImageSampleResiduals.size(); i++) {
2143 stream.writeStartElement("statisticsItem");
2144 m_rmsImageSampleResiduals[i].save(stream, project);
2145 stream.writeEndElement(); // end statistics item
2146 }
2147 stream.writeEndElement(); // end sample residuals list
2148
2149 stream.writeStartElement("lineList");
2150 stream.writeAttribute("listSize", toString((int)rmsImageLineResiduals().size()));
2151 for (int i = 0; i < m_rmsImageLineResiduals.size(); i++) {
2152 stream.writeStartElement("statisticsItem");
2153 m_rmsImageLineResiduals[i].save(stream, project);
2154 stream.writeEndElement(); // end statistics item
2155 }
2156 stream.writeEndElement(); // end line residuals list
2157
2158 stream.writeStartElement("lidarResidualsList");
2159 stream.writeAttribute("listSize", toString((int)rmsLidarImageResiduals().size()));
2160 for (int i = 0; i < m_rmsLidarImageResiduals.size(); i++) {
2161 stream.writeStartElement("statisticsItem");
2162 m_rmsLidarImageResiduals[i].save(stream, project);
2163 stream.writeEndElement(); // end statistics item
2164 }
2165 stream.writeEndElement(); // end line residuals list
2166
2167 stream.writeStartElement("lidarSampleList");
2168 stream.writeAttribute("listSize", toString((int)rmsLidarImageSampleResiduals().size()));
2169 for (int i = 0; i < m_rmsLidarImageSampleResiduals.size(); i++) {
2170 stream.writeStartElement("statisticsItem");
2171 m_rmsLidarImageSampleResiduals[i].save(stream, project);
2172 stream.writeEndElement(); // end statistics item
2173 }
2174 stream.writeEndElement(); // end line residuals list
2175
2176 stream.writeStartElement("lidarLineList");
2177 stream.writeAttribute("listSize", toString((int)rmsLidarImageLineResiduals().size()));
2178 for (int i = 0; i < m_rmsLidarImageLineResiduals.size(); i++) {
2179 stream.writeStartElement("statisticsItem");
2180 m_rmsLidarImageLineResiduals[i].save(stream, project);
2181 stream.writeEndElement(); // end statistics item
2182 }
2183 stream.writeEndElement(); // end line residuals list
2184 stream.writeEndElement(); // end image residuals lists
2185
2186 stream.writeStartElement("imageSigmasLists");
2187 stream.writeStartElement("xSigmas");
2188 stream.writeAttribute("listSize", toString((int)rmsImageXSigmas().size()));
2189 for (int i = 0; i < m_rmsImageXSigmas.size(); i++) {
2190 stream.writeStartElement("statisticsItem");
2191 m_rmsImageXSigmas[i].save(stream, project);
2192 stream.writeEndElement(); // end statistics item
2193 }
2194
2195 stream.writeEndElement(); // end x sigma list
2196
2197 stream.writeStartElement("ySigmas");
2198 stream.writeAttribute("listSize", toString((int)rmsImageYSigmas().size()));
2199 for (int i = 0; i < m_rmsImageYSigmas.size(); i++) {
2200 stream.writeStartElement("statisticsItem");
2201 m_rmsImageYSigmas[i].save(stream, project);
2202 stream.writeEndElement(); // end statistics item
2203 }
2204 stream.writeEndElement(); // end y sigma list
2205
2206 stream.writeStartElement("zSigmas");
2207 stream.writeAttribute("listSize", toString((int)rmsImageZSigmas().size()));
2208 for (int i = 0; i < m_rmsImageZSigmas.size(); i++) {
2209 stream.writeStartElement("statisticsItem");
2210 m_rmsImageZSigmas[i].save(stream, project);
2211 stream.writeEndElement(); // end statistics item
2212 }
2213 stream.writeEndElement(); // end z sigma list
2214
2215 stream.writeStartElement("raSigmas");
2216 stream.writeAttribute("listSize", toString((int)rmsImageRASigmas().size()));
2217 for (int i = 0; i < m_rmsImageRASigmas.size(); i++) {
2218 stream.writeStartElement("statisticsItem");
2219 m_rmsImageRASigmas[i].save(stream, project);
2220 stream.writeEndElement(); // end statistics item
2221 }
2222 stream.writeEndElement(); // end ra sigma list
2223
2224 stream.writeStartElement("decSigmas");
2225 stream.writeAttribute("listSize", toString((int)rmsImageDECSigmas().size()));
2226 for (int i = 0; i < m_rmsImageDECSigmas.size(); i++) {
2227 stream.writeStartElement("statisticsItem");
2228 m_rmsImageDECSigmas[i].save(stream, project);
2229 stream.writeEndElement(); // end statistics item
2230 }
2231 stream.writeEndElement(); // end dec sigma list
2232
2233 stream.writeStartElement("twistSigmas");
2234 stream.writeAttribute("listSize", toString((int)rmsImageTWISTSigmas().size()));
2235 for (int i = 0; i < m_rmsImageTWISTSigmas.size(); i++) {
2236 stream.writeStartElement("statisticsItem");
2237 m_rmsImageTWISTSigmas[i].save(stream, project);
2238 stream.writeEndElement(); // end statistics item
2239 }
2240 stream.writeEndElement(); // end twist sigma list
2241 stream.writeEndElement(); // end sigmas lists
2242 stream.writeEndElement(); // end rms
2243
2244 stream.writeStartElement("elapsedTime");
2245 stream.writeAttribute("time", toString(elapsedTime()));
2246 stream.writeAttribute("errorProp", toString(elapsedTimeErrorProp()));
2247 stream.writeEndElement(); // end elapsed time
2248
2249 stream.writeStartElement("minMaxSigmas");
2250
2251 // Write the labels corresponding to the coordinate type set for reports
2252 switch (coordType) {
2254 stream.writeStartElement("minLat");
2255 stream.writeAttribute("value", toString(minSigmaCoord1Distance().meters()));
2256 stream.writeAttribute("pointId", minSigmaCoord1PointId());
2257 stream.writeEndElement();
2258 stream.writeStartElement("maxLat");
2259 stream.writeAttribute("value", toString(maxSigmaCoord1Distance().meters()));
2260 stream.writeAttribute("pointId", maxSigmaCoord1PointId());
2261 stream.writeEndElement();
2262 stream.writeStartElement("minLon");
2263 stream.writeAttribute("value", toString(minSigmaCoord2Distance().meters()));
2264 stream.writeAttribute("pointId", minSigmaCoord2PointId());
2265 stream.writeEndElement();
2266 stream.writeStartElement("maxLon");
2267 stream.writeAttribute("value", toString(maxSigmaCoord2Distance().meters()));
2268 stream.writeAttribute("pointId", maxSigmaCoord2PointId());
2269 stream.writeEndElement();
2270 stream.writeStartElement("minRad");
2271 stream.writeAttribute("value", toString(minSigmaCoord3Distance().meters()));
2272 stream.writeAttribute("pointId", minSigmaCoord3PointId());
2273 stream.writeEndElement();
2274 stream.writeStartElement("maxRad");
2275 stream.writeAttribute("value", toString(maxSigmaCoord3Distance().meters()));
2276 stream.writeAttribute("pointId", maxSigmaCoord3PointId());
2277 stream.writeEndElement();
2278 break;
2280 stream.writeStartElement("minX");
2281 stream.writeAttribute("value", toString(minSigmaCoord1Distance().meters()));
2282 stream.writeAttribute("pointId", minSigmaCoord1PointId());
2283 stream.writeEndElement();
2284 stream.writeStartElement("maxX");
2285 stream.writeAttribute("value", toString(maxSigmaCoord1Distance().meters()));
2286 stream.writeAttribute("pointId", maxSigmaCoord1PointId());
2287 stream.writeEndElement();
2288 stream.writeStartElement("minY");
2289 stream.writeAttribute("value", toString(minSigmaCoord2Distance().meters()));
2290 stream.writeAttribute("pointId", minSigmaCoord2PointId());
2291 stream.writeEndElement();
2292 stream.writeStartElement("maxY");
2293 stream.writeAttribute("value", toString(maxSigmaCoord2Distance().meters()));
2294 stream.writeAttribute("pointId", maxSigmaCoord2PointId());
2295 stream.writeEndElement();
2296 stream.writeStartElement("minZ");
2297 stream.writeAttribute("value", toString(minSigmaCoord3Distance().meters()));
2298 stream.writeAttribute("pointId", minSigmaCoord3PointId());
2299 stream.writeEndElement();
2300 stream.writeStartElement("maxZ");
2301 stream.writeAttribute("value", toString(maxSigmaCoord3Distance().meters()));
2302 stream.writeAttribute("pointId", maxSigmaCoord3PointId());
2303 stream.writeEndElement();
2304 break;
2305 default:
2306 IString msg ="Unknown surface point coordinate type enum [" + toString(coordType) + "]." ;
2307 throw IException(IException::Programmer, msg, _FILEINFO_);
2308 }
2309 stream.writeEndElement(); // end minMaxSigmas
2310
2311 // call max likelihood setup from startElement to fill the rest of these values...
2312 stream.writeStartElement("maximumLikelihoodEstimation");
2313 stream.writeAttribute("numberModels", toString(numberMaximumLikelihoodModels()));
2314 stream.writeAttribute("maximumLikelihoodIndex", toString(maximumLikelihoodModelIndex()));
2315 stream.writeAttribute("maximumLikelihoodMedianR2Residuals",
2317
2318 stream.writeStartElement("cumulativeProbabilityCalculator");
2319 cumulativeProbabilityDistribution().save(stream, project);
2320 stream.writeEndElement(); // end cumulativeProbabilityCalculator
2321
2322 stream.writeStartElement("residualsCumulativeProbabilityCalculator");
2323 residualsCumulativeProbabilityDistribution().save(stream, project);
2324 stream.writeEndElement(); // end residualsCumulativeProbabilityCalculator
2325
2326 for (int i = 0; i < numberMaximumLikelihoodModels(); i++) {
2327 stream.writeStartElement("model");
2328 stream.writeAttribute("modelNumber", toString(i+1));
2329 stream.writeAttribute("modelSelection",
2331 stream.writeAttribute("tweakingConstant",
2332 toString(m_maximumLikelihoodFunctions[i].first.tweakingConstant()));
2333 stream.writeAttribute("quantile", toString(m_maximumLikelihoodFunctions[i].second));
2334 stream.writeEndElement(); // end this model
2335 }
2336 stream.writeEndElement(); // end maximumLikelihoodEstimation
2337 stream.writeEndElement(); // end bundleResults
2338 }
2339}
This class is a container class for BundleObservations.
void addProbabilityDistributionObservation(double obsValue)
Adds an observation to the cumulative probability distribution of |R^2 residuals|.
void incrementNumberConstrainedImageParameters(int incrementAmount)
Increase the number of constrained image parameters.
~BundleResults()
Destroys this BundleResults object.
QString m_minSigmaCoord1PointId
The minimum sigma coordinate 1 point id.
QVector< Statistics > m_rmsImageTWISTSigmas
< The root mean square image twist sigmas.
double elapsedTimeErrorProp() const
Returns the elapsed time for error propagation.
int numberRejectedObservations() const
Returns the number of observation that were rejected.
int m_numberUnknownParameters
total number of parameters to solve for
QString minSigmaCoord2PointId() const
Returns the minimum sigma point id for coordinate 2.
void setSigma0(double sigma0)
Sets the sigma0.
double rejectionLimit() const
Returns the rejection limit.
int m_degreesOfFreedom
degrees of freedom
QList< Statistics > m_rmsLidarImageResiduals
RMS image lidar sample & line residual stats for each image in the bundle.
int m_numberFixedPoints
number of 'fixed' (ground) points (define)
void incrementNumberConstrainedPointParameters(int incrementAmount)
Increase the number of contrained point parameters.
double rmsRxy() const
Returns the RMS of the x and y residuals.
QList< Statistics > rmsImageSampleResiduals() const
Returns the list of RMS image sample residuals statistics.
QList< Statistics > m_rmsLidarImageSampleResiduals
List of RMS lidar sample residual stats for each image in the bundle.
int m_numberConstrainedTargetParameters
number of constrained target parameters
BundleObservationVector m_observations
The vector of BundleObservations from BundleAdjust.
BundleResults(QObject *parent=0)
Constructs a BundleResults object.
ControlNetQsp outputControlNet() const
Returns a shared pointer to the output control network.
int numberObservations() const
Returns the number of observations.
void setElapsedTime(double time)
Sets the elapsed time for the bundle adjustment.
Distance m_maxSigmaCoord3Distance
The maximum sigma radius distance.
MaximumLikelihoodWFunctions maximumLikelihoodModelWFunc(int modelIndex) const
Returns the maximum likelihood model at the given index.
void incrementHeldImages()
Increases the number of 'held' images.
int m_numberLidarImageObservations
lidar image coords. (2 per measure)
double m_maximumLikelihoodMedianR2Residuals
Median of R^2 residuals.
double sigmaCoord3StatisticsRms() const
Returns the RMS of the adjusted sigmas for coordinate 3.
double m_rmsXResiduals
rms of x residuals
double m_rmsSigmaCoord3Stats
rms of adjusted Radius sigmas
void initializeProbabilityDistribution(unsigned int nodes=20)
Initializes or resets the cumulative probability distribution of |R^2 residuals|.
void incrementIgnoredPoints()
Increase the number of ignored points.
void incrementFixedPoints()
Increase the number of 'fixed' (ground) points.
void setBundleControlPoints(QVector< BundleControlPointQsp > controlPoints)
Sets the bundle control point vector.
void setNumberConstrainedPointParameters(int numberParameters)
Set number of contrained point parameters.
void setBundleLidarPoints(QVector< BundleLidarControlPointQsp > lidarPoints)
Sets the bundle lidar point vector.
double sigma0() const
Returns the Sigma0 of the bundle adjustment.
QVector< Statistics > m_rmsImageZSigmas
< The root mean square image z sigmas.
void setIterations(int iterations)
Sets the number of iterations taken by the BundleAdjust.
bool converged() const
Returns whether or not the bundle adjustment converged.
Distance m_maxSigmaCoord1Distance
The maximum sigma latitude distance.
double maximumLikelihoodModelQuantile(int modelIndex) const
Returns the quantile of the maximum likelihood model at the given index.
int m_numberImageObservations
photogrammetry image coords. (2 per measure)
void setSigmaCoord1Range(Distance minCoord1Dist, Distance maxCoord1Dist, QString minCoord1PointId, QString maxCoord1PointId)
Sets the min and max sigma distances and point ids for coordinate 1.
void incrementMaximumLikelihoodModelIndex()
Increases the value that indicates which stage the maximum likelihood adjustment is currently on.
QVector< Statistics > rmsImageDECSigmas() const
Returns the list of RMS image declination sigma statistics.
QString m_maxSigmaCoord1PointId
The maximum sigma coordinate 1 point id.
QVector< Statistics > m_rmsImageYSigmas
< The root mean square image y sigmas.
QList< Statistics > rmsLidarImageSampleResiduals() const
Returns the list of RMS image lidar sample residuals statistics.
void setOutputControlNet(ControlNetQsp outNet)
Sets the output ControlNet.
int m_iterations
The number of iterations taken by BundleAdjust.
double m_rmsXYResiduals
rms of all x and y residuals
int m_numberLidarRangeConstraintEquations
void setSigmaCoord2Range(Distance minCoord2Dist, Distance maxCoord2Dist, QString minCoord2PointId, QString maxCoord2PointId)
Sets the min and max sigma distances and point ids for coordinate 2.
int numberConstrainedPointParameters() const
Returns the number of constrained point parameters.
double rmsRy() const
Returns the RMS of the y residuals.
void resetNumberConstrainedImageParameters()
Resets the number of constrained image parameters to 0.
int m_numberIgnoredPoints
number of ignored points
void computeDegreesOfFreedom()
Computes the degrees of freedom of the bundle adjustment and stores it internally.
Distance m_minSigmaCoord2Distance
The minimum sigma longitude distance.
int iterations() const
Returns the number of iterations taken by the BundleAdjust.
CorrelationMatrix correlationMatrix() const
Returns the Correlation Matrix.
void setNumberRejectedObservations(int numberObservations)
Sets the number of rejected observations.
QString minSigmaCoord1PointId() const
Returns the minimum sigma point id for coordinate 1.
double m_rejectionLimit
current rejection limit
QVector< Statistics > rmsImageYSigmas() const
Returns the list of RMS image y sigma statistics.
QString m_minSigmaCoord2PointId
The minimum sigma coordinate 2 point id.
void maximumLikelihoodSetUp(QList< QPair< MaximumLikelihoodWFunctions::Model, double > > modelsWithQuantiles)
This method steps up the maximum likelihood estimation solution.
void save(QXmlStreamWriter &stream, const Project *project) const
Saves the BundleResults object to an XML file.
int m_numberConstrainedImageParameters
number of constrained image parameters
int numberIgnoredPoints() const
Returns the number of ignored points.
QVector< BundleControlPointQsp > & bundleControlPoints()
Returns a reference to the BundleControlPoint vector.
void setCorrMatImgsAndParams(QMap< QString, QStringList > imgsAndParams)
Set the images and their associated parameters of the correlation matrix.
Distance maxSigmaCoord2Distance() const
Returns the maximum sigma distance for coordinate 2.
QString m_minSigmaCoord3PointId
The minimum sigma coordinate 3 point id.
int numberUnknownParameters() const
Returns the number of unknown parameters.
void addResidualsProbabilityDistributionObservation(double obsValue)
Adds an observation to the cumulative probability distribution of residuals used for reporting.
QVector< BundleLidarControlPointQsp > & bundleLidarControlPoints()
Returns a reference to the BundleLidarControlPoint vector.
int m_numberImageParameters
number of image parameters
double m_sigma0
std deviation of unit weight
int numberImageParameters() const
Returns the total number of image parameters.
QList< Statistics > rmsLidarImageLineResiduals() const
Returns the list of RMS image lidar line residuals statistics.
int m_maximumLikelihoodIndex
This count keeps track of which stage of the maximum likelihood adjustment the bundle is currently on...
QList< Statistics > m_rmsImageLineResiduals
List of RMS image line residual statistics for each image in the bundle.
int numberMaximumLikelihoodModels() const
Returns how many maximum likelihood models were used in the bundle adjustment.
StatCumProbDistDynCalc * m_cumProRes
This class keeps track of the cumulative probability distribution of residuals (in unweighted pixels)...
void setNumberLidarRangeConstraints(int numberLidarRangeConstraints)
Sets the total number of lidar range constraints.
int maximumLikelihoodModelIndex() const
Returns which step the bundle adjustment is on.
LidarDataQsp outputLidarData() const
Returns a shared pointer to the output LidarData object.
int m_numberConstrainedPointParameters
number of constrained point parameters
int m_numberConstrainedLidarPointParameters
lidar points
int m_numberRejectedObservations
number of rejected image coordinate observations
int numberHeldImages() const
Returns the number of 'held' images.
double sigmaCoord2StatisticsRms() const
Returns the RMS of the adjusted sigmas for coordinate 2.
StatCumProbDistDynCalc * m_cumPro
This class will be used to calculate the cumulative probability distribution of |R^2 residuals|,...
int m_numberObservations
number of image coordinate observations
void setRejectionLimit(double rejectionLimit)
Sets the rejection limit.
Distance minSigmaCoord3Distance() const
Returns the minimum sigma distance for coordinate 3.
int numberLidarImageObservations() const
Returns the number of lidar observations.
void incrementNumberConstrainedTargetParameters(int incrementAmount)
Increases the number of constrained target parameters.
QVector< BundleControlPointQsp > m_bundleControlPoints
The vector of BundleControlPoints from BundleAdjust.
void setOutputLidarData(LidarDataQsp outLidarData)
Sets the output LidarData object.
double m_rmsSigmaCoord2Stats
rms of adjusted Longitude sigmas
void setNumberImageObservations(int numberObservations)
Sets the number of photogrammetric image observations.
void setRmsImageResidualLists(QList< Statistics > rmsImageLineResiduals, QList< Statistics > rmsImageSampleResiduals, QList< Statistics > rmsImageResiduals)
Sets the root mean square image residual Statistics lists.
double maximumLikelihoodMedianR2Residuals() const
Returns the median of the |R^2 residuals|.
int numberFixedPoints() const
Returns the number of 'fixed' (ground) points.
QString maxSigmaCoord1PointId() const
Returns the maximum sigma point id for coordinate 1.
int numberImageObservations() const
Returns the number of observations.
LidarDataQsp m_outLidarData
Output lidar data from BundleAdjust.
void setNumberLidarImageObservations(int numberLidarObservations)
Sets the number of lidar observations.
void resetNumberConstrainedPointParameters()
Resets the number of contrained point parameters to 0.
void setNumberImageParameters(int numberParameters)
Sets the number of image parameters.
int numberConstrainedTargetParameters() const
Return the number of constrained target parameters.
StatCumProbDistDynCalc residualsCumulativeProbabilityDistribution() const
Returns the cumulative probability distribution of the residuals used for reporting.
double elapsedTime() const
Returns the elapsed time for the bundle adjustment.
QList< Statistics > m_rmsLidarImageLineResiduals
List of RMS lidar line residual stats for each image in the bundle.
QList< Statistics > rmsImageResiduals() const
Returns the list of RMS image residuals statistics.
Distance m_maxSigmaCoord2Distance
The maximum sigma longitude distance.
QVector< Statistics > m_rmsImageRASigmas
< The root mean square image right ascension sigmas.
const BundleObservationVector & observations() const
Returns a reference to the observations used by the BundleAdjust.
Distance m_minSigmaCoord3Distance
The minimum sigma radius distance.
ControlNetQsp m_outNet
The output control net from BundleAdjust.
void initialize()
Initializes the BundleResults to a default state where all numeric members are set to 0 or another de...
Distance minSigmaCoord1Distance() const
Returns the minimum sigma distance for coordinate 1.
void setNumberUnknownParameters(int numberParameters)
Sets the total number of parameters to solve for.
void setSigmaCoord3Range(Distance minCoord3Dist, Distance maxCoord3Dist, QString minCoord3PointId, QString maxCoord3PointId)
Sets the min and max sigma distances and point ids for coordinate 3.
QString minSigmaCoord3PointId() const
Returns the minimum sigma point id for coordinate 3.
void setNumberConstrainedLidarPointParameters(int numberParameters)
Set number of contrained point parameters.
double rmsRx() const
Returns the RMS of the x residuals.
void setObservations(BundleObservationVector observations)
Sets the vector of BundleObservations.
void initializeResidualsProbabilityDistribution(unsigned int nodes=20)
Initializes or resets the cumulative probability distribution of residuals used for reporting.
void setRmsFromSigmaStatistics(double rmsFromSigmaCoord1Stats, double rmsFromSigmaCoord2Stats, double rmsFromSigmaCoord3Stats)
Sets the root mean square values of the adjusted sigmas for all three coordinates.
void setRmsXYResiduals(double rx, double ry, double rxy)
Sets the root mean square of the x and y residuals.
QList< Statistics > rmsImageLineResiduals() const
Returns the list of RMS image line residuals statistics.
double m_elapsedTime
elapsed time for bundle
double m_elapsedTimeErrorProp
elapsed time for error propagation
QVector< Statistics > rmsImageRASigmas() const
Returns the list of RMS image right ascension sigma statistics.
void setNumberObservations(int numberObservations)
Sets the number of observations.
int numberLidarRangeConstraintEquations() const
Return the number of lidar range constraint equations.
QVector< Statistics > rmsImageXSigmas() const
Returns the list of RMS image x sigma statistics.
void printMaximumLikelihoodTierInformation()
Prints out information about which tier the solution is in and the status of the residuals.
BundleResults & operator=(const BundleResults &src)
Assignment operator for BundleResults.
void resizeSigmaStatisticsVectors(int numberImages)
Resizes all image sigma vectors.
CorrelationMatrix * m_correlationMatrix
The correlation matrix from the BundleAdjust.
void setDegreesOfFreedom(double degreesOfFreedom)
Sets the degrees of freedom.
Distance m_minSigmaCoord1Distance
The minimum sigma latitude distance.
Distance maxSigmaCoord3Distance() const
Returns the maximum sigma distance for coordinate 3.
Distance maxSigmaCoord1Distance() const
Returns the maximum sigma distance for coordinate 1.
double m_rmsYResiduals
rms of y residuals
QString m_maxSigmaCoord2PointId
The maximum sigma coordinate2 point id.
QList< QPair< MaximumLikelihoodWFunctions, double > > m_maximumLikelihoodFunctions
< The maximum likelihood models and their quantiles.
void setCorrMatCovFileName(FileName name)
Set the covariance file name for the matrix used to calculate the correlation matrix.
QString m_maxSigmaCoord3PointId
The maximum sigma coordinate 3 point id.
QList< Statistics > m_rmsImageSampleResiduals
List of RMS image sample residual statistics for each image in the bundle.
QVector< Statistics > rmsImageTWISTSigmas() const
Returns the list of RMS image twist sigma statistics.
void setRmsLidarImageResidualLists(QList< Statistics > rmsLidarImageLineResiduals, QList< Statistics > rmsLidarImageSampleResiduals, QList< Statistics > rmsLidarImageResiduals)
Sets the root mean square lidar image residual Statistics lists.
QString maxSigmaCoord3PointId() const
Returns the maximum sigma point id for coordinate 3.
void computeSigma0(double dvtpv, BundleSettings::ConvergenceCriteria criteria)
Computes the sigma0 and stores it internally.
QList< Statistics > m_rmsImageResiduals
RMS image sample and line residual statistics for each image in the bundle.
QString maxSigmaCoord2PointId() const
Returns the maximum sigma point id for coordinate 2.
int numberConstrainedImageParameters() const
Returns the number of constrained image parameters.
void setElapsedTimeErrorProp(double time)
Sets the elapsed time for error propegation.
QVector< Statistics > rmsImageZSigmas() const
Returns the list of RMS image z sigma statistics.
QList< Statistics > rmsLidarImageResiduals() const
Returns the list of RMS image lidar residuals statistics.
int m_numberHeldImages
number of 'held' images (define)
double sigmaCoord1StatisticsRms() const
Returns the RMS of the adjusted sigmas for coordinate 1.
void setConverged(bool converged)
Sets if the bundle adjustment converged.
Distance minSigmaCoord2Distance() const
Returns the minimum sigma distance for coordinate 2.
void resetNumberConstrainedTargetParameters()
Resets the number of constrained target parameters to 0.
double m_rmsSigmaCoord1Stats
rms of adjusted Latitude sigmas
StatCumProbDistDynCalc cumulativeProbabilityDistribution() const
Returns the cumulative probability distribution of the |R^2 residuals|.
int degreesOfFreedom() const
Returns the degrees of freedom.
QVector< Statistics > m_rmsImageDECSigmas
< The root mean square image declination sigmas.
ConvergenceCriteria
This enum defines the options for the bundle adjustment's convergence.
@ ParameterCorrections
All parameter corrections will be used to determine that the bundle adjustment has converged.
This is a container for the correlation matrix that comes from a bundle adjust.
Distance measurement, usually in meters.
Definition Distance.h:34
void setMeters(double distanceInMeters)
Set the distance in meters.
Definition Distance.cpp:96
Class provides maximum likelihood estimation functions for robust parameter estimation,...
static QString modelToString(Model model)
Static method to return a string represtentation for a given MaximumLikelihoodWFunctions::Model enum.
The main project for ipce.
Definition Project.h:287
This class is used to approximate cumulative probibility distributions of a stream of observations wi...
CoordinateType
Defines the coordinate typ, units, and coordinate index for some of the output methods.
@ Latitudinal
Planetocentric latitudinal (lat/lon/rad) coordinates.
@ Rectangular
Body-fixed rectangular x/y/z coordinates.
This is free and unencumbered software released into the public domain.
This is free and unencumbered software released into the public domain.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
QSharedPointer< LidarData > LidarDataQsp
Definition for a shared pointer to a LidarData object.
Definition LidarData.h:100
QString toString(const LinearAlgebra::Vector &vector, int precision)
A global function to format LinearAlgebra::Vector as a QString with the given precision.
QSharedPointer< ControlNet > ControlNetQsp
Typedef for QSharedPointer to control network. This typedef is for future implementation of target bo...
Definition ControlNet.h:484