diff --git a/src/gui/MainFrame.cpp b/src/gui/MainFrame.cpp index 9817f6873..546a74754 100644 --- a/src/gui/MainFrame.cpp +++ b/src/gui/MainFrame.cpp @@ -311,12 +311,12 @@ void MyMainFrame::DirtyVolumes( ) { sharpen_3d_panel->volumes_are_dirty = true; refine_ctf_panel->volumes_are_dirty = true; - if ( current_workflow == "Template Matching" ) { - match_template_panel->volumes_are_dirty = true; + // Always mark template matching panels as dirty, regardless of current workflow + // This ensures volumes are available when user switches to Template Matching workflow + match_template_panel->volumes_are_dirty = true; #ifdef EXPERIMENTAL - refine_template_panel->volumes_are_dirty = true; + refine_template_panel->volumes_are_dirty = true; #endif - } } void MyMainFrame::DirtyAtomicCoordinates( ) { @@ -337,11 +337,11 @@ void MyMainFrame::DirtyImageGroups( ) { findparticles_panel->group_combo_is_dirty = true; picking_results_panel->group_combo_is_dirty = true; - if ( current_workflow == "Template Matching" ) { - match_template_panel->group_combo_is_dirty = true; - match_template_results_panel->group_combo_is_dirty = true; - refine_template_panel->group_combo_is_dirty = true; - } + // Always mark template matching panels as dirty, regardless of current workflow + // This ensures image groups are available when user switches to Template Matching workflow + match_template_panel->group_combo_is_dirty = true; + match_template_results_panel->group_combo_is_dirty = true; + refine_template_panel->group_combo_is_dirty = true; } void MyMainFrame::DirtyParticlePositionGroups( ) { diff --git a/src/gui/MatchTemplatePanel.cpp b/src/gui/MatchTemplatePanel.cpp index 2d51403d0..e2efc26d4 100644 --- a/src/gui/MatchTemplatePanel.cpp +++ b/src/gui/MatchTemplatePanel.cpp @@ -404,7 +404,7 @@ void MatchTemplatePanel::OnUpdateUI(wxUpdateUIEvent& event) { ReferenceSelectPanel->Enable(true); if ( RunProfileComboBox->GetCount( ) > 0 ) { - if ( image_asset_panel->ReturnGroupSize(GroupComboBox->GetSelection( )) > 0 && run_profiles_panel->run_profile_manager.ReturnTotalJobs(RunProfileComboBox->GetSelection( )) > 0 && all_images_have_defocus_values == true ) { + if ( image_asset_panel->ReturnGroupSize(GroupComboBox->GetSelection( )) > 0 && run_profiles_panel->run_profile_manager.ReturnTotalJobs(RunProfileComboBox->GetSelection( )) > 0 && all_images_have_defocus_values == true && ReferenceSelectPanel->GetSelection( ) >= 0 ) { StartEstimationButton->Enable(true); } else @@ -559,6 +559,12 @@ void MatchTemplatePanel::SetInputsForPossibleReRun(bool set_up_to_resume_job, Te void MatchTemplatePanel::StartEstimationClick(wxCommandEvent& event) { + // Safety check: ensure a volume is selected before proceeding + if ( ReferenceSelectPanel->GetSelection( ) < 0 ) { + wxMessageBox("Please select a reference volume before starting the job.", "No Reference Volume Selected", wxOK | wxICON_ERROR); + return; + } + active_group.CopyFrom(&image_asset_panel->all_groups_list->groups[GroupComboBox->GetSelection( )]); // Check if this is a resume job. If yes, get the job id and set the active