Isis 3.0 Programmer Reference
Back | Home
Isis::BundleAdjust Class Reference

An image bundle adjustment object. More...

#include <BundleAdjust.h>

Inheritance diagram for Isis::BundleAdjust:
Inheritance graph
Collaboration diagram for Isis::BundleAdjust:
Collaboration graph

Public Slots

bool solveCholesky ()
 Compute the least squares bundle adjustment solution using Cholesky decomposition. More...
 
void abortBundle ()
 Flag to abort when bundle is threaded. More...
 
void outputBundleStatus (QString status)
 Slot for deltack and jigsaw to output the bundle status. More...
 
ControlNetQsp controlNet ()
 Returns a pointer to the output control network. More...
 
SerialNumberListserialNumberList ()
 Returns a pointer to the serial number list. More...
 
QString fileName (int index)
 Return the ith filename in the cube list file given to constructor. More...
 
QString iterationSummaryGroup () const
 Returns the iteration summary string. More...
 
bool isConverged ()
 Returns if the BundleAdjust converged. More...
 
Table cMatrix (int index)
 Return a table cmatrix for the ith cube in the cube list given to the constructor. More...
 
Table spVector (int index)
 Return a table spacecraft vector for the ith cube in the cube list given to the constructor. More...
 
int numberOfImages () const
 Returns the number of images. More...
 
double iteration () const
 Returns what iteration the BundleAdjust is currently on. More...
 

Signals

void statusUpdate (QString)
 
void error (QString)
 
void iterationUpdate (int, double)
 
void resultsReady (BundleSolutionInfo *bundleSolveInformation)
 
void finished ()
 

Public Member Functions

 BundleAdjust (BundleSettingsQsp bundleSettings, const QString &cnetFile, const QString &cubeList, bool printSummary=true)
 Construct a BundleAdjust object from the given settings, control network file, and cube list. More...
 
 BundleAdjust (BundleSettingsQsp bundleSettings, QString &cnet, SerialNumberList &snlist, bool printSummary=true)
 Construct a BundleAdjust object with held cubes. More...
 
 BundleAdjust (BundleSettingsQsp bundleSettings, Control &cnet, SerialNumberList &snlist, bool bPrintSummary)
 Constructs a BundleAdjust object using a Control object. More...
 
 BundleAdjust (BundleSettingsQsp bundleSettings, ControlNet &cnet, SerialNumberList &snlist, bool printSummary=true)
 Constructs a BundleAdjust object using a ControlNet object. More...
 
 BundleAdjust (BundleSettingsQsp bundleSettings, ControlNetQsp cnet, const QString &cubeList, bool printSummary=true)
 Constructs a BundleAdjust from an already created ControlNet within a shared pointer. More...
 
 BundleAdjust (BundleSettingsQsp bundleSettings, Control &control, QList< ImageList * > imgList, bool printSummary)
 Thread safe constructor. More...
 
 ~BundleAdjust ()
 Destroys BundleAdjust object, deallocates pointers (if we have ownership), and frees variables from cholmod library. More...
 
BundleSolutionInfo solveCholeskyBR ()
 Compute the least squares bundle adjustment solution using Cholesky decomposition. More...
 

Private Member Functions

void init (Progress *progress=0)
 Initialize all solution parameters. More...
 
bool validateNetwork ()
 control network validation - on the very real chance that the net has not been checked before running the bundle More...
 
bool solveSystem ()
 Compute the solution to the normal equations using the CHOLMOD library. More...
 
void iterationSummary ()
 Creates an iteration summary and an iteration group for the solution summary. More...
 
BundleSolutionInfo bundleSolveInformation ()
 Create a BundleSolutionInfo containing the settings and results from the bundle adjustment. More...
 
bool computeBundleStatistics ()
 Compute Bundle statistics and store them in m_bundleResults. More...
 
void applyParameterCorrections ()
 apply parameter corrections for solution. More...
 
bool errorPropagation ()
 Error propagation for solution. More...
 
double computeResiduals ()
 This method computes the focal plane residuals for the measures. More...
 
bool computeRejectionLimit ()
 Compute rejection limit. More...
 
bool flagOutliers ()
 Flags outlier measures and control points. More...
 
bool formNormalEquations ()
 Form the least-squares normal equations matrix via cholmod. More...
 
bool computePartials (LinearAlgebra::Matrix &coeffTarget, LinearAlgebra::Matrix &coeffImage, LinearAlgebra::Matrix &coeffPoint3D, LinearAlgebra::Vector &coeffRHS, BundleMeasure &measure, BundleControlPoint &point)
 Compute partial derivatives and weighted residuals for a measure. More...
 
bool formMeasureNormals (boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > &N22, SparseBlockColumnMatrix &N12, boost::numeric::ublas::compressed_vector< double > &n1, LinearAlgebra::Vector &n2, LinearAlgebra::Matrix &coeffTarget, LinearAlgebra::Matrix &coeffImage, LinearAlgebra::Matrix &coeffPoint3D, LinearAlgebra::Vector &coeffRHS, int observationIndex)
 Form the auxilary normal equation matrices for a measure. More...
 
bool formPointNormals (boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > &N22, SparseBlockColumnMatrix &N12, LinearAlgebra::Vector &n2, LinearAlgebra::Vector &nj, BundleControlPointQsp &point)
 Compute the Q matrix and NIC vector for a control point. More...
 
bool formWeightedNormals (boost::numeric::ublas::compressed_vector< double > &n1, LinearAlgebra::Vector &nj)
 Apply weighting for spacecraft position, velocity, acceleration and camera angles, angular velocities, angular accelerations if so stipulated (legalese). More...
 
void productAB (SparseBlockColumnMatrix &A, SparseBlockRowMatrix &B)
 Perform the matrix multiplication C = N12 x Q. More...
 
void accumProductAlphaAB (double alpha, SparseBlockRowMatrix &A, LinearAlgebra::Vector &B, LinearAlgebra::Vector &C)
 Performs the matrix multiplication nj = nj + alpha (Q x n2). More...
 
bool invert3x3 (boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > &m)
 Dedicated quick inverse of 3x3 matrix. More...
 
bool productATransB (boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > &N22, SparseBlockColumnMatrix &N12, SparseBlockRowMatrix &Q)
 Perform the matrix multiplication Q = N22 x N12(transpose) More...
 
