MCPcopy Create free account
hub / github.com/MITK/MITK / InitializeTools

Method InitializeTools

Modules/Segmentation/src/Controllers/mitkToolManager.cpp:99–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99void mitk::ToolManager::InitializeTools()
100{
101 // clear all previous tool pointers (tools may be still activated from another recently used plugin)
102 if (m_ActiveTool)
103 {
104 m_ActiveTool->Deactivated();
105 m_ActiveToolRegistration.Unregister();
106
107 m_ActiveTool = nullptr;
108 m_ActiveToolID = -1; // no tool active
109
110 ActiveToolChanged.Send();
111 }
112 m_Tools.clear();
113 // get a list of all known mitk::Tools
114 std::list<itk::LightObject::Pointer> thingsThatClaimToBeATool = itk::ObjectFactoryBase::CreateAllInstance("mitkTool");
115
116 // remember these tools
117 for (auto iter = thingsThatClaimToBeATool.begin();
118 iter != thingsThatClaimToBeATool.end();
119 ++iter)
120 {
121 if (auto *tool = dynamic_cast<Tool *>(iter->GetPointer()))
122 {
123 if (!tool->IsEligibleForAutoInit())
124 continue;
125
126 tool->InitializeStateMachine();
127 tool->SetToolManager(this); // important to call right after instantiation
128 tool->ErrorMessage += MessageDelegate1<mitk::ToolManager, std::string>(this, &ToolManager::OnToolErrorMessage);
129 tool->GeneralMessage +=
130 MessageDelegate1<mitk::ToolManager, std::string>(this, &ToolManager::OnGeneralToolMessage);
131 m_Tools.push_back(tool);
132 }
133 }
134}
135
136void mitk::ToolManager::OnToolErrorMessage(std::string s)
137{

Callers 2

RunTestWithParametersMethod · 0.80
CreateQtPartControlMethod · 0.80

Calls 10

GetPointerMethod · 0.80
IsEligibleForAutoInitMethod · 0.80
DeactivatedMethod · 0.45
UnregisterMethod · 0.45
SendMethod · 0.45
clearMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
SetToolManagerMethod · 0.45

Tested by 1

RunTestWithParametersMethod · 0.64