diff --git a/viewer/JFJochImageReadingWorker.cpp b/viewer/JFJochImageReadingWorker.cpp index 9e68e6dc..11fca80e 100644 --- a/viewer/JFJochImageReadingWorker.cpp +++ b/viewer/JFJochImageReadingWorker.cpp @@ -274,19 +274,16 @@ void JFJochImageReadingWorker::FindCenter(const UnitCell& calibrant, bool guess) void JFJochImageReadingWorker::UpdateSpotFindingSettings(const SpotFindingSettings &settings, const IndexingSettings &indexing, - int64_t max_spots, - bool reanalyze) { + int64_t max_spots) { QMutexLocker locker(&m); spot_finding_settings = settings; - // "local" indexing settings indexing_settings.Tolerance(indexing.GetTolerance()); indexing_settings.ViableCellMinSpots(indexing.GetViableCellMinSpots()); indexing_settings.IndexIceRings(indexing.GetIndexIceRings()); indexing_settings.UnitCellDistTolerance(indexing.GetUnitCellDistTolerance()); curr_experiment.ImportIndexingSettings(indexing_settings); curr_experiment.MaxSpotCount(max_spots); - auto_reanalyze = reanalyze; if (auto_reanalyze) { ReanalyzeImage_i(); @@ -294,6 +291,17 @@ void JFJochImageReadingWorker::UpdateSpotFindingSettings(const SpotFindingSettin } } +void JFJochImageReadingWorker::ReanalyzeImages(bool input) { + QMutexLocker locker(&m); + auto_reanalyze = input; + + if (auto_reanalyze) { + ReanalyzeImage_i(); + emit imageLoaded(current_image_ptr); + } +} + + void JFJochImageReadingWorker::UpdateAzintSettings(const AzimuthalIntegrationSettings &settings) { QMutexLocker locker(&m); azint_settings = settings; diff --git a/viewer/JFJochImageReadingWorker.h b/viewer/JFJochImageReadingWorker.h index 0c70f1bf..452f5934 100644 --- a/viewer/JFJochImageReadingWorker.h +++ b/viewer/JFJochImageReadingWorker.h @@ -104,7 +104,8 @@ public slots: void Analyze(); - void UpdateSpotFindingSettings(const SpotFindingSettings &settings, const IndexingSettings &indexing, int64_t max_spots, bool reanalyze); + void UpdateSpotFindingSettings(const SpotFindingSettings &settings, const IndexingSettings &indexing, int64_t max_spots); + void ReanalyzeImages(bool input); void UpdateAzintSettings(const AzimuthalIntegrationSettings& settings); void AddROIToUserMask(); void SubtractROIFromUserMask(); diff --git a/viewer/JFJochViewerWindow.cpp b/viewer/JFJochViewerWindow.cpp index 14ea1d6d..34d98cd5 100644 --- a/viewer/JFJochViewerWindow.cpp +++ b/viewer/JFJochViewerWindow.cpp @@ -233,6 +233,8 @@ JFJochViewerWindow::JFJochViewerWindow(QWidget *parent, bool dbus, const QString reading_worker, &JFJochImageReadingWorker::setAutoLoadMode); connect(toolBarImage, &JFJochViewerToolbarImage::imageJumpChanged, reading_worker, &JFJochImageReadingWorker::setAutoLoadJump); + connect(toolBarImage, &JFJochViewerToolbarImage::reanalyzeImages, + reading_worker, &JFJochImageReadingWorker::ReanalyzeImages); connect(side_panel, &JFJochViewerSidePanel::analyze, reading_worker, &JFJochImageReadingWorker::Analyze); diff --git a/viewer/toolbar/JFJochViewerToolbarImage.cpp b/viewer/toolbar/JFJochViewerToolbarImage.cpp index 033daf93..0ea2ade9 100644 --- a/viewer/toolbar/JFJochViewerToolbarImage.cpp +++ b/viewer/toolbar/JFJochViewerToolbarImage.cpp @@ -56,18 +56,24 @@ JFJochViewerToolbarImage::JFJochViewerToolbarImage(QWidget *parent) : QToolBar(p image_number_slider_timer->setSingleShot(true); - movie_button = new QPushButton("Movie"); + movie_button = new QPushButton("&Movie"); movie_button->setCheckable(true); movie_button->setChecked(false); addWidget(movie_button); - autoload_button = new QPushButton("Online"); + autoload_button = new QPushButton("HTTP &Sync"); autoload_button->setCheckable(true); autoload_button->setChecked(false); addWidget(autoload_button); + reanalyze_button = new QPushButton("&Reanalyze"); + reanalyze_button->setCheckable(true); + reanalyze_button->setChecked(false); + addWidget(reanalyze_button); + connect(movie_button, &QPushButton::clicked, this, &JFJochViewerToolbarImage::movieButtonPressed); connect(autoload_button, &QPushButton::clicked, this, &JFJochViewerToolbarImage::autoloadButtonPressed); + connect(reanalyze_button, &QPushButton::clicked, this, &JFJochViewerToolbarImage::reanalyzeButtonPressed); auto *stretch = new QWidget(this); stretch->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); @@ -199,6 +205,10 @@ void JFJochViewerToolbarImage::movieButtonPressed() { emit autoLoadButtonPressed(JFJochImageReadingWorker::AutoloadMode::None); } +void JFJochViewerToolbarImage::reanalyzeButtonPressed() { + emit reanalyzeImages(reanalyze_button->isChecked()); +} + void JFJochViewerToolbarImage::setAutoloadMode(JFJochImageReadingWorker::AutoloadMode input) { switch (input) { case JFJochImageReadingWorker::AutoloadMode::HTTPSync: diff --git a/viewer/toolbar/JFJochViewerToolbarImage.h b/viewer/toolbar/JFJochViewerToolbarImage.h index 7ec0b758..19e4f699 100644 --- a/viewer/toolbar/JFJochViewerToolbarImage.h +++ b/viewer/toolbar/JFJochViewerToolbarImage.h @@ -39,6 +39,7 @@ class JFJochViewerToolbarImage : public QToolBar { QPushButton *movie_button; QPushButton *autoload_button; + QPushButton *reanalyze_button; NumericComboBox *jump; @@ -47,6 +48,7 @@ signals: void loadImage(int64_t number, int summation); void autoLoadButtonPressed(JFJochImageReadingWorker::AutoloadMode mode); void imageJumpChanged(int64_t val); + void reanalyzeImages(bool input); public: explicit JFJochViewerToolbarImage(QWidget *parent = nullptr); public slots: @@ -68,6 +70,7 @@ private slots: void movieButtonPressed(); void autoloadButtonPressed(); + void reanalyzeButtonPressed(); }; #endif //JFJOCH_JFJOCHVIEWERTOOLBARIMAGE_H \ No newline at end of file diff --git a/viewer/windows/JFJochViewerProcessingWindow.cpp b/viewer/windows/JFJochViewerProcessingWindow.cpp index f1878fb4..adcc8f2e 100644 --- a/viewer/windows/JFJochViewerProcessingWindow.cpp +++ b/viewer/windows/JFJochViewerProcessingWindow.cpp @@ -79,10 +79,6 @@ JFJochViewerProcessingWindow::JFJochViewerProcessingWindow(const SpotFindingSett m_quickIntegrationCheckBox->setChecked(m_settings.quick_integration); processingLayout->addRow("", m_quickIntegrationCheckBox); - m_reanalyzeCheckBox = new QCheckBox("Reanalyze on changed settings", this); - m_reanalyzeCheckBox->setChecked(false); - processingLayout->addRow("", m_reanalyzeCheckBox); - // Indexing group auto indexingGroup = new QGroupBox("Indexing", this); auto indexingLayout = new QFormLayout(indexingGroup); @@ -228,13 +224,9 @@ JFJochViewerProcessingWindow::JFJochViewerProcessingWindow(const SpotFindingSett m_settings.ice_ring_width_Q_recipA = static_cast(val); Update(); }); - - connect(m_reanalyzeCheckBox, &QCheckBox::toggled, [this](bool checked) { - Update(); - }); } void JFJochViewerProcessingWindow::Update() { const auto max_spots = std::lround(m_maxSpotCount->value()); - emit settingsChanged(m_settings, m_indexing, max_spots, m_reanalyzeCheckBox->isChecked()); + emit settingsChanged(m_settings, m_indexing, max_spots); } diff --git a/viewer/windows/JFJochViewerProcessingWindow.h b/viewer/windows/JFJochViewerProcessingWindow.h index d007696f..eafd0e4f 100644 --- a/viewer/windows/JFJochViewerProcessingWindow.h +++ b/viewer/windows/JFJochViewerProcessingWindow.h @@ -33,7 +33,6 @@ class JFJochViewerProcessingWindow : public JFJochHelperWindow { QCheckBox *m_quickIntegrationCheckBox; QCheckBox *m_geomRefinementCheckBox; - QCheckBox *m_reanalyzeCheckBox; SliderPlusBox *m_idxTolerance; // [0.0 .. 0.5], step 0.001 SliderPlusBox *m_idxUnitCellDistTolerance; // [0.0001 .. 0.2001], step 0.0001 @@ -51,7 +50,7 @@ public: QWidget *parent = nullptr); signals: - void settingsChanged(const SpotFindingSettings &settings, const IndexingSettings &indexing, int64_t max_spots, bool reanalyze); + void settingsChanged(const SpotFindingSettings &settings, const IndexingSettings &indexing, int64_t max_spots); };