void productAlphaAV (double alpha, boost::numeric::ublas::bounded_vector< double, 3 > &v2, SparseBlockRowMatrix &Q, LinearAlgebra::Vector &v1)
 Perform the matrix multiplication v2 = alpha ( Q x v1 ). More...
 
bool initializeCHOLMODLibraryVariables ()
 Initializations for CHOLMOD sparse matrix package. More...
 
bool freeCHOLMODLibraryVariables ()
 Free CHOLMOD library variables. More...
 
bool cholmodInverse ()
 Compute inverse of normal equations matrix for CHOLMOD. More...
 
bool loadCholmodTriplet ()
 Load sparse normal equations matrix into CHOLMOD triplet. More...
 
bool wrapUp ()
 Compute the residuals for each adjusted point and store adjustment results in m_bundleResults. More...
 

Private Attributes

BundleSettingsQsp m_bundleSettings
 Contains the solve settings. More...
 
BundleResults m_bundleResults
 
 Stores the results of the

< bundle adjust. More...

 
Statistics m_xResiduals
 x residual statistics. More...
 
Statistics m_yResiduals
 y residual statistics. More...
 
Statistics m_xyResiduals
 xy residual statistics. More...
 
ControlNetQsp m_controlNet
 Output control net. More...
 
QString m_cnetFileName
 The control net filename. More...
 
QVector< BundleControlPointQspm_bundleControlPoints
 
BundleObservationVector m_bundleObservations
 !< Vector of control points. More...
 
SerialNumberListm_serialNumberList
 !< Vector of observations. More...
 
BundleTargetBodyQsp m_bundleTargetBody
 
Distance m_bodyRadii [3]
 !< Contains information about the target body. More...
 
bool m_abort
 If the bundle should abort. More...
 
QString m_iterationSummary
 
bool m_printSummary
 !< Summary of the most recently completed iteration. More...
 
bool m_cleanUp
 !< If the iteration summaries should be output to the log file. More...
 
int m_rank
 !< If the serial number lists need to be deleted by the destructor. More...
 
int m_iteration
 The current iteration. More...
 
int m_numberOfImagePartials
 number of image-related partials. More...
 
double m_radiansToMeters
 
double m_metersToRadians
 !< The body specific radians to meters conversion factor. More...
 
boost::numeric::ublas::symmetric_matrix
< double,
boost::numeric::ublas::upper,
boost::numeric::ublas::column_major > 
m_normalInverse
 !< The body specific meters to radians conversion factor. More...
 
cholmod_common m_cholmodCommon
 
LinearAlgebra::Vector m_RHS
 !< Contains object parameters, statistics, and workspace used by the CHOLMOD library. More...
 
SparseBlockMatrix m_sparseNormals
 !< The right hand side of the normal equations. More...
 
cholmod_triplet * m_cholmodTriplet
 !< The sparse block normal equations matrix. More...
 
cholmod_sparse * m_cholmodNormal
 !< The CHOLMOD triplet representation of the sparse normal equations matrix. More...
 
cholmod_factor * m_L
 !< The CHOLMOD sparse normal equations matrix used by cholmod_factorize to solve the system. More...
 
LinearAlgebra::Vector m_imageSolution
 !< The lower triangular L matrix from Cholesky decomposition. More...
 

Detailed Description

An image bundle adjustment object.

BundleAdjust is used to perform a bundle adjustment on overlapping ISIS 3 cubes. Using the collineariy condition, BundleAdjust can construct a system of normal equations and then using the CHOLMOD library, solve that system.

Author
2006-05-30 Jeff Anderson, Debbie A. Cook, and Tracie Sucharski
History:

2005-05-30 Jeff Anderson, Debbie A. Cook & Tracie Sucharski - Original version

2007-05-29 Debbie A. Cook - Added new method iterationSummary and changed points on held images to held instead of ground.

2007-07-12 Debbie A. Cook - Fixed bug in iteration statistics calculations in the case of a single control point that was causing a divide by zero error.

2007-08-25 Debbie A. Cook - Added methods and members to support instrument position solution.

2007-09-17 Debbie A. Cook - Added ability to process in observation mode for Lunar Orbiter.

2007-11-17 Debbie A. Cook - Added method SetSolution Method.

2007-12-21 Debbie A. Cook - Added member p_Degree and methods m_nsolveCamDegree and ckDegree.

2008-01-11 Debbie A. Cook - Added observation mode functionality for spacecraft position and upgraded ObservationNumber methods for compatability.

2008-01-14 Debbie A. Cook - Added code to solve for local radii.

2008-04-18 Debbie A. Cook - Added progress for ControlNet.

2008-06-18 Christopher Austin - Fixed ifndef.

2008-11-07 Tracie Sucharski - Added bool to constructors to indicate whether to print iteration summary info to the session log. This was needed for qtie which has no session log.

2008-11-22 Debbie A. Cook - Added code to wrap longitude to keep it in [0.0, 360.0].

2008-11-22 Debbie A. Cook - Added new call to get timeScale and set for the observation along with basetime.

2008-11-26 Debbie A. Cook - Added check to applyHeldList for Ignored points and measures.

2009-01-08 Debbie A. Cook - Revised AddPartials and PointPartial to avoid using the camera methods to map a body-fixed vector to the camera because they compute a new time for line scan cameras based on the lat/lon/radius and the new time is used to retrieve Spice. The updated software uses the Spice at the time of the measurement.

2009-02-15 Debbie A. Cook - Corrected focal length to include its sign and removed obsolete calls to X/Y direction methods. Also modified PointPartial to use lat/lon/radius from the point instead of the camera.

2009-08-13 Debbie A. Cook - Corrected calculations of cudx and cudy so that they use the signed focal length also.

2009-10-14 Debbie A. Cook - Modified AddPartials method to use new CameraGroundMap method, GetXY.

2009-10-30 Debbie A. Cook - Improved error message in AddPartials.

2009-12-14 Debbie A. Cook - Updated SpicePosition enumerated partial type constants.

2010-03-19 Debbie A. Cook - Moved partials to GroundMap classes to support Radar sensors and modified argument list for GroundMap method ComputeXY since it now returns cudx and cudy.

