int main(int argc, char* argv[]) { IUserInterface *userInterface; try{ if(argc > 1){ userInterface = new CommandArgs(argc,argv); //ran thru cmd }else{ userInterface = new CommandLineUI(); } exec(userInterface); }catch(Exception *vl_Exception) { vl_Exception->display(); delete vl_Exception; } catch(...) { Exception *unhandledException = new Exception("A runtime exception has occured"); unhandledException->display(); delete unhandledException; } return 0; }
void ODF::mode_change_slot () { ODF_Item* settings = get_image(); if (!settings) return; const GUI::DWI::Renderer::mode_t mode = (!type_selector->currentIndex() ? GUI::DWI::Renderer::mode_t::SH : (type_selector->currentIndex() == 1 ? GUI::DWI::Renderer::mode_t::TENSOR : GUI::DWI::Renderer::mode_t::DIXEL)); if (settings->mode == mode) return; auto reset_GUI = [&] (const GUI::DWI::Renderer::mode_t mode) { switch (mode) { case GUI::DWI::Renderer::mode_t::SH: type_selector->setCurrentIndex (0); break; case GUI::DWI::Renderer::mode_t::TENSOR: type_selector->setCurrentIndex (1); break; case GUI::DWI::Renderer::mode_t::DIXEL: type_selector->setCurrentIndex (2); break; } }; // Mode change combobox is now always enabled; // Need to detect bad selections here and act accordingly switch (mode) { case GUI::DWI::Renderer::mode_t::SH: try { Math::SH::check (settings->image.header()); } catch (Exception& e) { e.display(); reset_GUI (settings->mode); return; } renderer->sh.update_mesh (level_of_detail, lmax); break; case GUI::DWI::Renderer::mode_t::TENSOR: if (settings->image.header().size(3) != 6) { Exception e ("Cannot use image " + settings->image.header().name() + " as tensor overlay; must have 6 volumes"); e.display(); reset_GUI (settings->mode); return; } renderer->tensor.update_mesh (level_of_detail); break; case GUI::DWI::Renderer::mode_t::DIXEL: break; } settings->mode = mode; setup_ODFtype_UI (settings); if (preview) preview->render_frame->set_mode (mode); updateGL(); update_preview(); }