void MainWindow::OnCommonOpenDICOMDIR(wxCommandEvent&) { wxFileDialog_Ptr dialog = construct_open_dialog(this, "Open DICOMDIR", "DICOMDIR Files|DICOMDIR"); if(dialog->ShowModal() == wxID_OK) { std::string path = wxString_to_string(dialog->GetPath()); try { check_file_exists(path); // Display a volume chooser dialog to allow the user to choose which volume to load. VolumeChooserDialog dialog(path); dialog.ShowModal(); if(dialog.volume_choice()) { load_volume(dialog.dicomdir(), *dialog.volume_choice()); } } catch(std::exception& e) { wxMessageBox(string_to_wxString(e.what()), wxT("Error"), wxOK|wxICON_ERROR|wxCENTRE, this); } } }
//#################### PRIVATE METHODS #################### void MainWindow::load_saved_volume_choice(const std::string& volumeChoiceFilename) try { check_file_exists(volumeChoiceFilename); DICOMVolumeChoice volumeChoice = VolumeChoiceFile::load(volumeChoiceFilename); load_volume(volumeChoice); } catch(std::exception& e) { wxMessageBox(string_to_wxString(e.what()), wxT("Error"), wxOK|wxICON_ERROR|wxCENTRE, this); }
void SegmentationWindow::OnUpdateMenuActionsUndo(wxUpdateUIEvent& e) { if(m_commandManager->can_undo()) { e.Enable(true); e.SetText(string_to_wxString("&Undo " + m_commandManager->undo_description() + "\tCtrl+Z")); } else { e.Enable(false); e.SetText(wxT("Cannot Undo\tCtrl+Z")); } }
//~~~~~~~~~~~~~~~~~~~~ MENUS ~~~~~~~~~~~~~~~~~~~~ void MainWindow::OnMenuHelpAbout(wxCommandEvent&) { std::ostringstream oss; oss << "MAST (the Millipede Automatic Segmentation Tool) is a program I am developing as part of " << "my computing doctorate at Oxford University, under the watchful guidance and supervision " << "of Dr Stephen Cameron and Dr Irina Voiculescu. I am extremely grateful to both of them for " << "their help and support throughout.\n" << '\n' << "MAST is the successor application to FAST, the automatic segmentation tool which I wrote " << "to accompany my centipede image processing library.\n" << '\n' << "- Stuart Golodetz, November 2009"; wxMessageBox(string_to_wxString(oss.str()), wxT("About MAST"), wxOK|wxCENTRE, this); }
wxString SegmentationWindow::make_feature_menu_item(const std::vector<Feature>& featureTypes, size_t i, bool useShortcut) { std::ostringstream oss; oss << feature_to_name(featureTypes[i]); std::string key = feature_key(featureTypes[i]); if(key != "") oss << " (&" << key << ")"; if(useShortcut) { std::string shortcut = feature_shortcut(featureTypes[i]); if(shortcut != "") oss << '\t' << shortcut; } return string_to_wxString(oss.str()); }
void SegmentationWindow::OnMenuSegmentationLoadSegmentation(wxCommandEvent&) { wxFileDialog_Ptr dialog = construct_open_dialog(this, "Load Segmentation", "Image Partition Forest Files (*.ipf)|*.ipf|All Files|*.*"); if(dialog->ShowModal() == wxID_OK) { std::string path = wxString_to_string(dialog->GetPath()); try { check_file_exists(path); PartitionModelT::VolumeIPF_Ptr volumeIPF = VolumeIPFFile::load(path); m_model->set_volume_ipf(volumeIPF); } catch(std::exception& e) { wxMessageBox(string_to_wxString(e.what()), wxT("Error"), wxOK|wxICON_ERROR|wxCENTRE, this); } } }
void HelpController::display_section(const std::string& section) { m_base->DisplaySection(string_to_wxString(section)); }