2010-06-18 Debbie A. Cook - Added p_cnetFile as member since it was taken out of ControlNet.

2010-07-09 Ken Edmundson - Added Folding in solution method (SPECIALK), error propogation, statistical report, etc.

2010-08-13 Debbie A. Cook - Changed surface point from lat/lon/radius to body-fixed XYZ.

2010-12-17 Debbie A. Cook - Merged Ken Edmundson version with system and updated to new binary control net.

2011-02-01 Debbie A. Cook - Moved code to create point index map into its own method to be called after the solution method has been set.

2011-02-17 Debbie A. Cook - Updated to use new parameter added to SpicePosition, p_timeScale.

2011-03-05 Debbie A. Cook - Put point index creation back in init. This will prevent QRD and SVD from working if ground points are in the control net.

2011-03-29 Ken Edmundson - Fixed bug in observation mode when solving for spacecraft position and improved output.

2011-04-02 Debbie A. Cook - Updated to ControlPoint class changes regarding target radii. Also separated out 2 sets of calculations to test later for efficiency.

2011-06-05 Debbie A. Cook - Changed checks for solution type to match change from SPARSE to SPARSE-LU.

2011-06-07 Debbie A. Cook - and Tracie Sucharski - Modified point types from Ground to Fixed and from Tie to Free.

2011-06-14 Debbie A. Cook - added method isHeld(int index) for preventing any updates to held images.

2011-06-27 Debbie A. Cook - and Ken Edmundson Added names to top header fields of .csv output and fixed bugs in sparse output.

2011-07-12 Ken Edmundson - Segmentation fault bugfix in OutputHeader method. Previously was attempting to output camera angle sigmas when none had been allocated.

2011-07-14 Ken Edmundson and Debbie Cook - Added new member, m_bDeltack to indicate calling application was deltack (or qtie) and has potential to have a single ControlPoint and ControlMeasure.

2011-08-08 Tracie Sucharski - Added method to return the iteration summary to be used in qtie which does not have a log file. In SetImages, clear the cameraMavtpv_targetBodyp and cameraList. Added this back in (was originally added on 2011-01-19), was deleted somewhere along the line.

2011-09-28 Debbie A. Cook - Renamed SPARSE solve method to OLDSPARSE and CHOLMOD to SPARSE.

2011-10-14 Ken Edmundson - Added call to m_pCnet->ClearJigsawRejected() to the init() method to set all measure/point JigsawRejected flags to false prior to bundle.

2011-12-09 Ken Edmundson - Memory leak fix in method cholmodInverse. Need call to "cholmod_free_dense(&x,&m_cholmodCommon)" inside loop.

2011-12-20 Ken Edmundson - Fixes to outlier rejection. Added rejection multiplier member variable, can be set in jigsaw interface.

2012-02-02 Debbie A. Cook - Added SetSolvePolyOverHermite method and members m_bSolvePolyOverHermite and m_positionType.

2012-03-26 Orrin Thomas - Added maximum likelihood capabilities.

2012-05-21 Debbie A. Cook - Added initialization of m_dRejectionMultiplier.

2012-07-06 Debbie A. Cook - Updated Spice members to be more compliant with Isis coding standards. References #972.

2012-09-28 Ken Edmundson - Initialized variables for bundle statistic computations. The bundleout.txt file was modifed to show N/A for RMS, Min, Max of Radius Sigmas when not solving for radius. References #783.

2013-11-12 Ken Edmundson - Programmers Note. References #813, #1521, #1653 #813 - Info echoed to screen when using Maximum Likelihood methods are now printed to print.prt file. #1521 - The cout debug statements that appear on screen when updating images were removed from SpiceRotation.cpp #1653 - Constraints were being applied for "Free" points that have constrained coordinates. Also found that a priori coordinates for these points were not being computed in ControlPoint::ComputeApriori, this has also been fixed.

2013-12-18 Tracie Sucharski - The ControlNet::GetNumberOfMeasuresInImage was renamed to ControlNet::GetNumberOfValidMeasuresInImage and only returns the number of valid (Ignore= False) measures.

2014-02-25 Ken Edmundson - Speed up and memory improvements to error propagation. References #2031.

2014-05-16 Jeannie Backer - Added BundleSettings object to constructor inputs. Cleaned and organized code. Updated to be more compliant with ISIS coding standards.

2014-07-14 Kimberly Oyama - Added support for correlation matrix. Covariance matrix is now written to a file and the location is saved as part of the CorrelationMatrix object.

2014-07-23 Jeannie Backer - Modified to print "N/A" for rejection multiplier if outlier rejection is turned off.

2014-09-18 Kimberly Oyama - Added a constructor for running the bunlde in a separate thread.

2014-11-05 Ken Edmundson - Fixed memory bug. Wasn't releasing cholmod_factor m_L every iteration. Now release every iteration but the last since we

2015-02-20 Jeannie Backer - Updated to be more compliant with ISIS coding standards.

2015-08-17 Jeannie Backer - Updated to be more compliant with ISIS coding standards.

2015-09-03 Jeannie Backer - Changed the name of the output correlation matrix file from ["inverseMatrix" + random unique code + ".dat"] to [BundleSettings::outputFilePrefix() + "inverseMatrix.dat"]. So that the prefix can be used to specify the path of the location where the matrix file should be written. Some improvements made to comply with coding standards.

2015-09-10 Ian Humphrey - Fixed include for cholmod header after updating v005 libraries.

2016-07-11 Jesse Mapel - Changed m_bundleControlPoints to be a vector of QSharedPointers to BundleControlPoints instead of a BundleControlPointVector. Fixes #4099.

2016-07-11 Jeannie Backer - Removed initialize(). Implementation was moved the the bottom of init() method. Fixes #4161.

2016-08-03 Jesse Mapel - Changed BundleObservationVector to a vector of QSharedPointers. Fixes #4150.

2016-08-10 Jeannie Backer - Replaced boost vectors and matrices with Isis::LinearAlgebra::Vector and Isis::LinearAlgebra::Matrix, respectively. References #4163.

2016-08-15 Jesse Mapel - Moved write methods to BundleSolutionInfo. Changed constructors to always construct a new control network. Fixes #4159.

