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 Developer Reference
BundleAdjust.h
Go to the documentation of this file.
1#ifndef BundleAdjust_h
2#define BundleAdjust_h
3
9
10/* SPDX-License-Identifier: CC0-1.0 */
11
12#include <QObject> // parent class
13
14// std lib
15#include <vector>
16#include <fstream>
17
18// cholmod lib
19#include <cholmod.h>
20
21// Isis lib
22#include "BundleControlPoint.h"
26#include "BundleResults.h"
27#include "BundleSettings.h"
28#include "BundleSolutionInfo.h"
29#include "BundleTargetBody.h"
30#include "Camera.h"
31#include "CameraGroundMap.h"
32#include "ControlMeasure.h"
33#include "ControlNet.h"
34#include "LidarData.h"
35#include "LinearAlgebra.h"
38#include "Progress.h"
39#include "SerialNumberList.h"
40#include "SparseBlockMatrix.h"
41#include "Statistics.h"
42
43template< typename T > class QList;
44template< typename A, typename B > class QMap;
45
46namespace Isis {
47 class Control;
48 class ImageList;
49
333 class BundleAdjust : public QObject {
334 Q_OBJECT
335 public:
336 BundleAdjust(BundleSettingsQsp bundleSettings,
337 const QString &cnetFile,
338 const QString &cubeList,
339 bool printSummary = true,
340 const QString &isdList = "");
341 BundleAdjust(BundleSettingsQsp bundleSettings,
342 const QString &cnetFile,
343 const QString &cubeList,
344 const QString &lidarDataFile,
345 bool printSummary = true,
346 const QString &isdList = "");
347 BundleAdjust(BundleSettingsQsp bundleSettings,
348 QString &cnet,
349 SerialNumberList &snlist,
350 bool printSummary = true);
351 BundleAdjust(BundleSettingsQsp bundleSettings,
352 Control &cnet,
353 SerialNumberList &snlist,
354 bool bPrintSummary);
355 BundleAdjust(BundleSettingsQsp bundleSettings,
356 ControlNet &cnet,
357 SerialNumberList &snlist,
358 bool printSummary = true);
359 BundleAdjust(BundleSettingsQsp bundleSettings,
360 ControlNetQsp cnet,
361 const QString &cubeList,
362 bool printSummary = true,
363 const QString &isdList = "");
364 BundleAdjust(BundleSettingsQsp bundleSettings,
365 Control &control,
366 QList<ImageList *> imgList,
367 bool printSummary);
370
372 bool isAborted();
373
374 public slots:
375 bool solveCholesky();
376 void abortBundle();
377 void outputBundleStatus(QString status);
378
379 // accessors
380
384 QString fileName(int index);
385 QString isdFile(int index);
386 QString iterationSummaryGroup() const;
387 bool isConverged();
388 Table cMatrix(int index);
389 Table spVector(int index);
390 QString modelState(int index);
391 int numberOfImages() const;
392 double iteration() const;
393
394 signals:
395 void statusUpdate(QString);
396 void error(QString);
398 void pointUpdate(int);
399 void statusBarUpdate(QString);
400 void resultsReady(BundleSolutionInfo *bundleSolveInformation);
401 void finished();
402
403 private:
404 //TODO Should there be a resetBundle(BundleSettings bundleSettings) method
405 // that allows for rerunning with new settings? JWB
406 void readIsdList(const QString &isdList, const QString &cubeList);
407 void init(Progress *progress = 0);
408 bool initializeNormalEquationsMatrix();
409 bool validateNetwork();
410 bool solveSystem();
411 void iterationSummary();
412 BundleSolutionInfo* bundleSolveInformation();
413 bool computeBundleStatistics();
414 void applyParameterCorrections();
415 bool errorPropagation();
416 void computeResiduals();
417 double computeVtpv();
418 bool computeRejectionLimit();
419 bool flagOutliers();
420
421 // normal equation matrices methods
422
423 bool formNormalEquations();
424 bool computePartials(LinearAlgebra::Matrix &coeffTarget,
425 LinearAlgebra::Matrix &coeffImage,
426 LinearAlgebra::Matrix &coeffPoint3D,
427 LinearAlgebra::Vector &coeffRHS,
428 BundleMeasure &measure,
429 BundleControlPoint &point);
430 bool formMeasureNormals(LinearAlgebra::MatrixUpperTriangular &N22,
434 LinearAlgebra::Matrix &coeffTarget,
435 LinearAlgebra::Matrix &coeffImage,
436 LinearAlgebra::Matrix &coeffPoint3D,
437 LinearAlgebra::Vector &coeffRHS,
438 int observationIndex);
439 int formPointNormals(LinearAlgebra::MatrixUpperTriangular &N22,
443 BundleControlPointQsp &point);
444 int formLidarPointNormals(LinearAlgebra::MatrixUpperTriangular &N22,
449 bool formWeightedNormals(LinearAlgebra::VectorCompressed &n1,
451
452 // dedicated matrix functions
453
454 void productAB(SparseBlockColumnMatrix &A,
456 void accumProductAlphaAB(double alpha,
460 bool invert3x3(LinearAlgebra::MatrixUpperTriangular &m);
461 bool productATransB(LinearAlgebra::MatrixUpperTriangular &N22,
464
465 // CHOLMOD library methods
466
467 bool initializeCHOLMODLibraryVariables();
468 bool freeCHOLMODLibraryVariables();
469 bool loadCholmodTriplet();
470
471 // member variables
472
473 BundleSettingsQsp m_bundleSettings;
474 BundleResults m_bundleResults;
476 ControlNetQsp m_controlNet;
477 QString m_cnetFileName;
478
479 QVector<BundleControlPointQsp> m_bundleControlPoints;
480 BundleLidarPointVector m_bundleLidarControlPoints;
481
482 QString m_lidarFileName;
483 LidarDataQsp m_lidarDataSet;
484 int m_numLidarConstraints;
485
486 BundleObservationVector m_bundleObservations;
487 SerialNumberList *m_serialNumberList;
488 QStringList m_isdFiles;
489 BundleTargetBodyQsp m_bundleTargetBody;
490 bool m_abort;
491 QString m_iterationSummary;
492 bool m_printSummary;
493 bool m_cleanUp;
494 int m_rank;
495 int m_iteration;
496 double m_iterationTime;
497 int m_numberOfImagePartials;
498 QList<ImageList *> m_imageLists;
499
500 // ==========================================================================================
501 // === BEYOND THIS PLACE (THERE BE DRAGONS) all refers to the folded bundle solution. ===
502 // === Currently, everything uses the CHOLMOD library, ===
503 // === there is no dependence on the least-squares class. ===
504 // ==========================================================================================
505
507 boost::numeric::ublas::symmetric_matrix<
508 double,
509 boost::numeric::ublas::upper,
510 boost::numeric::ublas::column_major > m_normalInverse;
511 cholmod_common m_cholmodCommon;
516 SparseBlockMatrix m_sparseNormals;
520 cholmod_triplet *m_cholmodTriplet;
526 cholmod_sparse *m_cholmodNormal;
531 cholmod_factor *m_L;
535 LinearAlgebra::Vector m_imageSolution;
537
538 int m_previousNumberImagePartials;
541 };
542}
543
544#endif
QString modelState(int index)
Return the updated model state for the ith cube in the cube list given to the constructor.
Definition BundleAdjust.cpp:3052
int numberOfImages() const
Returns the number of images.
Definition BundleAdjust.cpp:2971
void statusBarUpdate(QString)
bool solveCholesky()
Compute the least squares bundle adjustment solution using Cholesky decomposition.
Definition BundleAdjust.cpp:902
void statusUpdate(QString)
SerialNumberList * serialNumberList()
Returns a pointer to the serial number list.
Definition BundleAdjust.cpp:2961
bool isConverged()
Returns if the BundleAdjust converged.
Definition BundleAdjust.cpp:3146
QString fileName(int index)
Return the ith filename in the cube list file given to constructor.
Definition BundleAdjust.cpp:2985
void abortBundle()
Flag to abort when bundle is threaded.
Definition BundleAdjust.cpp:883
void iterationUpdate(int)
double iteration() const
Returns what iteration the BundleAdjust is currently on.
Definition BundleAdjust.cpp:3009
void outputBundleStatus(QString status)
Slot for deltack and jigsaw to output the bundle status.
Definition BundleAdjust.cpp:3182
void pointUpdate(int)
LidarDataQsp lidarData()
Returns a pointer to the output lidar data file.
Definition BundleAdjust.cpp:2951
bool isAborted()
Returns if the BundleAdjust has been aborted.
Definition BundleAdjust.cpp:3156
Table cMatrix(int index)
Return the updated instrument pointing table for the ith cube in the cube list given to the construct...
Definition BundleAdjust.cpp:3024
QList< ImageList * > imageLists()
This method returns the image list used in the bundle adjust.
Definition BundleAdjust.cpp:2544
QString iterationSummaryGroup() const
Returns the iteration summary string.
Definition BundleAdjust.cpp:3168
QString isdFile(int index)
Return the isd file path for the image with index i.
Definition BundleAdjust.cpp:2997
void resultsReady(BundleSolutionInfo *bundleSolveInformation)
void error(QString)
BundleAdjust(BundleSettingsQsp bundleSettings, const QString &cnetFile, const QString &cubeList, bool printSummary=true, const QString &isdList="")
Construct a BundleAdjust object from the given settings, control network file, and cube list.
Definition BundleAdjust.cpp:114
BundleSolutionInfo * solveCholeskyBR()
Compute the least squares bundle adjustment solution using Cholesky decomposition.
Definition BundleAdjust.cpp:873
ControlNetQsp controlNet()
Returns a pointer to the output control network.
Definition BundleAdjust.cpp:2941
~BundleAdjust()
Destroys BundleAdjust object, deallocates pointers (if we have ownership), and frees variables from c...
Definition BundleAdjust.cpp:399
Table spVector(int index)
Return the updated instrument position table for the ith cube in the cube list given to the construct...
Definition BundleAdjust.cpp:3039
This class holds information about a control point that BundleAdjust needs to run correctly.
Definition BundleControlPoint.h:91
This class is a container class for BundleLidarControlPoints.
Definition BundleLidarPointVector.h:31
A container class for a ControlMeasure.
Definition BundleMeasure.h:55
This class is a container class for BundleObservations.
Definition BundleObservationVector.h:57
A container class for statistical results from a BundleAdjust solution.
Definition BundleResults.h:90
Container class for BundleAdjustment results.
Definition BundleSolutionInfo.h:174
This represents an ISIS control net in a project-based GUI interface.
Definition Control.h:65
a control network
Definition ControlNet.h:257
Internalizes a list of images and allows for operations on the entire list.
Definition ImageList.h:52
boost::numeric::ublas::compressed_vector< double > VectorCompressed
Definition for an Isis::LinearAlgebra::VectorCompressed of doubles.
Definition LinearAlgebra.h:142
boost::numeric::ublas::vector< double > Vector
Definition for an Isis::LinearAlgebra::Vector of doubles.
Definition LinearAlgebra.h:132
boost::numeric::ublas::matrix< double > Matrix
Definition for an Isis::LinearAlgebra::Matrix of doubles.
Definition LinearAlgebra.h:102
boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > MatrixUpperTriangular
Definition for an Isis::LinearAlgebra::MatrixUpperTriangular of doubles with an upper configuration.
Definition LinearAlgebra.h:122
Program progress reporter.
Definition Progress.h:42
Serial Number list generator.
Definition SerialNumberList.h:65
SparseBlockColumnMatrix.
Definition SparseBlockMatrix.h:58
SparseBlockMatrix.
Definition SparseBlockMatrix.h:186
SparseBlockRowMatrix.
Definition SparseBlockMatrix.h:125
This is free and unencumbered software released into the public domain.
Definition BoxcarCachingAlgorithm.h:13
This is free and unencumbered software released into the public domain.
Definition CubeIoHandler.h:23
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
QSharedPointer< BundleLidarControlPoint > BundleLidarControlPointQsp
QSharedPointer to a BundleLidarControlPoint.
Definition BundleLidarControlPoint.h:74
QSharedPointer< BundleSettings > BundleSettingsQsp
Definition for a BundleSettingsQsp, a shared pointer to a BundleSettings object.
Definition BundleSettings.h:356
QSharedPointer< ControlNet > ControlNetQsp
Typedef for QSharedPointer to control network. This typedef is for future implementation of target bo...
Definition ControlNet.h:485
QSharedPointer< BundleTargetBody > BundleTargetBodyQsp
Definition for BundleTargetBodyQsp, a QSharedPointer to a BundleTargetBody.
Definition BundleTargetBody.h:187
QSharedPointer< BundleControlPoint > BundleControlPointQsp
Definition for BundleControlPointQSP, a shared pointer to a BundleControlPoint.
Definition BundleControlPoint.h:192