Loading isis/src/control/objs/BundleAdjust/BundleAdjust.cpp +24 −9 Original line number Diff line number Diff line Loading @@ -360,7 +360,7 @@ namespace Isis { * @todo answer comments with questions, TODO, ???, and !!! */ void BundleAdjust::init(Progress *progress) { emit(statusUpdate("Initialization")); m_previousNumberImagePartials = 0; // initialize Loading Loading @@ -710,6 +710,7 @@ namespace Isis { * mode. Fixes #4483. */ bool BundleAdjust::solveCholesky() { emit(statusBarUpdate("Solving")); try { // throw error if a frame camera is included AND Loading Loading @@ -766,7 +767,7 @@ namespace Isis { for (;;) { emit iterationUpdate(m_iteration, m_bundleResults.sigma0()); emit iterationUpdate(m_iteration); // testing if (m_abort) { Loading Loading @@ -870,7 +871,7 @@ namespace Isis { .arg(m_bundleResults.numberUnknownParameters())); emit statusUpdate(QString("Degrees of Freedom: %1") .arg(m_bundleResults.degreesOfFreedom())); emit iterationUpdate(m_iteration, m_bundleResults.sigma0()); emit iterationUpdate(m_iteration); // check for convergence if (m_bundleSettings->convergenceCriteria() == BundleSettings::Sigma0) { Loading @@ -896,6 +897,7 @@ namespace Isis { else { // otherwise iterations are complete m_bundleResults.setConverged(true); emit statusUpdate("Bundle has converged\n"); emit statusBarUpdate("Converged"); break; } } Loading @@ -915,6 +917,7 @@ namespace Isis { if ( numConvergedParams == numImgParams ) { m_bundleResults.setConverged(true); emit statusUpdate("Bundle has converged"); emit statusBarUpdate("Converged"); break; } } Loading @@ -931,6 +934,7 @@ namespace Isis { // check for maximum iterations if (m_iteration >= m_bundleSettings->convergenceCriteriaMaximumIterations()) { emit(statusBarUpdate("Max Iterations Reached")); break; } Loading Loading @@ -986,6 +990,7 @@ namespace Isis { catch (IException &e) { m_bundleResults.setConverged(false); emit statusUpdate("\n aborting..."); emit statusBarUpdate("Failed to Converge"); emit finished(); QString msg = "Could not solve bundle adjust."; throw IException(e, e.errorType(), msg, _FILEINFO_); Loading Loading @@ -1020,6 +1025,7 @@ namespace Isis { * @see BundleAdjust::formWeightedNormals */ bool BundleAdjust::formNormalEquations() { emit(statusBarUpdate("Forming Normal Equations")); bool status = false; m_bundleResults.setNumberObservations(0);// ??? Loading Loading @@ -1065,7 +1071,7 @@ namespace Isis { printf("\n"); for (int i = 0; i < num3DPoints; i++) { emit(pointUpdate(i+1)); BundleControlPointQsp point = m_bundleControlPoints.at(i); if (point->isRejected()) { Loading Loading @@ -2122,7 +2128,7 @@ namespace Isis { * apply parameter corrections for solution. */ void BundleAdjust::applyParameterCorrections() { emit(statusBarUpdate("Updating Parameters")); int t = 0; // TODO - update target body parameters if in solution Loading Loading @@ -2257,6 +2263,7 @@ namespace Isis { * image sample and line residuals. */ double BundleAdjust::computeResiduals() { emit(statusBarUpdate("Computing Residuals")); double vtpv = 0.0; double vtpvControl = 0.0; double vtpvImage = 0.0; Loading Loading @@ -2640,7 +2647,7 @@ namespace Isis { * Blocking and Filling point covariance messages. References #4463. */ bool BundleAdjust::errorPropagation() { emit(statusBarUpdate("Error Propagation")); // free unneeded memory cholmod_free_triplet(&m_cholmodTriplet, &m_cholmodCommon); cholmod_free_sparse(&m_cholmodNormal, &m_cholmodCommon); Loading Loading @@ -2786,7 +2793,7 @@ namespace Isis { // now loop over all object points to sum contributions into 3x3 point covariance matrix int pointIndex = 0; for (j = 0; j < numObjectPoints; j++) { emit(pointUpdate(j+1)); BundleControlPointQsp point = m_bundleControlPoints.at(pointIndex); if ( point->isRejected() ) { continue; Loading @@ -2796,8 +2803,6 @@ namespace Isis { if (j%100 == 0) { printf("\rError Propagation: Inverse Block %8d of %8d; Point %8d of %8d", i+1, numBlockColumns, j+1, numObjectPoints); emit iterationUpdate(i+1, j+1); } // get corresponding Q matrix Loading Loading @@ -3086,6 +3091,16 @@ namespace Isis { } /** * Returns if the BundleAdjust has been aborted. * * @return @b bool If the BundleAdjust converged. */ bool BundleAdjust::isAborted() { return m_abort; } /** * Returns the iteration summary string. * Loading isis/src/control/objs/BundleAdjust/BundleAdjust.h +4 −1 Original line number Diff line number Diff line Loading @@ -317,6 +317,7 @@ namespace Isis { BundleSolutionInfo solveCholeskyBR(); QList<ImageList *> imageLists(); bool isAborted(); public slots: bool solveCholesky(); Loading @@ -338,7 +339,9 @@ namespace Isis { signals: void statusUpdate(QString); void error(QString); void iterationUpdate(int, double); void iterationUpdate(int); void pointUpdate(int); void statusBarUpdate(QString); void resultsReady(BundleSolutionInfo *bundleSolveInformation); void finished(); Loading isis/src/qisis/apps/ipce/IpceMainWindow.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -215,10 +215,12 @@ namespace Isis { * @param[in] newWidget (QWidget *) */ void IpceMainWindow::addView(QWidget *newWidget) { if ( qobject_cast<SensorInfoWidget *>(newWidget) || if (qobject_cast<JigsawRunWidget *>(newWidget)) { splitDockWidget(m_projectDock, (QDockWidget*)newWidget, Qt::Vertical); } else if ( qobject_cast<SensorInfoWidget *>(newWidget) || qobject_cast<TargetInfoWidget *>(newWidget) || qobject_cast<TemplateEditorWidget *>(newWidget)|| qobject_cast<JigsawRunWidget *>(newWidget)) { qobject_cast<TemplateEditorWidget *>(newWidget)) { QDockWidget *dock = new QDockWidget( newWidget->windowTitle() ); dock->setAttribute(Qt::WA_DeleteOnClose, true); dock->setWidget(newWidget); Loading isis/src/qisis/objs/Directory/JigsawWorkOrder.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -142,7 +142,6 @@ namespace Isis { */ void JigsawWorkOrder::execute() { JigsawRunWidget *runDialog = project()->directory()->addJigsawRunWidget(); if (!runDialog) { QString msg = "Unable to open Jigsaw Run Widget"; throw IException(IException::Programmer, msg, _FILEINFO_); Loading isis/src/qisis/objs/JigsawRunWidget/JigsawRunWidget.cpp +121 −29 Original line number Diff line number Diff line #include "JigsawRunWidget.h" #include <QtConcurrent> #include <QCloseEvent> #include <QDebug> #include <QDir> #include <QFuture> Loading Loading @@ -37,6 +38,7 @@ namespace Isis { JigsawRunWidget::JigsawRunWidget(Project *project, QWidget *parent) : m_ui(new Ui::JigsawRunWidget) { m_project = project; m_selectedControl = NULL; m_bundleThread = NULL; init(); } Loading @@ -63,6 +65,7 @@ namespace Isis { m_selectedControl = selectedControl; m_selectedControlName = FileName(selectedControl->fileName()).name(); m_outputControlName = outputControlFileName; m_bundleThread = NULL; init(); } Loading Loading @@ -92,8 +95,8 @@ namespace Isis { m_accept->setToolTip(tr("Accept the bundle results and save them to the project.")); m_reject->setToolTip(tr("Reject and discard the bundle results. This resets the widget.")); m_ui->buttonBox->addButton(m_accept, QDialogButtonBox::ActionRole); m_ui->buttonBox->addButton(m_reject, QDialogButtonBox::ActionRole); // m_ui->buttonBox->addButton(m_accept, QDialogButtonBox::ActionRole); // m_ui->buttonBox->addButton(m_reject, QDialogButtonBox::ActionRole); // Accept will handle saving the results. connect(m_accept, SIGNAL(clicked(bool)), this, SLOT(acceptBundleResults())); Loading @@ -110,11 +113,6 @@ namespace Isis { m_ui->useLastSettings->setEnabled(false); } m_ui->iterationLcdNumber->setDigitCount(3); m_ui->sigma0LcdNumber->setMode(QLCDNumber::Dec); m_ui->sigma0LcdNumber->setDigitCount(5); QString lastSettingsToolTip("Use the settings from the most recently accepted bundle adjust."); QString lastSettingsWhat("When checked, the settings from the most recently accepted bundle " "adjust (i.e. the most recent bundle results in the project) will be " Loading @@ -123,6 +121,7 @@ namespace Isis { m_ui->useLastSettings->setWhatsThis(lastSettingsWhat); // setWindowFlags(Qt::WindowStaysOnTopHint); } Loading @@ -132,17 +131,21 @@ namespace Isis { JigsawRunWidget::~JigsawRunWidget() { if (m_bundleSolutionInfo) { delete m_bundleSolutionInfo; m_bundleSolutionInfo = NULL; } if (m_bundleAdjust) { delete m_bundleAdjust; m_bundleAdjust = NULL; m_bundleAdjust->deleteLater(); // m_bundleAdjust = NULL; } if (m_bundleThread) { m_bundleThread->quit(); m_bundleThread = NULL; } if (m_ui) { delete m_ui; } m_bundleSolutionInfo = NULL; m_ui = NULL; } } void JigsawRunWidget::on_JigsawSetupButton_pressed() { Loading Loading @@ -211,7 +214,7 @@ namespace Isis { // Clear the dialog displays. clearDialog(); QThread *bundleThread = new QThread; m_bundleThread = new QThread; // Make sure to clean up any previously run bundle adjusts. if (m_bundleAdjust) { Loading @@ -222,7 +225,7 @@ namespace Isis { m_bundleAdjust = new BundleAdjust(m_bundleSettings, *m_selectedControl, m_project->images(), false); m_bundleAdjust->moveToThread(bundleThread); m_bundleAdjust->moveToThread(m_bundleThread); // Track the status updates bundle adjust gives and update the dialog. connect( m_bundleAdjust, SIGNAL( statusUpdate(QString) ), Loading @@ -233,11 +236,17 @@ namespace Isis { this, SLOT( errorString(QString) ) ); // Update the iteration dialog element when the bundle updates its iteration count. connect( m_bundleAdjust, SIGNAL( iterationUpdate(int, double) ), this, SLOT( updateIterationSigma0(int, double) ) ); connect( m_bundleAdjust, SIGNAL( iterationUpdate(int) ), this, SLOT( updateIteration(int) ) ); connect( m_bundleAdjust, SIGNAL( pointUpdate(int) ), this, SLOT( updatePoint(int) ) ); connect( m_bundleAdjust, SIGNAL( statusBarUpdate(QString) ), this, SLOT( updateStatus(QString) ) ); // When we start the bundle thread, run the bundle adjustment. connect( bundleThread, SIGNAL( started() ), connect( m_bundleThread, SIGNAL( started() ), m_bundleAdjust, SLOT( solveCholesky() ) ); // When the bundle adjust says results are ready, we can allow the dialog to update the Loading @@ -246,19 +255,23 @@ namespace Isis { this, SLOT( bundleFinished(BundleSolutionInfo *) ) ); // Schedule the bundle thread for deletion when it finishes. connect( bundleThread, SIGNAL( finished() ), bundleThread, SLOT( deleteLater() ) ); connect( m_bundleThread, SIGNAL( finished() ), m_bundleThread, SLOT( deleteLater() ) ); // ken testing // Notify the dialog that the bundle thread is finished, and update the gui elements. connect( bundleThread, SIGNAL( finished() ), connect( m_bundleThread, SIGNAL( finished() ), this, SLOT( notifyThreadFinished() ) ); // Tell the thread to quit (stop) when the bundle adjust finishes (successfully or not) connect( m_bundleAdjust, SIGNAL( finished() ), bundleThread, SLOT( quit() ) ); m_bundleThread, SLOT( quit() ) ); bundleThread->start(); m_ui->imagesLcdNumber->display(m_bundleAdjust->numberOfImages()); m_ui->pointsLcdNumber->display(m_bundleAdjust->controlNet()->GetNumPoints()); m_ui->measuresLcdNumber->display(m_bundleAdjust->controlNet()->GetNumMeasures()); m_bundleThread->start(); // change "Run" button text to "Abort" (or maybe pause) m_bRunning = true; Loading @@ -267,9 +280,9 @@ namespace Isis { } else { // Make sure to abort the bundle if it is currently running. m_bundleAdjust->abortBundle(); m_bRunning = false; m_ui->JigsawRunButton->setText("&Aborting..."); m_ui->statusOutputLabel->setText("Aborting..."); m_bundleAdjust->abortBundle(); update(); } } Loading Loading @@ -501,9 +514,19 @@ namespace Isis { * the state of the buttons. */ void JigsawRunWidget::clearDialog() { m_ui->iterationLcdNumber->display(0); m_ui->sigma0LcdNumber->display(0); m_ui->statusUpdatesLabel->clear(); m_ui->iterationLcdNumber->display(0); m_ui->pointLcdNumber->display(0); m_ui->imagesLcdNumber->display(0); m_ui->pointsLcdNumber->display(0); m_ui->measuresLcdNumber->display(0); m_ui->rmsAdjustedPointSigmasGroupBox->setEnabled(false); m_ui->latitudeLcdNumber->display(0); m_ui->longitudeLcdNumber->display(0); m_ui->radiusLcdNumber->display(0); updateScrollBar(); } Loading Loading @@ -569,10 +592,30 @@ namespace Isis { * * @param error Error status of bundle. */ void JigsawRunWidget::updateIterationSigma0(int iteration, double sigma0) { void JigsawRunWidget::updateIteration(int iteration) { m_ui->iterationLcdNumber->display(iteration); m_ui->sigma0LcdNumber->display(sigma0); update(); } /** * Update the label or text edit area with the error message by appending to list and refreshing. * * @param error Error status of bundle. */ void JigsawRunWidget::updatePoint(int point) { m_ui->pointLcdNumber->display(point); update(); } /** * Update the label or text edit area with the error message by appending to list and refreshing. * * @param error Error status of bundle. */ void JigsawRunWidget::updateStatus(QString status) { m_ui->statusOutputLabel->setText(status); update(); } Loading @@ -590,10 +633,35 @@ namespace Isis { // set Run button text back to "Run" m_ui->JigsawRunButton->setText("&Run"); if (m_bundleAdjust->isAborted()) { m_ui->statusOutputLabel->setText("Aborted"); } if (m_bundleSettings->errorPropagation()) { m_ui->latitudeLcdNumber->display( m_bundleSolutionInfo->bundleResults().sigmaLatitudeStatisticsRms()); m_ui->longitudeLcdNumber->display( m_bundleSolutionInfo->bundleResults().sigmaLongitudeStatisticsRms()); if (m_bundleSettings->solveRadius()) { m_ui->radiusLcdNumber->display( m_bundleSolutionInfo->bundleResults().sigmaRadiusStatisticsRms()); } else { m_ui->radiusLcdNumber->setEnabled(false); } } else { m_ui->latitudeLcdNumber->setEnabled(false); m_ui->longitudeLcdNumber->setEnabled(false); m_ui->radiusLcdNumber->setEnabled(false); } // Since this slot is invoked when the thread finishes, the bundle adjustment is no longer // running. m_bRunning = false; updateScrollBar(); update(); Loading @@ -618,6 +686,30 @@ namespace Isis { m_accept->setEnabled(true); m_reject->setEnabled(true); } void JigsawRunWidget::closeEvent(QCloseEvent *event) { if( m_bRunning ) { QMessageBox::StandardButton resBtn = QMessageBox::question(this, "WARNING", tr("You are about to abort the bundle adjustment. Are you sure?\n"), QMessageBox::No | QMessageBox::Yes); if (resBtn != QMessageBox::Yes) { event->ignore(); return; } else if (m_bRunning) { // check m_bRunning again just in case the bundle has finished // We need to wait for the bundle adjust thread to finish before deleting the // JigsawRunWidget so that we dont close the widget before the thread is finished connect(m_bundleThread, SIGNAL(finished()), this, SLOT(deleteLater())); m_bundleAdjust->abortBundle(); return; } } event->accept(); } } /** Loading @@ -626,7 +718,7 @@ namespace Isis { * 2015-08-24 Notes added: Ken Edmundson * * If a bundle is NOT currently running, we ... * 1) create a QThread object (bundleThread) * 1) create a QThread object (m_bundleThread) * 2) create a new pointer to a BundleAdjust object (m_bundleAdjust) * 3) move the BundleAdjust object to the QThread * 4) connect signals & slots to ... Loading Loading
isis/src/control/objs/BundleAdjust/BundleAdjust.cpp +24 −9 Original line number Diff line number Diff line Loading @@ -360,7 +360,7 @@ namespace Isis { * @todo answer comments with questions, TODO, ???, and !!! */ void BundleAdjust::init(Progress *progress) { emit(statusUpdate("Initialization")); m_previousNumberImagePartials = 0; // initialize Loading Loading @@ -710,6 +710,7 @@ namespace Isis { * mode. Fixes #4483. */ bool BundleAdjust::solveCholesky() { emit(statusBarUpdate("Solving")); try { // throw error if a frame camera is included AND Loading Loading @@ -766,7 +767,7 @@ namespace Isis { for (;;) { emit iterationUpdate(m_iteration, m_bundleResults.sigma0()); emit iterationUpdate(m_iteration); // testing if (m_abort) { Loading Loading @@ -870,7 +871,7 @@ namespace Isis { .arg(m_bundleResults.numberUnknownParameters())); emit statusUpdate(QString("Degrees of Freedom: %1") .arg(m_bundleResults.degreesOfFreedom())); emit iterationUpdate(m_iteration, m_bundleResults.sigma0()); emit iterationUpdate(m_iteration); // check for convergence if (m_bundleSettings->convergenceCriteria() == BundleSettings::Sigma0) { Loading @@ -896,6 +897,7 @@ namespace Isis { else { // otherwise iterations are complete m_bundleResults.setConverged(true); emit statusUpdate("Bundle has converged\n"); emit statusBarUpdate("Converged"); break; } } Loading @@ -915,6 +917,7 @@ namespace Isis { if ( numConvergedParams == numImgParams ) { m_bundleResults.setConverged(true); emit statusUpdate("Bundle has converged"); emit statusBarUpdate("Converged"); break; } } Loading @@ -931,6 +934,7 @@ namespace Isis { // check for maximum iterations if (m_iteration >= m_bundleSettings->convergenceCriteriaMaximumIterations()) { emit(statusBarUpdate("Max Iterations Reached")); break; } Loading Loading @@ -986,6 +990,7 @@ namespace Isis { catch (IException &e) { m_bundleResults.setConverged(false); emit statusUpdate("\n aborting..."); emit statusBarUpdate("Failed to Converge"); emit finished(); QString msg = "Could not solve bundle adjust."; throw IException(e, e.errorType(), msg, _FILEINFO_); Loading Loading @@ -1020,6 +1025,7 @@ namespace Isis { * @see BundleAdjust::formWeightedNormals */ bool BundleAdjust::formNormalEquations() { emit(statusBarUpdate("Forming Normal Equations")); bool status = false; m_bundleResults.setNumberObservations(0);// ??? Loading Loading @@ -1065,7 +1071,7 @@ namespace Isis { printf("\n"); for (int i = 0; i < num3DPoints; i++) { emit(pointUpdate(i+1)); BundleControlPointQsp point = m_bundleControlPoints.at(i); if (point->isRejected()) { Loading Loading @@ -2122,7 +2128,7 @@ namespace Isis { * apply parameter corrections for solution. */ void BundleAdjust::applyParameterCorrections() { emit(statusBarUpdate("Updating Parameters")); int t = 0; // TODO - update target body parameters if in solution Loading Loading @@ -2257,6 +2263,7 @@ namespace Isis { * image sample and line residuals. */ double BundleAdjust::computeResiduals() { emit(statusBarUpdate("Computing Residuals")); double vtpv = 0.0; double vtpvControl = 0.0; double vtpvImage = 0.0; Loading Loading @@ -2640,7 +2647,7 @@ namespace Isis { * Blocking and Filling point covariance messages. References #4463. */ bool BundleAdjust::errorPropagation() { emit(statusBarUpdate("Error Propagation")); // free unneeded memory cholmod_free_triplet(&m_cholmodTriplet, &m_cholmodCommon); cholmod_free_sparse(&m_cholmodNormal, &m_cholmodCommon); Loading Loading @@ -2786,7 +2793,7 @@ namespace Isis { // now loop over all object points to sum contributions into 3x3 point covariance matrix int pointIndex = 0; for (j = 0; j < numObjectPoints; j++) { emit(pointUpdate(j+1)); BundleControlPointQsp point = m_bundleControlPoints.at(pointIndex); if ( point->isRejected() ) { continue; Loading @@ -2796,8 +2803,6 @@ namespace Isis { if (j%100 == 0) { printf("\rError Propagation: Inverse Block %8d of %8d; Point %8d of %8d", i+1, numBlockColumns, j+1, numObjectPoints); emit iterationUpdate(i+1, j+1); } // get corresponding Q matrix Loading Loading @@ -3086,6 +3091,16 @@ namespace Isis { } /** * Returns if the BundleAdjust has been aborted. * * @return @b bool If the BundleAdjust converged. */ bool BundleAdjust::isAborted() { return m_abort; } /** * Returns the iteration summary string. * Loading
isis/src/control/objs/BundleAdjust/BundleAdjust.h +4 −1 Original line number Diff line number Diff line Loading @@ -317,6 +317,7 @@ namespace Isis { BundleSolutionInfo solveCholeskyBR(); QList<ImageList *> imageLists(); bool isAborted(); public slots: bool solveCholesky(); Loading @@ -338,7 +339,9 @@ namespace Isis { signals: void statusUpdate(QString); void error(QString); void iterationUpdate(int, double); void iterationUpdate(int); void pointUpdate(int); void statusBarUpdate(QString); void resultsReady(BundleSolutionInfo *bundleSolveInformation); void finished(); Loading
isis/src/qisis/apps/ipce/IpceMainWindow.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -215,10 +215,12 @@ namespace Isis { * @param[in] newWidget (QWidget *) */ void IpceMainWindow::addView(QWidget *newWidget) { if ( qobject_cast<SensorInfoWidget *>(newWidget) || if (qobject_cast<JigsawRunWidget *>(newWidget)) { splitDockWidget(m_projectDock, (QDockWidget*)newWidget, Qt::Vertical); } else if ( qobject_cast<SensorInfoWidget *>(newWidget) || qobject_cast<TargetInfoWidget *>(newWidget) || qobject_cast<TemplateEditorWidget *>(newWidget)|| qobject_cast<JigsawRunWidget *>(newWidget)) { qobject_cast<TemplateEditorWidget *>(newWidget)) { QDockWidget *dock = new QDockWidget( newWidget->windowTitle() ); dock->setAttribute(Qt::WA_DeleteOnClose, true); dock->setWidget(newWidget); Loading
isis/src/qisis/objs/Directory/JigsawWorkOrder.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -142,7 +142,6 @@ namespace Isis { */ void JigsawWorkOrder::execute() { JigsawRunWidget *runDialog = project()->directory()->addJigsawRunWidget(); if (!runDialog) { QString msg = "Unable to open Jigsaw Run Widget"; throw IException(IException::Programmer, msg, _FILEINFO_); Loading
isis/src/qisis/objs/JigsawRunWidget/JigsawRunWidget.cpp +121 −29 Original line number Diff line number Diff line #include "JigsawRunWidget.h" #include <QtConcurrent> #include <QCloseEvent> #include <QDebug> #include <QDir> #include <QFuture> Loading Loading @@ -37,6 +38,7 @@ namespace Isis { JigsawRunWidget::JigsawRunWidget(Project *project, QWidget *parent) : m_ui(new Ui::JigsawRunWidget) { m_project = project; m_selectedControl = NULL; m_bundleThread = NULL; init(); } Loading @@ -63,6 +65,7 @@ namespace Isis { m_selectedControl = selectedControl; m_selectedControlName = FileName(selectedControl->fileName()).name(); m_outputControlName = outputControlFileName; m_bundleThread = NULL; init(); } Loading Loading @@ -92,8 +95,8 @@ namespace Isis { m_accept->setToolTip(tr("Accept the bundle results and save them to the project.")); m_reject->setToolTip(tr("Reject and discard the bundle results. This resets the widget.")); m_ui->buttonBox->addButton(m_accept, QDialogButtonBox::ActionRole); m_ui->buttonBox->addButton(m_reject, QDialogButtonBox::ActionRole); // m_ui->buttonBox->addButton(m_accept, QDialogButtonBox::ActionRole); // m_ui->buttonBox->addButton(m_reject, QDialogButtonBox::ActionRole); // Accept will handle saving the results. connect(m_accept, SIGNAL(clicked(bool)), this, SLOT(acceptBundleResults())); Loading @@ -110,11 +113,6 @@ namespace Isis { m_ui->useLastSettings->setEnabled(false); } m_ui->iterationLcdNumber->setDigitCount(3); m_ui->sigma0LcdNumber->setMode(QLCDNumber::Dec); m_ui->sigma0LcdNumber->setDigitCount(5); QString lastSettingsToolTip("Use the settings from the most recently accepted bundle adjust."); QString lastSettingsWhat("When checked, the settings from the most recently accepted bundle " "adjust (i.e. the most recent bundle results in the project) will be " Loading @@ -123,6 +121,7 @@ namespace Isis { m_ui->useLastSettings->setWhatsThis(lastSettingsWhat); // setWindowFlags(Qt::WindowStaysOnTopHint); } Loading @@ -132,17 +131,21 @@ namespace Isis { JigsawRunWidget::~JigsawRunWidget() { if (m_bundleSolutionInfo) { delete m_bundleSolutionInfo; m_bundleSolutionInfo = NULL; } if (m_bundleAdjust) { delete m_bundleAdjust; m_bundleAdjust = NULL; m_bundleAdjust->deleteLater(); // m_bundleAdjust = NULL; } if (m_bundleThread) { m_bundleThread->quit(); m_bundleThread = NULL; } if (m_ui) { delete m_ui; } m_bundleSolutionInfo = NULL; m_ui = NULL; } } void JigsawRunWidget::on_JigsawSetupButton_pressed() { Loading Loading @@ -211,7 +214,7 @@ namespace Isis { // Clear the dialog displays. clearDialog(); QThread *bundleThread = new QThread; m_bundleThread = new QThread; // Make sure to clean up any previously run bundle adjusts. if (m_bundleAdjust) { Loading @@ -222,7 +225,7 @@ namespace Isis { m_bundleAdjust = new BundleAdjust(m_bundleSettings, *m_selectedControl, m_project->images(), false); m_bundleAdjust->moveToThread(bundleThread); m_bundleAdjust->moveToThread(m_bundleThread); // Track the status updates bundle adjust gives and update the dialog. connect( m_bundleAdjust, SIGNAL( statusUpdate(QString) ), Loading @@ -233,11 +236,17 @@ namespace Isis { this, SLOT( errorString(QString) ) ); // Update the iteration dialog element when the bundle updates its iteration count. connect( m_bundleAdjust, SIGNAL( iterationUpdate(int, double) ), this, SLOT( updateIterationSigma0(int, double) ) ); connect( m_bundleAdjust, SIGNAL( iterationUpdate(int) ), this, SLOT( updateIteration(int) ) ); connect( m_bundleAdjust, SIGNAL( pointUpdate(int) ), this, SLOT( updatePoint(int) ) ); connect( m_bundleAdjust, SIGNAL( statusBarUpdate(QString) ), this, SLOT( updateStatus(QString) ) ); // When we start the bundle thread, run the bundle adjustment. connect( bundleThread, SIGNAL( started() ), connect( m_bundleThread, SIGNAL( started() ), m_bundleAdjust, SLOT( solveCholesky() ) ); // When the bundle adjust says results are ready, we can allow the dialog to update the Loading @@ -246,19 +255,23 @@ namespace Isis { this, SLOT( bundleFinished(BundleSolutionInfo *) ) ); // Schedule the bundle thread for deletion when it finishes. connect( bundleThread, SIGNAL( finished() ), bundleThread, SLOT( deleteLater() ) ); connect( m_bundleThread, SIGNAL( finished() ), m_bundleThread, SLOT( deleteLater() ) ); // ken testing // Notify the dialog that the bundle thread is finished, and update the gui elements. connect( bundleThread, SIGNAL( finished() ), connect( m_bundleThread, SIGNAL( finished() ), this, SLOT( notifyThreadFinished() ) ); // Tell the thread to quit (stop) when the bundle adjust finishes (successfully or not) connect( m_bundleAdjust, SIGNAL( finished() ), bundleThread, SLOT( quit() ) ); m_bundleThread, SLOT( quit() ) ); bundleThread->start(); m_ui->imagesLcdNumber->display(m_bundleAdjust->numberOfImages()); m_ui->pointsLcdNumber->display(m_bundleAdjust->controlNet()->GetNumPoints()); m_ui->measuresLcdNumber->display(m_bundleAdjust->controlNet()->GetNumMeasures()); m_bundleThread->start(); // change "Run" button text to "Abort" (or maybe pause) m_bRunning = true; Loading @@ -267,9 +280,9 @@ namespace Isis { } else { // Make sure to abort the bundle if it is currently running. m_bundleAdjust->abortBundle(); m_bRunning = false; m_ui->JigsawRunButton->setText("&Aborting..."); m_ui->statusOutputLabel->setText("Aborting..."); m_bundleAdjust->abortBundle(); update(); } } Loading Loading @@ -501,9 +514,19 @@ namespace Isis { * the state of the buttons. */ void JigsawRunWidget::clearDialog() { m_ui->iterationLcdNumber->display(0); m_ui->sigma0LcdNumber->display(0); m_ui->statusUpdatesLabel->clear(); m_ui->iterationLcdNumber->display(0); m_ui->pointLcdNumber->display(0); m_ui->imagesLcdNumber->display(0); m_ui->pointsLcdNumber->display(0); m_ui->measuresLcdNumber->display(0); m_ui->rmsAdjustedPointSigmasGroupBox->setEnabled(false); m_ui->latitudeLcdNumber->display(0); m_ui->longitudeLcdNumber->display(0); m_ui->radiusLcdNumber->display(0); updateScrollBar(); } Loading Loading @@ -569,10 +592,30 @@ namespace Isis { * * @param error Error status of bundle. */ void JigsawRunWidget::updateIterationSigma0(int iteration, double sigma0) { void JigsawRunWidget::updateIteration(int iteration) { m_ui->iterationLcdNumber->display(iteration); m_ui->sigma0LcdNumber->display(sigma0); update(); } /** * Update the label or text edit area with the error message by appending to list and refreshing. * * @param error Error status of bundle. */ void JigsawRunWidget::updatePoint(int point) { m_ui->pointLcdNumber->display(point); update(); } /** * Update the label or text edit area with the error message by appending to list and refreshing. * * @param error Error status of bundle. */ void JigsawRunWidget::updateStatus(QString status) { m_ui->statusOutputLabel->setText(status); update(); } Loading @@ -590,10 +633,35 @@ namespace Isis { // set Run button text back to "Run" m_ui->JigsawRunButton->setText("&Run"); if (m_bundleAdjust->isAborted()) { m_ui->statusOutputLabel->setText("Aborted"); } if (m_bundleSettings->errorPropagation()) { m_ui->latitudeLcdNumber->display( m_bundleSolutionInfo->bundleResults().sigmaLatitudeStatisticsRms()); m_ui->longitudeLcdNumber->display( m_bundleSolutionInfo->bundleResults().sigmaLongitudeStatisticsRms()); if (m_bundleSettings->solveRadius()) { m_ui->radiusLcdNumber->display( m_bundleSolutionInfo->bundleResults().sigmaRadiusStatisticsRms()); } else { m_ui->radiusLcdNumber->setEnabled(false); } } else { m_ui->latitudeLcdNumber->setEnabled(false); m_ui->longitudeLcdNumber->setEnabled(false); m_ui->radiusLcdNumber->setEnabled(false); } // Since this slot is invoked when the thread finishes, the bundle adjustment is no longer // running. m_bRunning = false; updateScrollBar(); update(); Loading @@ -618,6 +686,30 @@ namespace Isis { m_accept->setEnabled(true); m_reject->setEnabled(true); } void JigsawRunWidget::closeEvent(QCloseEvent *event) { if( m_bRunning ) { QMessageBox::StandardButton resBtn = QMessageBox::question(this, "WARNING", tr("You are about to abort the bundle adjustment. Are you sure?\n"), QMessageBox::No | QMessageBox::Yes); if (resBtn != QMessageBox::Yes) { event->ignore(); return; } else if (m_bRunning) { // check m_bRunning again just in case the bundle has finished // We need to wait for the bundle adjust thread to finish before deleting the // JigsawRunWidget so that we dont close the widget before the thread is finished connect(m_bundleThread, SIGNAL(finished()), this, SLOT(deleteLater())); m_bundleAdjust->abortBundle(); return; } } event->accept(); } } /** Loading @@ -626,7 +718,7 @@ namespace Isis { * 2015-08-24 Notes added: Ken Edmundson * * If a bundle is NOT currently running, we ... * 1) create a QThread object (bundleThread) * 1) create a QThread object (m_bundleThread) * 2) create a new pointer to a BundleAdjust object (m_bundleAdjust) * 3) move the BundleAdjust object to the QThread * 4) connect signals & slots to ... Loading