2016-08-15 Ian Humphrey - Replaced ISIS ControlPoint and ControlMeasure uses with BundleControlPoint and BundleMeasure. No longer need to check if the BundleControlPoint or BundleMeasure is ignored before use, since we only add non-ignored ControlPoints to the BundleControlPoint, and we only add non-ignored ControlMeasures to the BundleControlPoint. Fixes #4173, #4201.

2016-08-16 Jesse Mapel - Added error throw when covariance matrices are not symmetric due to unstable data and settings. Fixes #2302.

2016-08-17 Jesse Mapel - Moved all method implementations to the cpp file. Fixes #4185.

2016-08-18 Jeannie Backer - Removed all references to deprecated solve methods SpeckialK and OldSparse. Fixes #4162.

2016-08-23 Jesse Mapel - Removed output file calls. Apps and objects that use BundleAdjust must call output methods from BundleSolutionInfo. Fixes #4279.

2016-08-24 Jesse Mapel - Updated documentation and member variable names. Brought closer to ISIS 3 coding standards. Fixes #4183, #4188, #4235.

2016-08-28 Kelvin Rodriguez - Remvoed useless register keywords to squash warnigns in clang. Part of porting to OS X 10.11.

2016-09-22 Ian Humphrey - Modified validateNetwork() so that validation status messages are logged to stdout. Fixes #4313.

2016-10-05 Ian Humphrey - Modified errorPropagation_CHOLMOD() to check bundle settings to see if it should generate the inverseMatrix.dat file. References #4315.

2016-10-13 Ian Humphrey - Added constructor that takes a ControlNetQsp, so that when jigsaw modifies a control net for a held image, the control net can be passed as a shared pointer. Removed m_pHeldSnList, isHeld(), checkHeldList(), applyHeldList(), two constructors that used heldList parameters. Modified destructor to not delete m_pHeldSnList, since it was removed. Fixes #4293.

2016-10-17 Adam Paquette - Cleaned up terminal output for readability and cohesion Fixes #4263, #4311, #4312.

2016-10-18 Ian Humphrey - Modified iterationSummary() to always output Rejected_Measures kewyord, regardless of outlier rejection being on or off. Fixes #4461.

2016-10-25 Ian Humphrey - Modified iterationSumary() to always output Rejected_Measures keyword, regarldess of outlier rjection being on or off. Fixes #4461. Modified solveCholesky() and computeRejectionLimit() so jigsaw's std out for Rejection Limit, Sigma0, and Elapsed Time match ISIS production's jigsaw std out. Fixes #4463.

2016-10-28 Ian Humphrey - Modified solveCholesky() and errorPropagation() to change spacing in terminal output, so that it matches production. References #4463.

2016-11-16 Ian Humphrey - Modified solveCholesky() to throw caught exceptions that occur. Removed bundleException(QString) signal. Fixes #4483.

2016-12-01 Ian Humphrey - Modified outputBundleStatus()'s printf() call so that there is no longer a -Wformat-security warning.

Definition at line 271 of file BundleAdjust.h.

Constructor & Destructor Documentation

Isis::BundleAdjust::BundleAdjust ( BundleSettingsQsp  bundleSettings,
const QString &  cnetFile,
const QString &  cubeList,
bool  printSummary = true 
)

Construct a BundleAdjust object from the given settings, control network file, and cube list.

Parameters
bundleSettingsA shared pointer to the BundleSettings to be used.
cnetFileThe filename of the control network to be used.
cubeListThe list of filenames of the cubes to be adjusted.
printSummaryIf summaries should be printed each iteration.

Definition at line 94 of file BundleAdjust.cpp.

Isis::BundleAdjust::BundleAdjust ( BundleSettingsQsp  bundleSettings,
QString &  cnetFile,
SerialNumberList snlist,
bool  printSummary = true 
)

Construct a BundleAdjust object with held cubes.

Parameters
bundleSettingsA shared pointer to the BundleSettings to be used.
cnetFileThe filename of the control network to be used.
cubeListThe list of filenames of the cubes to be adjusted.
heldListThe list of filenames of the held cubes. Held cubes must be in both heldList and cubeList.
printSummaryIf summaries should be printed each iteration.

Definition at line 126 of file BundleAdjust.cpp.

Isis::BundleAdjust::BundleAdjust ( BundleSettingsQsp  bundleSettings,
Control cnet,
SerialNumberList snlist,
bool  printSummary 
)

Constructs a BundleAdjust object using a Control object.

A new control network object will be created as a copy of the Control's control network.

Parameters
bundleSettingsA shared pointer to the BundleSettings to be used.
cnetThe Control object whose control network will be copied. The Control will not be modified by the BundleAdjust.
snlistA serial number list containing the cubes to be adjusted.
printSummaryIf summaries should be printed each iteration.

Definition at line 158 of file BundleAdjust.cpp.

References Isis::Control::fileName().

Isis::BundleAdjust::BundleAdjust ( BundleSettingsQsp  bundleSettings,
ControlNet cnet,
SerialNumberList snlist,
bool  printSummary = true 
)

Constructs a BundleAdjust object using a ControlNet object.

A copy of the ControlNet will be used.

Parameters
bundleSettingsA shared pointer to the BundleSettings to be used.
cnetThe ControlNet that will be copied. The original ControlNet will not be modified.
snlistA serial number list containing the cubes to be adjusted.
printSummaryIf summaries should be printed each iteration.

Definition at line 190 of file BundleAdjust.cpp.

Isis::BundleAdjust::BundleAdjust ( BundleSettingsQsp  bundleSettings,
ControlNetQsp  cnet,
const QString &  cubeList,
bool  printSummary = true 
)

Constructs a BundleAdjust from an already created ControlNet within a shared pointer.

Parameters
bundleSettingsQSharedPointer to the bundle settings to use.
cnetQSharedPointer to the control net to adjust.
cubeListQString name of list of cubes to create serial numbers for.
printSummaryBoolean indicating whether to print application output summary.

Definition at line 219 of file BundleAdjust.cpp.

Isis::BundleAdjust::BundleAdjust ( BundleSettingsQsp  bundleSettings,
Control control,
QList< ImageList * >  imgLists,
bool  printSummary 
)

Thread safe constructor.

Parameters
bundleSettingsA shared pointer to the BundleSettings to be used.
controlThe Control object whose control network will be copied. The Control will not be modified by the BundleAdjust.
snlistA serial number list containing the cubes to be adjusted.
printSummaryIf summaries should be printed each iteration.

