8 #include <QXmlStreamWriter> 10 #include <boost/lexical_cast.hpp> 11 #include <boost/numeric/ublas/io.hpp> 12 #include <boost/numeric/ublas/matrix_sparse.hpp> 13 #include <boost/numeric/ublas/vector_proxy.hpp> 29 #include "XmlStackedHandlerReader.h" 70 xmlReader->setErrorHandler(
new XmlHandler(
this, project));
83 m_numberFixedPoints(src.m_numberFixedPoints),
84 m_numberIgnoredPoints(src.m_numberIgnoredPoints),
85 m_numberHeldImages(src.m_numberHeldImages),
86 m_rmsXResiduals(src.m_rmsXResiduals),
87 m_rmsYResiduals(src.m_rmsYResiduals),
88 m_rmsXYResiduals(src.m_rmsXYResiduals),
89 m_rejectionLimit(src.m_rejectionLimit),
90 m_numberObservations(src.m_numberObservations),
91 m_numberRejectedObservations(src.m_numberRejectedObservations),
92 m_numberUnknownParameters(src.m_numberUnknownParameters),
93 m_numberImageParameters(src.m_numberImageParameters),
94 m_numberConstrainedImageParameters(src.m_numberConstrainedImageParameters),
95 m_numberConstrainedPointParameters(src.m_numberConstrainedPointParameters),
96 m_numberConstrainedTargetParameters(src.m_numberConstrainedTargetParameters),
97 m_degreesOfFreedom(src.m_degreesOfFreedom),
98 m_sigma0(src.m_sigma0),
99 m_elapsedTime(src.m_elapsedTime),
100 m_elapsedTimeErrorProp(src.m_elapsedTimeErrorProp),
101 m_converged(src.m_converged),
102 m_bundleControlPoints(src.m_bundleControlPoints),
103 m_outNet(src.m_outNet),
104 m_iterations(src.m_iterations),
105 m_observations(src.m_observations),
106 m_rmsImageSampleResiduals(src.m_rmsImageSampleResiduals),
107 m_rmsImageLineResiduals(src.m_rmsImageLineResiduals),
108 m_rmsImageResiduals(src.m_rmsImageResiduals),
109 m_rmsImageXSigmas(src.m_rmsImageXSigmas),
110 m_rmsImageYSigmas(src.m_rmsImageYSigmas),
111 m_rmsImageZSigmas(src.m_rmsImageZSigmas),
112 m_rmsImageRASigmas(src.m_rmsImageRASigmas),
113 m_rmsImageDECSigmas(src.m_rmsImageDECSigmas),
114 m_rmsImageTWISTSigmas(src.m_rmsImageTWISTSigmas),
115 m_minSigmaCoord1Distance(src.m_minSigmaCoord1Distance),
116 m_maxSigmaCoord1Distance(src.m_maxSigmaCoord1Distance),
117 m_minSigmaCoord2Distance(src.m_minSigmaCoord2Distance),
118 m_maxSigmaCoord2Distance(src.m_maxSigmaCoord2Distance),
119 m_minSigmaCoord3Distance(src.m_minSigmaCoord3Distance),
120 m_maxSigmaCoord3Distance(src.m_maxSigmaCoord3Distance),
121 m_minSigmaCoord1PointId(src.m_minSigmaCoord1PointId),
122 m_maxSigmaCoord1PointId(src.m_maxSigmaCoord1PointId),
123 m_minSigmaCoord2PointId(src.m_minSigmaCoord2PointId),
124 m_maxSigmaCoord2PointId(src.m_maxSigmaCoord2PointId),
125 m_minSigmaCoord3PointId(src.m_minSigmaCoord3PointId),
126 m_maxSigmaCoord3PointId(src.m_maxSigmaCoord3PointId),
127 m_rmsSigmaCoord1Stats(src.m_rmsSigmaCoord1Stats),
128 m_rmsSigmaCoord2Stats(src.m_rmsSigmaCoord2Stats),
129 m_rmsSigmaCoord3Stats(src.m_rmsSigmaCoord3Stats),
130 m_maximumLikelihoodFunctions(src.m_maximumLikelihoodFunctions),
131 m_maximumLikelihoodIndex(src.m_maximumLikelihoodIndex),
134 m_maximumLikelihoodMedianR2Residuals(src.m_maximumLikelihoodMedianR2Residuals) {
186 m_converged = src.m_converged;
194 m_rmsImageXSigmas = src.m_rmsImageXSigmas;
251 m_rmsImageXSigmas.clear();
330 m_rmsImageXSigmas.resize(numberImages);
376 QString minCoord1PointId, QString maxCoord1PointId) {
393 QString minCoord2PointId, QString maxCoord2PointId) {
410 QString minCoord3PointId, QString maxCoord3PointId) {
426 double rmsFromSigmaCoord1Stats,
427 double rmsFromSigmaCoord2Stats,
428 double rmsFromSigmaCoord3Stats) {
457 for (
int i = 0; i < modelsWithQuantiles.size(); i++) {
470 modelsWithQuantiles[i].second));
898 return m_rmsImageXSigmas;
1282 "Output Control Network has not been set.",
1403 "Correlation matrix for this bundle is NULL.",
1457 stream.writeStartElement(
"bundleResults");
1458 stream.writeStartElement(
"correlationMatrix");
1459 stream.writeAttribute(
"correlationFileName",
1461 stream.writeAttribute(
"covarianceFileName",
1463 stream.writeStartElement(
"imagesAndParameters");
1464 QMapIterator<QString, QStringList> imgParamIt(*
correlationMatrix().imagesAndParameters());
1465 while (imgParamIt.hasNext()) {
1467 stream.writeStartElement(
"image");
1468 stream.writeAttribute(
"id", imgParamIt.key());
1470 for (
int i = 0; i < parameters.size(); i++) {
1471 stream.writeTextElement(
"parameter", parameters[i]);
1473 stream.writeEndElement();
1476 stream.writeEndElement();
1477 stream.writeEndElement();
1479 stream.writeStartElement(
"generalStatisticsValues");
1487 stream.writeTextElement(
"numberConstrainedPointParameters",
1489 stream.writeTextElement(
"numberConstrainedImageParameters",
1491 stream.writeTextElement(
"numberConstrainedTargetParameters",
1497 stream.writeEndElement();
1499 stream.writeStartElement(
"rms");
1500 stream.writeStartElement(
"residuals");
1504 stream.writeEndElement();
1505 stream.writeStartElement(
"sigmas");
1508 switch (coordType) {
1520 IString msg =
"Unknown surface point coordinate type enum [" +
toString(coordType) +
"]." ;
1523 stream.writeEndElement();
1525 stream.writeStartElement(
"imageResidualsLists");
1526 stream.writeStartElement(
"residualsList");
1529 stream.writeStartElement(
"statisticsItem");
1531 stream.writeEndElement();
1533 stream.writeEndElement();
1534 stream.writeStartElement(
"sampleList");
1537 stream.writeStartElement(
"statisticsItem");
1539 stream.writeEndElement();
1541 stream.writeEndElement();
1543 stream.writeStartElement(
"lineList");
1546 stream.writeStartElement(
"statisticsItem");
1548 stream.writeEndElement();
1550 stream.writeEndElement();
1551 stream.writeEndElement();
1553 stream.writeStartElement(
"imageSigmasLists");
1554 stream.writeStartElement(
"xSigmas");
1556 for (
int i = 0; i < m_rmsImageXSigmas.size(); i++) {
1557 stream.writeStartElement(
"statisticsItem");
1558 m_rmsImageXSigmas[i].save(stream, project);
1559 stream.writeEndElement();
1562 stream.writeEndElement();
1564 stream.writeStartElement(
"ySigmas");
1567 stream.writeStartElement(
"statisticsItem");
1569 stream.writeEndElement();
1571 stream.writeEndElement();
1573 stream.writeStartElement(
"zSigmas");
1576 stream.writeStartElement(
"statisticsItem");
1578 stream.writeEndElement();
1580 stream.writeEndElement();
1582 stream.writeStartElement(
"raSigmas");
1585 stream.writeStartElement(
"statisticsItem");
1587 stream.writeEndElement();
1589 stream.writeEndElement();
1591 stream.writeStartElement(
"decSigmas");
1594 stream.writeStartElement(
"statisticsItem");
1596 stream.writeEndElement();
1598 stream.writeEndElement();
1600 stream.writeStartElement(
"twistSigmas");
1603 stream.writeStartElement(
"statisticsItem");
1605 stream.writeEndElement();
1607 stream.writeEndElement();
1608 stream.writeEndElement();
1609 stream.writeEndElement();
1611 stream.writeStartElement(
"elapsedTime");
1614 stream.writeEndElement();
1616 stream.writeStartElement(
"minMaxSigmas");
1619 switch (coordType) {
1621 stream.writeStartElement(
"minLat");
1624 stream.writeEndElement();
1625 stream.writeStartElement(
"maxLat");
1628 stream.writeEndElement();
1629 stream.writeStartElement(
"minLon");
1632 stream.writeEndElement();
1633 stream.writeStartElement(
"maxLon");
1636 stream.writeEndElement();
1637 stream.writeStartElement(
"minRad");
1640 stream.writeEndElement();
1641 stream.writeStartElement(
"maxRad");
1644 stream.writeEndElement();
1647 stream.writeStartElement(
"minX");
1650 stream.writeEndElement();
1651 stream.writeStartElement(
"maxX");
1654 stream.writeEndElement();
1655 stream.writeStartElement(
"minY");
1658 stream.writeEndElement();
1659 stream.writeStartElement(
"maxY");
1662 stream.writeEndElement();
1663 stream.writeStartElement(
"minZ");
1666 stream.writeEndElement();
1667 stream.writeStartElement(
"maxZ");
1670 stream.writeEndElement();
1673 IString msg =
"Unknown surface point coordinate type enum [" +
toString(coordType) +
"]." ;
1676 stream.writeEndElement();
1679 stream.writeStartElement(
"maximumLikelihoodEstimation");
1682 stream.writeAttribute(
"maximumLikelihoodMedianR2Residuals",
1685 stream.writeStartElement(
"cumulativeProbabilityCalculator");
1687 stream.writeEndElement();
1689 stream.writeStartElement(
"residualsCumulativeProbabilityCalculator");
1691 stream.writeEndElement();
1694 stream.writeStartElement(
"model");
1695 stream.writeAttribute(
"modelNumber",
toString(i+1));
1696 stream.writeAttribute(
"modelSelection",
1698 stream.writeAttribute(
"tweakingConstant",
1701 stream.writeEndElement();
1703 stream.writeEndElement();
1704 stream.writeEndElement();
1716 m_xmlHandlerCumProCalc = NULL;
1717 m_xmlHandlerBundleResults = NULL;
1718 m_xmlHandlerProject = NULL;
1720 m_xmlHandlerBundleResults = statistics;
1721 m_xmlHandlerProject = project;
1722 m_xmlHandlerCharacters =
"";
1724 m_xmlHandlerResidualsListSize = 0;
1725 m_xmlHandlerSampleResidualsListSize = 0;
1726 m_xmlHandlerLineResidualsListSize = 0;
1727 m_xmlHandlerXSigmasListSize = 0;
1728 m_xmlHandlerYSigmasListSize = 0;
1729 m_xmlHandlerZSigmasListSize = 0;
1730 m_xmlHandlerRASigmasListSize = 0;
1731 m_xmlHandlerDECSigmasListSize = 0;
1732 m_xmlHandlerTWISTSigmasListSize = 0;
1733 m_xmlHandlerStatisticsList.clear();
1745 m_xmlHandlerProject = NULL;
1765 const QString &localName,
1766 const QString &qName,
1767 const QXmlAttributes &atts) {
1768 m_xmlHandlerCharacters =
"";
1770 if (XmlStackedHandler::startElement(namespaceURI, localName, qName, atts)) {
1772 if (qName ==
"correlationMatrix") {
1773 m_xmlHandlerBundleResults->m_correlationMatrix = NULL;
1776 QString correlationFileName = atts.value(
"correlationFileName");
1777 if (!correlationFileName.isEmpty()) {
1778 FileName correlationFile(correlationFileName);
1779 m_xmlHandlerBundleResults->m_correlationMatrix->setCorrelationFileName(correlationFile);
1782 QString covarianceFileName = atts.value(
"covarianceFileName");
1783 if (!covarianceFileName.isEmpty()) {
1784 FileName covarianceFile(covarianceFileName);
1785 m_xmlHandlerBundleResults->m_correlationMatrix->setCovarianceFileName(covarianceFile);
1788 else if (qName ==
"image") {
1789 QString correlationMatrixImageId = atts.value(
"id");
1790 if (!correlationMatrixImageId.isEmpty()) {
1791 m_xmlHandlerCorrelationImageId = correlationMatrixImageId;
1794 else if (qName ==
"residuals") {
1795 QString rx = atts.value(
"x");
1796 if (!rx.isEmpty()) {
1797 m_xmlHandlerBundleResults->m_rmsXResiduals =
toDouble(rx);
1800 QString ry = atts.value(
"y");
1801 if (!ry.isEmpty()) {
1802 m_xmlHandlerBundleResults->m_rmsYResiduals =
toDouble(ry);
1805 QString rxy = atts.value(
"xy");
1806 if (!rxy.isEmpty()) {
1807 m_xmlHandlerBundleResults->m_rmsXYResiduals =
toDouble(rxy);
1810 else if (qName ==
"sigmas") {
1811 QString lat = atts.value(
"lat");
1812 if (!lat.isEmpty()) {
1813 m_xmlHandlerBundleResults->m_rmsSigmaCoord1Stats =
toDouble(lat);
1815 QString lon = atts.value(
"lon");
1816 if (!lon.isEmpty()) {
1817 m_xmlHandlerBundleResults->m_rmsSigmaCoord2Stats =
toDouble(lon);
1819 QString rad = atts.value(
"rad");
1820 if (!rad.isEmpty()) {
1821 m_xmlHandlerBundleResults->m_rmsSigmaCoord3Stats =
toDouble(rad);
1823 QString x = atts.value(
"x");
1825 m_xmlHandlerBundleResults->m_rmsSigmaCoord1Stats =
toDouble(x);
1827 QString y = atts.value(
"y");
1829 m_xmlHandlerBundleResults->m_rmsSigmaCoord2Stats =
toDouble(y);
1831 QString z = atts.value(
"z");
1833 m_xmlHandlerBundleResults->m_rmsSigmaCoord3Stats =
toDouble(z);
1836 else if (qName ==
"residualsList") {
1837 QString listSizeStr = atts.value(
"listSize");
1838 if (!listSizeStr.isEmpty()) {
1839 m_xmlHandlerResidualsListSize =
toInt(listSizeStr);
1842 else if (qName ==
"sampleList") {
1843 QString listSizeStr = atts.value(
"listSize");
1844 if (!listSizeStr.isEmpty()) {
1845 m_xmlHandlerSampleResidualsListSize =
toInt(listSizeStr);
1848 else if (qName ==
"lineList") {
1849 QString listSizeStr = atts.value(
"listSize");
1850 if (!listSizeStr.isEmpty()) {
1851 m_xmlHandlerLineResidualsListSize =
toInt(listSizeStr);
1854 else if (qName ==
"xSigmas") {
1855 QString listSizeStr = atts.value(
"listSize");
1856 if (!listSizeStr.isEmpty()) {
1857 m_xmlHandlerXSigmasListSize =
toInt(listSizeStr);
1860 else if (qName ==
"ySigmas") {
1861 QString listSizeStr = atts.value(
"listSize");
1862 if (!listSizeStr.isEmpty()) {
1863 m_xmlHandlerYSigmasListSize =
toInt(listSizeStr);
1866 else if (qName ==
"zSigmas") {
1867 QString listSizeStr = atts.value(
"listSize");
1868 if (!listSizeStr.isEmpty()) {
1869 m_xmlHandlerZSigmasListSize =
toInt(listSizeStr);
1872 else if (qName ==
"raSigmas") {
1873 QString listSizeStr = atts.value(
"listSize");
1874 if (!listSizeStr.isEmpty()) {
1875 m_xmlHandlerRASigmasListSize =
toInt(listSizeStr);
1879 else if (qName ==
"decSigmas") {
1880 QString listSizeStr = atts.value(
"listSize");
1881 if (!listSizeStr.isEmpty()) {
1882 m_xmlHandlerDECSigmasListSize =
toInt(listSizeStr);
1885 else if (qName ==
"twistSigmas") {
1886 QString listSizeStr = atts.value(
"listSize");
1887 if (!listSizeStr.isEmpty()) {
1888 m_xmlHandlerTWISTSigmasListSize =
toInt(listSizeStr);
1891 else if (qName ==
"statisticsItem") {
1893 m_xmlHandlerStatisticsList.append(
1894 new Statistics(m_xmlHandlerProject, reader()));
1896 else if (qName ==
"elapsedTime") {
1897 QString time = atts.value(
"time");
1898 if (!time.isEmpty()) {
1899 m_xmlHandlerBundleResults->m_elapsedTime =
toDouble(time);
1902 QString errorProp = atts.value(
"errorProp");
1903 if (!errorProp.isEmpty()) {
1904 m_xmlHandlerBundleResults->m_elapsedTimeErrorProp =
toDouble(errorProp);
1916 else if (qName ==
"minLat") {
1917 QString minLat = atts.value(
"value");
1918 if (!minLat.isEmpty()) {
1919 m_xmlHandlerBundleResults->m_minSigmaCoord1Distance.setMeters(
toDouble(minLat));
1922 QString minLatPointId = atts.value(
"pointId");
1923 if (!minLatPointId.isEmpty()) {
1924 m_xmlHandlerBundleResults->m_minSigmaCoord1PointId = minLatPointId;
1928 else if (qName ==
"minX") {
1929 QString minX = atts.value(
"value");
1930 if (!minX.isEmpty()) {
1931 m_xmlHandlerBundleResults->m_minSigmaCoord1Distance.setMeters(
toDouble(minX));
1934 QString minXPointId = atts.value(
"pointId");
1935 if (!minXPointId.isEmpty()) {
1936 m_xmlHandlerBundleResults->m_minSigmaCoord1PointId = minXPointId;
1939 else if (qName ==
"maxLat") {
1940 QString maxLat = atts.value(
"value");
1941 if (!maxLat.isEmpty()) {
1942 m_xmlHandlerBundleResults->m_maxSigmaCoord1Distance.setMeters(
toDouble(maxLat));
1945 QString maxLatPointId = atts.value(
"pointId");
1946 if (!maxLatPointId.isEmpty()) {
1947 m_xmlHandlerBundleResults->m_maxSigmaCoord1PointId = maxLatPointId;
1951 else if (qName ==
"maxX") {
1953 QString maxX = atts.value(
"value");
1954 if (!maxX.isEmpty()) {
1955 m_xmlHandlerBundleResults->m_maxSigmaCoord1Distance.setMeters(
toDouble(maxX));
1958 QString maxXPointId = atts.value(
"pointId");
1959 if (!maxXPointId.isEmpty()) {
1960 m_xmlHandlerBundleResults->m_maxSigmaCoord1PointId = maxXPointId;
1964 else if (qName ==
"minLon") {
1966 QString minLon = atts.value(
"value");
1967 if (!minLon.isEmpty()) {
1968 m_xmlHandlerBundleResults->m_minSigmaCoord2Distance.setMeters(
toDouble(minLon));
1971 QString minLonPointId = atts.value(
"pointId");
1972 if (!minLonPointId.isEmpty()) {
1973 m_xmlHandlerBundleResults->m_minSigmaCoord2PointId = minLonPointId;
1977 else if (qName ==
"minY") {
1979 QString minY = atts.value(
"value");
1980 if (!minY.isEmpty()) {
1981 m_xmlHandlerBundleResults->m_minSigmaCoord2Distance.setMeters(
toDouble(minY));
1984 QString minYPointId = atts.value(
"pointId");
1985 if (!minYPointId.isEmpty()) {
1986 m_xmlHandlerBundleResults->m_minSigmaCoord2PointId = minYPointId;
1990 else if (qName ==
"maxLon") {
1992 QString maxLon = atts.value(
"value");
1993 if (!maxLon.isEmpty()) {
1994 m_xmlHandlerBundleResults->m_maxSigmaCoord2Distance.setMeters(
toDouble(maxLon));
1997 QString maxLonPointId = atts.value(
"pointId");
1998 if (!maxLonPointId.isEmpty()) {
1999 m_xmlHandlerBundleResults->m_maxSigmaCoord2PointId = maxLonPointId;
2003 else if (qName ==
"maxY") {
2004 QString maxY = atts.value(
"value");
2005 if (!maxY.isEmpty()) {
2006 m_xmlHandlerBundleResults->m_maxSigmaCoord2Distance.setMeters(
toDouble(maxY));
2009 QString maxYPointId = atts.value(
"pointId");
2010 if (!maxYPointId.isEmpty()) {
2011 m_xmlHandlerBundleResults->m_maxSigmaCoord2PointId = maxYPointId;
2015 else if (qName ==
"minRad") {
2017 QString minRad = atts.value(
"value");
2018 if (!minRad.isEmpty()) {
2019 m_xmlHandlerBundleResults->m_minSigmaCoord3Distance.setMeters(
toDouble(minRad));
2022 QString minRadPointId = atts.value(
"pointId");
2023 if (!minRadPointId.isEmpty()) {
2024 m_xmlHandlerBundleResults->m_minSigmaCoord3PointId = minRadPointId;
2028 else if (qName ==
"minZ") {
2030 QString minZ = atts.value(
"value");
2031 if (!minZ.isEmpty()) {
2032 m_xmlHandlerBundleResults->m_minSigmaCoord3Distance.setMeters(
toDouble(minZ));
2035 QString minZPointId = atts.value(
"pointId");
2036 if (!minZPointId.isEmpty()) {
2037 m_xmlHandlerBundleResults->m_minSigmaCoord3PointId = minZPointId;
2041 else if (qName ==
"maxRad") {
2043 QString maxRad = atts.value(
"value");
2044 if (!maxRad.isEmpty()) {
2045 m_xmlHandlerBundleResults->m_maxSigmaCoord3Distance.setMeters(
toDouble(maxRad));
2048 QString maxRadPointId = atts.value(
"pointId");
2049 if (!maxRadPointId.isEmpty()) {
2050 m_xmlHandlerBundleResults->m_maxSigmaCoord3PointId = maxRadPointId;
2054 else if (qName ==
"maxZ") {
2056 QString maxZ = atts.value(
"value");
2057 if (!maxZ.isEmpty()) {
2058 m_xmlHandlerBundleResults->m_maxSigmaCoord3Distance.setMeters(
toDouble(maxZ));
2061 QString maxZPointId = atts.value(
"pointId");
2062 if (!maxZPointId.isEmpty()) {
2063 m_xmlHandlerBundleResults->m_maxSigmaCoord3PointId = maxZPointId;
2067 else if (qName ==
"maximumLikelihoodEstimation") {
2068 QString maximumLikelihoodIndex = atts.value(
"maximumLikelihoodIndex");
2069 if (!maximumLikelihoodIndex.isEmpty()) {
2070 m_xmlHandlerBundleResults->m_maximumLikelihoodIndex =
toInt(maximumLikelihoodIndex);
2074 atts.value(
"maximumLikelihoodMedianR2Residuals");
2076 m_xmlHandlerBundleResults->m_maximumLikelihoodMedianR2Residuals =
2080 else if (qName ==
"model") {
2081 QString model = atts.value(
"modelSelection");
2082 QString tweakingConstant = atts.value(
"tweakingConstant");
2083 QString quantile = atts.value(
"quantile");
2084 bool validModel =
true;
2085 if (model.isEmpty()) validModel =
false;
2086 if (tweakingConstant.isEmpty()) validModel =
false;
2087 if (quantile.isEmpty()) validModel =
false;
2089 m_xmlHandlerBundleResults->m_maximumLikelihoodFunctions.append(
2091 MaximumLikelihoodWFunctions::stringToModel(model),
2096 else if (qName ==
"cumulativeProbabilityCalculator") {
2097 m_xmlHandlerBundleResults->m_cumPro = NULL;
2098 m_xmlHandlerBundleResults->m_cumPro =
2101 else if (qName ==
"residualsCumulativeProbabilityCalculator") {
2102 m_xmlHandlerBundleResults->m_cumProRes = NULL;
2119 m_xmlHandlerCharacters += ch;
2120 return XmlStackedHandler::characters(ch);
2134 const QString &qName) {
2136 if (!m_xmlHandlerCharacters.isEmpty()) {
2137 if (qName ==
"parameter") {
2139 m_xmlHandlerCorrelationParameterList.append(m_xmlHandlerCharacters);
2141 if (qName ==
"image") {
2143 if (m_xmlHandlerCorrelationImageId !=
"") {
2144 m_xmlHandlerCorrelationMap.insert(m_xmlHandlerCorrelationImageId,
2145 m_xmlHandlerCorrelationParameterList);
2147 m_xmlHandlerCorrelationImageId =
"";
2148 m_xmlHandlerCorrelationParameterList.clear();
2151 if (qName ==
"imagesAndParameters") {
2153 if (!m_xmlHandlerCorrelationMap.isEmpty()) {
2154 m_xmlHandlerBundleResults->setCorrMatImgsAndParams(m_xmlHandlerCorrelationMap);
2157 else if (qName ==
"numberFixedPoints") {
2158 m_xmlHandlerBundleResults->m_numberFixedPoints =
toInt(m_xmlHandlerCharacters);
2160 else if (qName ==
"numberIgnoredPoints") {
2161 m_xmlHandlerBundleResults->m_numberIgnoredPoints =
toInt(m_xmlHandlerCharacters);
2163 else if (qName ==
"numberHeldImages") {
2164 m_xmlHandlerBundleResults->m_numberHeldImages =
toInt(m_xmlHandlerCharacters);
2166 else if (qName ==
"rejectionLimit") {
2167 m_xmlHandlerBundleResults->m_rejectionLimit =
toDouble(m_xmlHandlerCharacters);
2169 else if (qName ==
"numberRejectedObservations") {
2170 m_xmlHandlerBundleResults->m_numberRejectedObservations =
toInt(m_xmlHandlerCharacters);
2172 else if (qName ==
"numberObservations") {
2173 m_xmlHandlerBundleResults->m_numberObservations =
toInt(m_xmlHandlerCharacters);
2175 else if (qName ==
"numberImageParameters") {
2176 m_xmlHandlerBundleResults->m_numberImageParameters =
toInt(m_xmlHandlerCharacters);
2178 else if (qName ==
"numberConstrainedPointParameters") {
2179 m_xmlHandlerBundleResults->m_numberConstrainedPointParameters =
2180 toInt(m_xmlHandlerCharacters);
2182 else if (qName ==
"numberConstrainedImageParameters") {
2183 m_xmlHandlerBundleResults->m_numberConstrainedImageParameters =
2184 toInt(m_xmlHandlerCharacters);
2186 else if (qName ==
"numberConstrainedTargetParameters") {
2187 m_xmlHandlerBundleResults->m_numberConstrainedTargetParameters =
2188 toInt(m_xmlHandlerCharacters);
2190 else if (qName ==
"numberUnknownParameters") {
2191 m_xmlHandlerBundleResults->m_numberUnknownParameters =
toInt(m_xmlHandlerCharacters);
2193 else if (qName ==
"degreesOfFreedom") {
2194 m_xmlHandlerBundleResults->m_degreesOfFreedom =
toInt(m_xmlHandlerCharacters);
2196 else if (qName ==
"sigma0") {
2197 m_xmlHandlerBundleResults->m_sigma0 =
toDouble(m_xmlHandlerCharacters);
2199 else if (qName ==
"converged") {
2200 m_xmlHandlerBundleResults->m_converged =
toBool(m_xmlHandlerCharacters);
2203 else if (qName ==
"residualsList") {
2204 if (m_xmlHandlerResidualsListSize != m_xmlHandlerStatisticsList.size()) {
2206 "Unable to read xml file. Invalid residualsList",
_FILEINFO_);
2208 for (
int i = 0; i < m_xmlHandlerStatisticsList.size(); i++) {
2209 m_xmlHandlerBundleResults->m_rmsImageResiduals.append(m_xmlHandlerStatisticsList[i]);
2211 m_xmlHandlerStatisticsList.clear();
2213 else if (qName ==
"sampleList") {
2214 if (m_xmlHandlerSampleResidualsListSize != m_xmlHandlerStatisticsList.size()) {
2216 "Unable to read xml file. Invalid sampleList",
_FILEINFO_);
2218 for (
int i = 0; i < m_xmlHandlerStatisticsList.size(); i++) {
2219 m_xmlHandlerBundleResults->m_rmsImageSampleResiduals.append(
2220 m_xmlHandlerStatisticsList[i]);
2222 m_xmlHandlerStatisticsList.clear();
2224 else if (qName ==
"lineList") {
2225 if (m_xmlHandlerLineResidualsListSize != m_xmlHandlerStatisticsList.size()) {
2227 "Unable to read xml file. Invalid lineList",
_FILEINFO_);
2229 for (
int i = 0; i < m_xmlHandlerStatisticsList.size(); i++) {
2230 m_xmlHandlerBundleResults->m_rmsImageLineResiduals.append(m_xmlHandlerStatisticsList[i]);
2232 m_xmlHandlerStatisticsList.clear();
2234 else if (qName ==
"xSigmas") {
2235 if (m_xmlHandlerXSigmasListSize != m_xmlHandlerStatisticsList.size()) {
2237 "Unable to read xml file. Invalid xSigmas",
_FILEINFO_);
2239 for (
int i = 0; i < m_xmlHandlerStatisticsList.size(); i++) {
2240 m_xmlHandlerBundleResults->m_rmsImageXSigmas.append(m_xmlHandlerStatisticsList[i]);
2242 m_xmlHandlerStatisticsList.clear();
2244 else if (qName ==
"ySigmas") {
2245 if (m_xmlHandlerYSigmasListSize != m_xmlHandlerStatisticsList.size()) {
2247 "Unable to read xml file. Invalid ySigmas",
_FILEINFO_);
2249 for (
int i = 0; i < m_xmlHandlerStatisticsList.size(); i++) {
2250 m_xmlHandlerBundleResults->m_rmsImageYSigmas.append(m_xmlHandlerStatisticsList[i]);
2252 m_xmlHandlerStatisticsList.clear();
2254 else if (qName ==
"zSigmas") {
2255 if (m_xmlHandlerZSigmasListSize != m_xmlHandlerStatisticsList.size()) {
2257 "Unable to read xml file. Invalid zSigmas",
_FILEINFO_);
2259 for (
int i = 0; i < m_xmlHandlerStatisticsList.size(); i++) {
2260 m_xmlHandlerBundleResults->m_rmsImageZSigmas.append(m_xmlHandlerStatisticsList[i]);
2262 m_xmlHandlerStatisticsList.clear();
2264 else if (qName ==
"raSigmas") {
2265 if (m_xmlHandlerRASigmasListSize != m_xmlHandlerStatisticsList.size()) {
2267 "Unable to read xml file. Invalid raSigmas",
_FILEINFO_);
2269 for (
int i = 0; i < m_xmlHandlerStatisticsList.size(); i++) {
2270 m_xmlHandlerBundleResults->m_rmsImageRASigmas.append(m_xmlHandlerStatisticsList[i]);
2272 m_xmlHandlerStatisticsList.clear();
2274 else if (qName ==
"decSigmas") {
2275 if (m_xmlHandlerDECSigmasListSize != m_xmlHandlerStatisticsList.size()) {
2277 "Unable to read xml file. Invalid decSigmas",
_FILEINFO_);
2279 for (
int i = 0; i < m_xmlHandlerStatisticsList.size(); i++) {
2280 m_xmlHandlerBundleResults->m_rmsImageDECSigmas.append(m_xmlHandlerStatisticsList[i]);
2282 m_xmlHandlerStatisticsList.clear();
2284 else if (qName ==
"twistSigmas") {
2285 if (m_xmlHandlerTWISTSigmasListSize != m_xmlHandlerStatisticsList.size()) {
2287 "Unable to read xml file. Invalid twistSigmas",
_FILEINFO_);
2289 for (
int i = 0; i < m_xmlHandlerStatisticsList.size(); i++) {
2290 m_xmlHandlerBundleResults->m_rmsImageTWISTSigmas.append(m_xmlHandlerStatisticsList[i]);
2292 m_xmlHandlerStatisticsList.clear();
2295 m_xmlHandlerCharacters =
"";
2296 return XmlStackedHandler::endElement(namespaceURI, localName, qName);
QString m_maxSigmaCoord3PointId
The maximum sigma coordinate 3 point id.
void setObservations(BundleObservationVector observations)
Sets the vector of BundleObservations.
This class is a container class for BundleObservations.
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
Handle an XML start element.
virtual bool characters(const QString &ch)
Adds a QString to the XmlHandler's internal character data.
BundleObservationVector m_observations
The vector of BundleObservations from BundleAdjust.
Distance m_maxSigmaCoord3Distance
The maximum sigma radius distance.
Distance minSigmaCoord2Distance() const
Returns the minimum sigma distance for coordinate 2.
void incrementFixedPoints()
Increase the number of 'fixed' (ground) points.
void setSigmaCoord1Range(Distance minCoord1Dist, Distance maxCoord1Dist, QString minCoord1PointId, QString maxCoord1PointId)
Sets the min and max sigma distances and point ids for coordinate 1.
QString m_maxSigmaCoord2PointId
The maximum sigma coordinate2 point id.
QString maxSigmaCoord3PointId() const
Returns the maximum sigma point id for coordinate 3.
The main project for ipce.
void setElapsedTime(double time)
Sets the elapsed time for the bundle adjustment.
QVector< Statistics > m_rmsImageYSigmas
< The root mean square image y sigmas.
int numberObservations() const
Returns the number of observations.
void setNumberImageParameters(int numberParameters)
Sets the number of image parameters.
StatCumProbDistDynCalc * m_cumProRes
This class keeps track of the cumulative probability distribution of residuals (in unweighted pixels)...
void setCorrMatCovFileName(FileName name)
Set the covariance file name for the matrix used to calculate the correlation matrix.
const BundleObservationVector & observations() const
Returns a reference to the observations used by the BundleAdjust.
void setSigmaCoord3Range(Distance minCoord3Dist, Distance maxCoord3Dist, QString minCoord3PointId, QString maxCoord3PointId)
Sets the min and max sigma distances and point ids for coordinate 3.
This is a container for the correlation matrix that comes from a bundle adjust.
File name manipulation and expansion.
void resetNumberConstrainedPointParameters()
Resets the number of contrained point parameters to 0.
void save(QXmlStreamWriter &stream, const Project *project) const
Saves the BundleResults object to an XML file.
void printMaximumLikelihoodTierInformation()
Prints out information about which tier the solution is in and the status of the residuals.
double m_rmsSigmaCoord1Stats
rms of adjusted Latitude sigmas
XmlHandler(BundleResults *statistics, Project *project)
Constructs an XmlHandler used to save a BundleResults object.
QVector< Statistics > rmsImageDECSigmas() const
Returns the list of RMS image declination sigma statistics.
void incrementNumberConstrainedImageParameters(int incrementAmount)
Increase the number of constrained image parameters.
Distance m_maxSigmaCoord2Distance
The maximum sigma longitude distance.
ControlNetQsp m_outNet
The output control net from BundleAdjust.
double sigmaCoord1StatisticsRms() const
Returns the RMS of the adjusted sigmas for coordinate 1.
double value(double cumProb)
Provides the value of the variable that has the given cumulative probility (according the current est...
int m_numberHeldImages
number of 'held' images (define)
void setRmsImageResidualLists(QList< Statistics > rmsImageLineResiduals, QList< Statistics > rmsImageSampleResiduals, QList< Statistics > rmsImageResiduals)
Sets the root mean square image residual Statistics lists.
QString m_minSigmaCoord3PointId
The minimum sigma coordinate 3 point id.
int m_numberConstrainedImageParameters
number of constrained image parameters
double sigmaCoord3StatisticsRms() const
Returns the RMS of the adjusted sigmas for coordinate 3.
QVector< Statistics > rmsImageZSigmas() const
Returns the list of RMS image z sigma statistics.
QList< Statistics > m_rmsImageSampleResiduals
List of RMS image sample residual statistics for each image in the bundle.
int toInt(const QString &string)
Global function to convert from a string to an integer.
Distance m_minSigmaCoord1Distance
The minimum sigma latitude distance.
void addProbabilityDistributionObservation(double obsValue)
Adds an observation to the cumulative probability distribution of |R^2 residuals|.
QString minSigmaCoord1PointId() const
Returns the minimum sigma point id for coordinate 1.
void setRmsFromSigmaStatistics(double rmsFromSigmaCoord1Stats, double rmsFromSigmaCoord2Stats, double rmsFromSigmaCoord3Stats)
Sets the root mean square values of the adjusted sigmas for all three coordinates.
double rejectionLimit() const
Returns the rejection limit.
void setImagesAndParameters(QMap< QString, QStringList > imagesAndParameters)
Set the qmap of images and parameters.
QVector< BundleControlPointQsp > m_bundleControlPoints
The vector of BundleControlPoints from BundleAdjust.
QVector< Statistics > m_rmsImageRASigmas
< The root mean square image right ascension sigmas.
double m_rmsYResiduals
rms of y residuals
void resetNumberConstrainedImageParameters()
Resets the number of constrained image parameters to 0.
void maximumLikelihoodSetUp(QList< QPair< MaximumLikelihoodWFunctions::Model, double > > modelsWithQuantiles)
This method steps up the maximum likelihood estimation solution.
double m_rmsSigmaCoord3Stats
rms of adjusted Radius sigmas
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
int numberFixedPoints() const
Returns the number of 'fixed' (ground) points.
void setOutputControlNet(ControlNetQsp outNet)
Sets the output ControlNet.
void setNumberUnknownParameters(int numberParameters)
Sets the total number of parameters to solve for.
QString m_minSigmaCoord1PointId
The minimum sigma coordinate 1 point id.
void setElapsedTimeErrorProp(double time)
Sets the elapsed time for error propegation.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
double toDouble(const QString &string)
Global function to convert from a string to a double.
This error is for when a programmer made an API call that was illegal.
A type of error that occurred when performing an actual I/O operation.
int maximumLikelihoodModelIndex() const
Returns which step the bundle adjustment is on.
QString maxSigmaCoord1PointId() const
Returns the maximum sigma point id for coordinate 1.
Distance measurement, usually in meters.
BundleResults & operator=(const BundleResults &src)
Assignment operator for BundleResults.
double m_rejectionLimit
current rejection limit
Distance maxSigmaCoord3Distance() const
Returns the maximum sigma distance for coordinate 3.
ControlNetQsp outputControlNet() const
Returns a shared pointer to the output control network.
int numberHeldImages() const
Returns the number of 'held' images.
StatCumProbDistDynCalc cumulativeProbabilityDistribution() const
Returns the cumulative probability distribution of the |R^2 residuals|.
void computeDegreesOfFreedom()
Computes the degrees of freedom of the bundle adjustment and stores it internally.
QVector< Statistics > m_rmsImageDECSigmas
< The root mean square image declination sigmas.
QVector< BundleControlPointQsp > & bundleControlPoints()
Returns a reference to the BundleControlPoint vector.
double m_rmsXYResiduals
rms of all x and y residuals
QVector< Statistics > rmsImageYSigmas() const
Returns the list of RMS image y sigma statistics.
StatCumProbDistDynCalc * m_cumPro
This class will be used to calculate the cumulative probability distribution of |R^2 residuals|...
Planetocentric latitudinal (lat/lon/rad) coordinates.
MaximumLikelihoodWFunctions maximumLikelihoodModelWFunc(int modelIndex) const
Returns the maximum likelihood model at the given index.
double rmsRx() const
Returns the RMS of the x residuals.
void setMeters(double distanceInMeters)
Set the distance in meters.
void setRejectionLimit(double rejectionLimit)
Sets the rejection limit.
int m_numberIgnoredPoints
number of ignored points
This class is used to accumulate statistics on double arrays.
double m_elapsedTime
elapsed time for bundle
double elapsedTime() const
Returns the elapsed time for the bundle adjustment.
This class is used to approximate cumulative probibility distributions of a stream of observations wi...
void setSigmaCoord2Range(Distance minCoord2Dist, Distance maxCoord2Dist, QString minCoord2PointId, QString maxCoord2PointId)
Sets the min and max sigma distances and point ids for coordinate 2.
StatCumProbDistDynCalc residualsCumulativeProbabilityDistribution() const
Returns the cumulative probability distribution of the residuals used for reporting.
int m_numberObservations
number of image coordinate observations
int numberConstrainedImageParameters() const
Returns the number of constrained image parameters.
Distance minSigmaCoord3Distance() const
Returns the minimum sigma distance for coordinate 3.
virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName)
Handle end tags for the BundleResults serialized XML.
void setBundleControlPoints(QVector< BundleControlPointQsp > controlPoints)
Sets the bundle control point vector.
Distance m_minSigmaCoord2Distance
The minimum sigma longitude distance.
double sigmaCoord2StatisticsRms() const
Returns the RMS of the adjusted sigmas for coordinate 2.
All parameter corrections will be used to determine that the bundle adjustment has converged...
int m_numberConstrainedTargetParameters
number of constrained target parameters
void incrementIgnoredPoints()
Increase the number of ignored points.
double m_rmsXResiduals
rms of x residuals
This class is an XmlHandler used to read and write BundleResults objects from and to XML files...
double m_rmsSigmaCoord2Stats
rms of adjusted Longitude sigmas
double maximumLikelihoodModelQuantile(int modelIndex) const
Returns the quantile of the maximum likelihood model at the given index.
void incrementNumberConstrainedPointParameters(int incrementAmount)
Increase the number of contrained point parameters.
#define _FILEINFO_
Macro for the filename and line number.
QList< Statistics > rmsImageSampleResiduals() const
Returns the list of RMS image sample residuals statistics.
double m_elapsedTimeErrorProp
elapsed time for error propagation
int m_numberConstrainedPointParameters
number of constrained point parameters
CorrelationMatrix correlationMatrix() const
Returns the Correlation Matrix.
virtual void pushContentHandler(XmlStackedHandler *newHandler)
Push a contentHandler and maybe continue parsing...
double m_maximumLikelihoodMedianR2Residuals
Median of R^2 residuals.
A type of error that cannot be classified as any of the other error types.
void addResidualsProbabilityDistributionObservation(double obsValue)
Adds an observation to the cumulative probability distribution of residuals used for reporting...
int m_numberRejectedObservations
number of rejected image coordinate observations
void resizeSigmaStatisticsVectors(int numberImages)
Resizes all image sigma vectors.
QVector< Statistics > rmsImageRASigmas() const
Returns the list of RMS image right ascension sigma statistics.
void computeSigma0(double dvtpv, BundleSettings::ConvergenceCriteria criteria)
Computes the sigma0 and stores it internally.
Class provides maximum likelihood estimation functions for robust parameter estimation, e.g.
void setNumberRejectedObservations(int numberObservations)
Sets the number of rejected observations.
QString minSigmaCoord2PointId() const
Returns the minimum sigma point id for coordinate 2.
QList< Statistics > rmsImageResiduals() const
Returns the list of RMS image residuals statistics.
BundleResults(QObject *parent=0)
Constructs a BundleResults object.
Distance minSigmaCoord1Distance() const
Returns the minimum sigma distance for coordinate 1.
QVector< Statistics > rmsImageXSigmas() const
Returns the list of RMS image x sigma statistics.
bool converged() const
Returns whether or not the bundle adjustment converged.
double elapsedTimeErrorProp() const
Returns the elapsed time for error propagation.
QList< QPair< MaximumLikelihoodWFunctions, double > > m_maximumLikelihoodFunctions
< The maximum likelihood models and their quantiles.
void initializeResidualsProbabilityDistribution(unsigned int nodes=20)
Initializes or resets the cumulative probability distribution of residuals used for reporting...
int m_iterations
The number of iterations taken by BundleAdjust.
int m_numberUnknownParameters
total number of parameters to solve for
double rmsRxy() const
Returns the RMS of the x and y residuals.
Body-fixed rectangular x/y/z coordinates.
void setCorrMatImgsAndParams(QMap< QString, QStringList > imgsAndParams)
Set the images and their associated parameters of the correlation matrix.
double maximumLikelihoodMedianR2Residuals() const
Returns the median of the |R^2 residuals|.
CoordinateType
Defines the coordinate typ, units, and coordinate index for some of the output methods.
CorrelationMatrix * m_correlationMatrix
The correlation matrix from the BundleAdjust.
void initializeProbabilityDistribution(unsigned int nodes=20)
Initializes or resets the cumulative probability distribution of |R^2 residuals|. ...
Distance m_maxSigmaCoord1Distance
The maximum sigma latitude distance.
int m_numberFixedPoints
number of 'fixed' (ground) points (define)
int numberRejectedObservations() const
Returns the number of observation that were rejected.
QString m_maxSigmaCoord1PointId
The maximum sigma coordinate 1 point id.
QList< Statistics > rmsImageLineResiduals() const
Returns the list of RMS image line residuals statistics.
int numberMaximumLikelihoodModels() const
Returns how many maximum likelihood models were used in the bundle adjustment.
void setCovarianceFileName(FileName covarianceFileName)
Set the qmap of images and parameters.
QString minSigmaCoord3PointId() const
Returns the minimum sigma point id for coordinate 3.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
double rmsRy() const
Returns the RMS of the y residuals.
void setNumberObservations(int numberObservations)
Sets the number of observations.
int m_maximumLikelihoodIndex
This count keeps track of which stage of the maximum likelihood adjustment the bundle is currently on...
QVector< Statistics > m_rmsImageZSigmas
< The root mean square image z sigmas.
int m_degreesOfFreedom
degrees of freedom
bool toBool(const QString &string)
Global function to convert from a string to a boolean.
int numberConstrainedTargetParameters() const
Return the number of constrained target parameters.
Distance m_minSigmaCoord3Distance
The minimum sigma radius distance.
QVector< Statistics > rmsImageTWISTSigmas() const
Returns the list of RMS image twist sigma statistics.
QList< Statistics > m_rmsImageLineResiduals
List of RMS image line residual statistics for each image in the bundle.
~XmlHandler()
Destroys an XmlHandler.
void addObs(double obs)
Values for the estimated quantile positions are update as observations are added. ...
void setRmsXYResiduals(double rx, double ry, double rxy)
Sets the root mean square of the x and y residuals.
void initialize()
Initializes the BundleResults to a default state where all numeric members are set to 0 or another de...
void incrementMaximumLikelihoodModelIndex()
Increases the value that indicates which stage the maximum likelihood adjustment is currently on...
Adds specific functionality to C++ strings.
~BundleResults()
Destroys this BundleResults object.
Namespace for ISIS/Bullet specific routines.
void incrementHeldImages()
Increases the number of 'held' images.
A container class for statistical results from a BundleAdjust solution.
Distance maxSigmaCoord2Distance() const
Returns the maximum sigma distance for coordinate 2.
void resetNumberConstrainedTargetParameters()
Resets the number of constrained target parameters to 0.
QString m_minSigmaCoord2PointId
The minimum sigma coordinate 2 point id.
void setSigma0(double sigma0)
Sets the sigma0.
int numberConstrainedPointParameters() const
Returns the number of constrained point parameters.
int iterations() const
Returns the number of iterations taken by the BundleAdjust.
QString maxSigmaCoord2PointId() const
Returns the maximum sigma point id for coordinate 2.
static QString modelToString(Model model)
Static method to return a string represtentation for a given MaximumLikelihoodWFunctions::Model enum...
int m_numberImageParameters
number of image parameters
void incrementNumberConstrainedTargetParameters(int incrementAmount)
Increases the number of constrained target parameters.
int degreesOfFreedom() const
Returns the degrees of freedom.
void setConverged(bool converged)
Sets if the bundle adjustment converged.
void setIterations(int iterations)
Sets the number of iterations taken by the BundleAdjust.
int numberImageParameters() const
Returns the total number of image parameters.
double m_sigma0
std deviation of unit weight
Manage a stack of content handlers for reading XML files.
QList< Statistics > m_rmsImageResiduals
RMS image sample and line residual statistics for each image in the bundle.
double sigma0() const
Returns the Sigma0 of the bundle adjustment.
Distance maxSigmaCoord1Distance() const
Returns the maximum sigma distance for coordinate 1.
int numberUnknownParameters() const
Returns the number of unknown parameters.
int numberIgnoredPoints() const
Returns the number of ignored points.
ConvergenceCriteria
This enum defines the options for the bundle adjustment's convergence.
void setDegreesOfFreedom(double degreesOfFreedom)
Sets the degrees of freedom.
QVector< Statistics > m_rmsImageTWISTSigmas
< The root mean square image twist sigmas.