// Helper function to create a fully set up instance of our // AwesomeImageInteractor, based on the state machine specified in Paint.xml // as well as its configuration in PaintConfig.xml. Both files are compiled // into our MyAwesomeLib module as resources. static AwesomeImageInteractor::Pointer CreateAwesomeImageInteractor() { auto myAwesomeLib = us::ModuleRegistry::GetModule("MyAwesomeLib"); auto interactor = AwesomeImageInteractor::New(); interactor->LoadStateMachine("Paint.xml", myAwesomeLib); interactor->SetEventConfig("PaintConfig.xml", myAwesomeLib); return interactor; }
void mitk::Tool::InitializeStateMachine() { m_InteractorType += ".xml"; try { LoadStateMachine( m_InteractorType, us::GetModuleContext()->GetModule() ); SetEventConfig( "SegmentationToolsConfig.xml", us::GetModuleContext()->GetModule() ); } catch( const std::exception& e ) { MITK_ERROR << "Could not load statemachine pattern " << m_InteractorType << " with exception: " << e.what(); } }
void mitk::Tool::InitializeStateMachine() { if (m_InteractorType.empty()) return; try { auto isThisModule = nullptr == m_InteractorModule; auto module = isThisModule ? us::GetModuleContext()->GetModule() : m_InteractorModule; LoadStateMachine(m_InteractorType + ".xml", module); SetEventConfig(isThisModule ? "SegmentationToolsConfig.xml" : m_InteractorType + "Config.xml", module); } catch (const std::exception &e) { MITK_ERROR << "Could not load statemachine pattern " << m_InteractorType << ".xml with exception: " << e.what(); } }