Definition at line 246 of file BundleAdjust.cpp.

References Isis::SerialNumberList::add(), Isis::Control::fileName(), and Isis::Image::fileName().

Isis::BundleAdjust::~BundleAdjust ( )

Destroys BundleAdjust object, deallocates pointers (if we have ownership), and frees variables from cholmod library.

History:
2016-10-13 Ian Humphrey - Removed deallocation of m_pHeldSnList, since this member was removed. References #4293.

Definition at line 287 of file BundleAdjust.cpp.

Member Function Documentation

void Isis::BundleAdjust::abortBundle ( )
slot

Flag to abort when bundle is threaded.

Flag is set outside the bundle thread, typically by the gui thread.

Definition at line 621 of file BundleAdjust.cpp.

void Isis::BundleAdjust::accumProductAlphaAB ( double  alpha,
SparseBlockRowMatrix A,
LinearAlgebra::Vector B,
LinearAlgebra::Vector C 
)
private

Performs the matrix multiplication nj = nj + alpha (Q x n2).

Parameters
alphaA constant multiplier.
QA sparse block matrix.
n2A vector.
njThe output accumulation vector.
See Also
BundleAdjust::formPointNormals

Definition at line 1467 of file BundleAdjust.cpp.

void Isis::BundleAdjust::applyParameterCorrections ( )
private
BundleSolutionInfo Isis::BundleAdjust::bundleSolveInformation ( )
private

Create a BundleSolutionInfo containing the settings and results from the bundle adjustment.

Returns
BundleSolutionInfo A container with solve information from the adjustment.

Definition at line 931 of file BundleAdjust.cpp.

References Isis::BundleSolutionInfo::setRunTime().

bool Isis::BundleAdjust::cholmodInverse ( )
private

Compute inverse of normal equations matrix for CHOLMOD.

The inverse is stored in m_normalInverse.

Returns
bool If the inverse was successfully computed.

This seems to be unused. JAM

Definition at line 1697 of file BundleAdjust.cpp.

Table Isis::BundleAdjust::cMatrix ( int  i)
slot

Return a table cmatrix for the ith cube in the cube list given to the constructor.

Parameters
iThe index of the cube
Returns
Table The InstrumentPointing table for the cube.

Definition at line 2901 of file BundleAdjust.cpp.

bool Isis::BundleAdjust::computeBundleStatistics ( )
private

Compute Bundle statistics and store them in m_bundleResults.

Sets: m_rmsImageSampleResiduals m_rmsImageLineResiduals m_rmsImageResiduals

m_rmsImageXSigmas m_rmsImageYSigmas m_rmsImageZSigmas m_rmsImageRASigmas m_rmsImageDECSigmas m_rmsImageTWISTSigmas

m_maxSigmaLatitude m_maxSigmaLatitudePointId m_maxSigmaLongitude m_maxSigmaLongitudePointId m_maxSigmaRadius m_maxSigmaRadiusPointId

m_minSigmaLatitude m_minSigmaLatitudePointId m_minSigmaLongitude m_minSigmaLongitudePointId m_minSigmaRadius m_minSigmaRadiusPointId

m_rmsSigmaLat m_rmsSigmaLon m_rmsSigmaRad

Returns
bool If the statistics were successfully computed and stored.

Definition at line 3059 of file BundleAdjust.cpp.

References Isis::Statistics::AddData(), Isis::Distance::meters(), and Isis::Statistics::Rms().

bool Isis::BundleAdjust::computePartials ( LinearAlgebra::Matrix coeffTarget,
LinearAlgebra::Matrix coeffImage,
LinearAlgebra::Matrix coeffPoint3D,
LinearAlgebra::Vector coeffRHS,
BundleMeasure measure,
BundleControlPoint point 
)
private

Compute partial derivatives and weighted residuals for a measure.

coeffTarget, coeffImage, coeffPoint3D, and coeffRHS will be filled with the different partial derivatives.

Parameters
coeffTargetA matrix that will contain target body pertial derivatives.
coeffImageA matrix that will contain camera position and orientation partial derivatives.
coeffPoint3DA matrix that will contain point lat, lon, and radius partial derivatives.
coeffRHSA vector that will contain weighted x,y residuals.
measureThe measure that partials are being computed for.
pointThe point containing measure.
Returns
bool If the partials were successfully computed.
Exceptions
IException::User"Unable to map apriori surface point for measure"

Definition at line 1793 of file BundleAdjust.cpp.

References _FILEINFO_, Isis::BundleControlPoint::adjustedSurfacePoint(), Isis::BundleMeasure::camera(), Isis::BundleMeasure::cubeSerialNumber(), Isis::CameraGroundMap::EllipsoidPartial(), Isis::BundleMeasure::focalPlaneMeasuredX(), Isis::BundleMeasure::focalPlaneMeasuredY(), Isis::Camera::GetCameraType(), Isis::CameraGroundMap::GetdXYdOrientation(), Isis::CameraGroundMap::GetdXYdPoint(), Isis::CameraGroundMap::GetdXYdPosition(), Isis::CameraGroundMap::GetdXYdTOrientation(), Isis::CameraGroundMap::GetXY(), Isis::Camera::GroundMap(), Isis::BundleControlPoint::id(), Isis::BundleMeasure::line(), Isis::CameraGroundMap::MeanRadiusPartial(), Isis::BundleMeasure::observationSolveSettings(), Isis::BundleMeasure::parentBundleObservation(), Isis::Camera::PixelPitch(), Isis::CameraGroundMap::PointPartial(), Isis::BundleMeasure::sample(), and Isis::Camera::SetImage().

bool Isis::BundleAdjust::computeRejectionLimit ( )
private

Compute rejection limit.

Computes the median and the median absolute deviation (M.A.D.) of the residuals. Then, sets the rejection limit in m_bundleResults to median + RejectionMultiplier * M.A.D.

Returns
bool If the rejection limit was successfully computed and set.

should this be in BundleResults?

History:
2016-10-25 Ian Humphrey - "Rejection Limit" is output to std out again immediately after "mad." References #4463.

Definition at line 2339 of file BundleAdjust.cpp.

double Isis::BundleAdjust::computeResiduals ( )
private

This method computes the focal plane residuals for the measures.

Returns
double Weighted sum of the squares of the residuals, vtpv.
History:
2012-01-18 Debbie A. Cook - Fixed the computation of vx and vy to make sure they are focal plane x and y residuals instead of image sample and line residuals.

Definition at line 2203 of file BundleAdjust.cpp.

ControlNetQsp Isis::BundleAdjust::controlNet ( )
slot

Returns a pointer to the output control network.

Returns
ControlNetQsp A shared pointer to the output control network.

Definition at line 2846 of file BundleAdjust.cpp.

bool Isis::BundleAdjust::errorPropagation ( )
private

Error propagation for solution.

Returns
bool If the error propagation was successful.
Exceptions
IException::User"Input data and settings are not sufficiently stable for error propagation."
History:

2016-10-05 Ian Humphrey - Updated to check to see if bundle settings is allowing us to create the inverse matrix correlation file. References #4315.

2016-10-28 Ian Humphrey - Added extra newline between Error Propagation: Inverse Blocking and Filling point covariance messages. References #4463.

Definition at line 2550 of file BundleAdjust.cpp.

References _FILEINFO_, Isis::iTime::CurrentLocalTime(), Isis::Distance::meters(), Isis::SparseBlockColumnMatrix::numberOfColumns(), Isis::SparseBlockColumnMatrix::numberOfRows(), Isis::Angle::radians(), and Isis::SurfacePoint::SetSphericalSigmasDistance().

QString Isis::BundleAdjust::fileName ( int  i)
slot

Return the ith filename in the cube list file given to constructor.

Parameters
iThe index of the cube.
Returns
QString The filename of the cube.

Definition at line 2879 of file BundleAdjust.cpp.

bool Isis::BundleAdjust::flagOutliers ( )
private

Flags outlier measures and control points.

Returns
bool If the flagging was successful.

How should we handle points with few measures.

Definition at line 2429 of file BundleAdjust.cpp.

bool Isis::BundleAdjust::formMeasureNormals ( boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > &  N22,
SparseBlockColumnMatrix N12,
boost::numeric::ublas::compressed_vector< double > &  n1,
LinearAlgebra::Vector n2,
LinearAlgebra::Matrix coeffTarget,
LinearAlgebra::Matrix coeffImage,
LinearAlgebra::Matrix coeffPoint3D,
LinearAlgebra::Vector coeffRHS,
int  observationIndex 
)
private

Form the auxilary normal equation matrices for a measure.

N22, N12, n1, and n2 will contain the auxilary matrices when completed.

Parameters
N22The normal equation matrix for the point on the body.
N12The normal equation matrix for the camera and the target body.
n1The right hand side vector for the camera and the target body.
n2The right hand side vector for the point on the body.
coeffTargetThe matrix containing target body pertial derivatives.
coeffImageThe matrix containing camera position and orientation partial derivatives.
coeffPoint3DThe matrix containing point lat, lon, and radius partial derivatives.
coeffRHSThe vector containing weighted x,y residuals.
observationIndexThe index of the observation containing the measure that the partial derivative matrices are for.
Returns
bool If the matrices were successfully formed.
See Also
BundleAdjust::formNormalEquations

Definition at line 1076 of file BundleAdjust.cpp.

References Isis::SparseBlockColumnMatrix::insertMatrixBlock().

bool Isis::BundleAdjust::formNormalEquations ( )
private

Form the least-squares normal equations matrix via cholmod.

Each BundleControlPoint will stores its Q matrix and NIC vector once finished. The covariance matrix for each point will be stored in its adjusted surface point.

Returns
bool
See Also
BundleAdjust::formMeasureNormals
BundleAdjust::formPointNormals
BundleAdjust::formWeightedNormals

Definition at line 949 of file BundleAdjust.cpp.

References Isis::SparseBlockColumnMatrix::wipe().

bool Isis::BundleAdjust::formPointNormals ( boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > &  N22,
SparseBlockColumnMatrix N12,
LinearAlgebra::Vector n2,
LinearAlgebra::Vector nj,
BundleControlPointQsp point 
)
private

Compute the Q matrix and NIC vector for a control point.

The inputs N22, N12, and n2 come from calling formMeasureNormals() with the control point's measures. The Q matrix and NIC vector are stored in the BundleControlPoint. R = N12 x Q is accumulated into m_sparseNormals.

Parameters
N22The normal equation matrix for the point on the body.
N12The normal equation matrix for the camera and the target body.
n2The right hand side vector for the point on the body.
njThe output right hand side vector.
bundleControlPointThe control point that the Q matrixs are NIC vector are being formed for.
Returns
bool If the matrices were successfully formed.
See Also
BundleAdjust::formNormalEquations

Definition at line 1219 of file BundleAdjust.cpp.

References Isis::SurfacePoint::SetSphericalMatrix(), and Isis::SparseBlockRowMatrix::zeroBlocks().

bool Isis::BundleAdjust::formWeightedNormals ( boost::numeric::ublas::compressed_vector< double > &  n1,
LinearAlgebra::Vector nj 
)
private

Apply weighting for spacecraft position, velocity, acceleration and camera angles, angular velocities, angular accelerations if so stipulated (legalese).

Parameters
n1The right hand side vector for the camera and the target body.
njThe right hand side vector
Returns
bool If the weights were successfully applied.
See Also
BundleAdjust::formNormalEquations

Definition at line 1292 of file BundleAdjust.cpp.

bool Isis::BundleAdjust::freeCHOLMODLibraryVariables ( )
private

Free CHOLMOD library variables.

Frees m_cholmodTriplet, m_cholmodNormal, and m_L. Calls cholmod_finish when complete.

Returns
bool If the CHOLMOD library successfully cleaned up.

Definition at line 590 of file BundleAdjust.cpp.

void Isis::BundleAdjust::init ( Progress progress = 0)
private

Initialize all solution parameters.

This method is called by constructors to

  • initialize member variables
  • set up the control net
  • get the cameras set up for all images
  • clear JigsawRejected flags
  • create a new BundleImages and add to BundleObservation
  • set up vector of BundleControlPoints
  • set parent observation for each BundleMeasure
  • use BundleSettings to set more parameters
  • set up matrix initializations
  • initialize cholomod library variables
Parameters
progressA pointer to the progress of creating the cameras.
Exceptions
IException::Programmer"In BundleAdjust::init(): image is null."
IException::Programmer"In BundleAdjust::init(): observation is null."
History:

2011-08-14 Debbie A. Cook - Opt out of network validation for deltack network in order to allow a single measure on a point

2016-10-13 Ian Humphrey - Removed verification of held images in the from list and counting of the number of held images. References #4293.

Todo:

remove printf statements

answer comments with questions, TODO, ???, and !!!

Definition at line 329 of file BundleAdjust.cpp.

References _FILEINFO_, Isis::Camera::Camera(), and Isis::Spice::radii().

bool Isis::BundleAdjust::initializeCHOLMODLibraryVariables ( )
private

Initializations for CHOLMOD sparse matrix package.

Calls cholmod_start, sets m_cholmodCommon options, and resizes m_sparseNormals.

Returns
bool If the CHOLMOD library variables were successfully initialized.

Definition at line 553 of file BundleAdjust.cpp.

References Isis::cholmodErrorHandler().

bool Isis::BundleAdjust::invert3x3 ( boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > &  m)
private

Dedicated quick inverse of 3x3 matrix.

Parameters
mThe 3x3 matrix to invert. Overwritten with the inverse.
Returns
bool If the matrix was inverted. False usually means the matrix is not invertible.
See Also
BundleAdjust::formPointNormals

Move to LinearAlgebra

Definition at line 1746 of file BundleAdjust.cpp.

bool Isis::BundleAdjust::isConverged ( )
slot

Returns if the BundleAdjust converged.

Returns
bool If the BundleAdjust converged.

Definition at line 2991 of file BundleAdjust.cpp.

double Isis::BundleAdjust::iteration ( ) const
slot

Returns what iteration the BundleAdjust is currently on.

Returns
double The current iteration number.

Definition at line 2889 of file BundleAdjust.cpp.

void Isis::BundleAdjust::iterationSummary ( )
private

Creates an iteration summary and an iteration group for the solution summary.

History:
2016-10-18 Ian Humphrey - Always output Rejection_Measures keyword regardless of outlier rejection so we can match ISIS jigsaw output. Fixes #4461.

Definition at line 2926 of file BundleAdjust.cpp.

References Isis::toString().

QString Isis::BundleAdjust::iterationSummaryGroup ( ) const
slot

Returns the iteration summary string.

Returns
QString the iteration summary string.
See Also
iterationSummary()

Definition at line 3003 of file BundleAdjust.cpp.

bool Isis::BundleAdjust::loadCholmodTriplet ( )
private

Load sparse normal equations matrix into CHOLMOD triplet.

Blocks from the sparse block normal matrix are loaded into a CHOLMOD triplet. Before the triplet can be used with CHOLMOD, it must be converted to a CHOLMOD sparse matrix via cholmod_triplet_to_sparse.

Returns
bool If the triplet was successfully formed.
See Also
BundleAdjust::solveSystem

Definition at line 1592 of file BundleAdjust.cpp.

int Isis::BundleAdjust::numberOfImages ( ) const
slot

Returns the number of images.

Returns
int The number of images.

Definition at line 2866 of file BundleAdjust.cpp.

References Isis::SerialNumberList::size().

void Isis::BundleAdjust::outputBundleStatus ( QString  status)
slot

Slot for deltack and jigsaw to output the bundle status.

Parameters
statusThe bundle status string to output.
History:
2016-12-01 Ian Humphrey - Added s as first paramter to prevent a -Wformat-security warning during the build.

Definition at line 3017 of file BundleAdjust.cpp.

void Isis::BundleAdjust::productAB ( SparseBlockColumnMatrix N12,
SparseBlockRowMatrix Q 
)
private

Perform the matrix multiplication C = N12 x Q.

The result, C, is stored in m_sparseNormals.

Parameters
N12A sparse block matrix.
QA sparse block matrix
See Also
BundleAdjust::formPointNormals

Definition at line 1422 of file BundleAdjust.cpp.

void Isis::BundleAdjust::productAlphaAV ( double  alpha,
boost::numeric::ublas::bounded_vector< double, 3 > &  v2,
SparseBlockRowMatrix Q,
LinearAlgebra::Vector v1 
)
private

Perform the matrix multiplication v2 = alpha ( Q x v1 ).

Parameters
alphaA constant multiplier.
v2The output vector.
QA sparse block matrix.
v1A vector.

Definition at line 1362 of file BundleAdjust.cpp.

bool Isis::BundleAdjust::productATransB ( boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > &  N22,
SparseBlockColumnMatrix N12,
SparseBlockRowMatrix Q 
)
private

Perform the matrix multiplication Q = N22 x N12(transpose)

Parameters
N22A symmetric matrix
N12A sparse block matrix
QThe output sparse block matrix
See Also
BundleAdjust::formPointNormals

Definition at line 1392 of file BundleAdjust.cpp.

References Isis::SparseBlockRowMatrix::insertMatrixBlock().

SerialNumberList * Isis::BundleAdjust::serialNumberList ( )
slot

Returns a pointer to the serial number list.

Returns
SerialNumberList* A pointer to the serial number list.

Definition at line 2856 of file BundleAdjust.cpp.

bool Isis::BundleAdjust::solveCholesky ( )
slot

Compute the least squares bundle adjustment solution using Cholesky decomposition.

Returns
bool If the solution was successfully computed.
History:

2016-10-25 Ian Humphrey - Spacing and precision for Sigma0 and Elapsed Time match ISIS production's jigsaw std output. References #4463."

2016-10-28 Ian Humphrey - Updated spacing for Error Propagation Complete message. References #4463."

2016-11-16 Ian Humphrey - Modified catch block to throw the caught exception, so a message box will appear to the user when running jigsaw in GUI mode. Fixes #4483.

Definition at line 640 of file BundleAdjust.cpp.

References _FILEINFO_, Isis::IException::errorType(), Isis::SurfacePoint::GetLatitude(), Isis::SurfacePoint::GetLongitude(), and Isis::SurfacePoint::ResetLocalRadius().

BundleSolutionInfo Isis::BundleAdjust::solveCholeskyBR ( )

Compute the least squares bundle adjustment solution using Cholesky decomposition.

Returns
BundleSolutionInfo A container with settings and results from the adjustment.
See Also
BundleAdjust::solveCholesky

make solveCholesky return a BundleSolutionInfo object and delete this placeholder ???

Definition at line 611 of file BundleAdjust.cpp.

bool Isis::BundleAdjust::solveSystem ( )
private

Compute the solution to the normal equations using the CHOLMOD library.

Returns
bool If the solution was successfully computed.
Exceptions
IException::Programmer"CHOLMOD: Failed to load Triplet matrix"
See Also
BundleAdjust::solveCholesky

Definition at line 1521 of file BundleAdjust.cpp.

References _FILEINFO_, and Isis::toString().

Table Isis::BundleAdjust::spVector ( int  i)
slot

Return a table spacecraft vector for the ith cube in the cube list given to the constructor.

Parameters
iThe index of the cube
Returns
Table The InstrumentPosition table for the cube.

Definition at line 2913 of file BundleAdjust.cpp.

bool Isis::BundleAdjust::validateNetwork ( )
private

control network validation - on the very real chance that the net has not been checked before running the bundle

checks implemented for ... (1) images with 0 or 1 measures

Returns
bool If the control network is valid.
Exceptions
IException::User"Images with one or less measures:"
History:

2011-08-04 Debbie A. Cook - Changed error message to indicate it fails with one measure as well as no measures.

2016-09-22 Ian Humphrey - Replaced statusUpdate signal emits with direct calls to outputBundleStats() so the validation messages are printed to stdout. References #4313.

Definition at line 515 of file BundleAdjust.cpp.

References _FILEINFO_, and Isis::toString().

bool Isis::BundleAdjust::wrapUp ( )
private

Compute the residuals for each adjusted point and store adjustment results in m_bundleResults.

Returns
bool If the wrap up was successful.

Definition at line 2310 of file BundleAdjust.cpp.

Member Data Documentation

bool Isis::BundleAdjust::m_abort
private

If the bundle should abort.

Definition at line 416 of file BundleAdjust.h.

Distance Isis::BundleAdjust::m_bodyRadii[3]
private

!< Contains information about the target body.

Triaxial body radii in meters.

Definition at line 415 of file BundleAdjust.h.

BundleObservationVector Isis::BundleAdjust::m_bundleObservations
private

!< Vector of control points.

Contains only non-ignored control points from the control net.

Definition at line 409 of file BundleAdjust.h.

BundleResults Isis::BundleAdjust::m_bundleResults
private

 Stores the results of the

< bundle adjust.

Definition at line 398 of file BundleAdjust.h.

BundleSettingsQsp Isis::BundleAdjust::m_bundleSettings
private

Contains the solve settings.

Definition at line 397 of file BundleAdjust.h.

cholmod_sparse* Isis::BundleAdjust::m_cholmodNormal
private

!< The CHOLMOD triplet representation of the sparse normal equations matrix.

Created from m_sparseNormals and then used to create m_cholmodNormal.

Definition at line 459 of file BundleAdjust.h.

cholmod_triplet* Isis::BundleAdjust::m_cholmodTriplet
private

!< The sparse block normal equations matrix.

Used to populate m_cholmodTriplet and for error propagation.

Definition at line 453 of file BundleAdjust.h.

bool Isis::BundleAdjust::m_cleanUp
private

!< If the iteration summaries should be output to the log file.

Definition at line 422 of file BundleAdjust.h.

QString Isis::BundleAdjust::m_cnetFileName
private

The control net filename.

Definition at line 404 of file BundleAdjust.h.

ControlNetQsp Isis::BundleAdjust::m_controlNet
private

Output control net.

Definition at line 403 of file BundleAdjust.h.

LinearAlgebra::Vector Isis::BundleAdjust::m_imageSolution
private

!< The lower triangular L matrix from Cholesky decomposition.

Created from m_cholmodNormal by cholmod_factorize.

Definition at line 468 of file BundleAdjust.h.

int Isis::BundleAdjust::m_iteration
private

The current iteration.

Definition at line 426 of file BundleAdjust.h.

cholmod_factor* Isis::BundleAdjust::m_L
private

!< The CHOLMOD sparse normal equations matrix used by cholmod_factorize to solve the system.

Created from m_cholmodTriplet.

Definition at line 464 of file BundleAdjust.h.

double Isis::BundleAdjust::m_metersToRadians
private

!< The body specific radians to meters conversion factor.

Definition at line 430 of file BundleAdjust.h.

boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper, boost::numeric::ublas::column_major > Isis::BundleAdjust::m_normalInverse
private

!< The body specific meters to radians conversion factor.

Inverse of the normal equations matrix. Set by cholmodInverse.

Definition at line 443 of file BundleAdjust.h.

int Isis::BundleAdjust::m_numberOfImagePartials
private

number of image-related partials.

Definition at line 427 of file BundleAdjust.h.

bool Isis::BundleAdjust::m_printSummary
private

!< Summary of the most recently completed iteration.

Definition at line 419 of file BundleAdjust.h.

int Isis::BundleAdjust::m_rank
private

!< If the serial number lists need to be deleted by the destructor.

The rank of the system.

Definition at line 425 of file BundleAdjust.h.

LinearAlgebra::Vector Isis::BundleAdjust::m_RHS
private

!< Contains object parameters, statistics, and workspace used by the CHOLMOD library.

Definition at line 447 of file BundleAdjust.h.

SerialNumberList* Isis::BundleAdjust::m_serialNumberList
private

!< Vector of observations.

Each observation contains one or more images. List of image serial numbers.

Definition at line 412 of file BundleAdjust.h.

SparseBlockMatrix Isis::BundleAdjust::m_sparseNormals
private

!< The right hand side of the normal equations.

Definition at line 449 of file BundleAdjust.h.

Statistics Isis::BundleAdjust::m_xResiduals
private

x residual statistics.

Definition at line 400 of file BundleAdjust.h.

Statistics Isis::BundleAdjust::m_xyResiduals
private

xy residual statistics.

Definition at line 402 of file BundleAdjust.h.

Statistics Isis::BundleAdjust::m_yResiduals
private

y residual statistics.

Definition at line 401 of file BundleAdjust.h.


The documentation for this class was generated from the following files:

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