66 MessageBox(
"Storage is locked, cannot modify it. Maybe the tracking device which uses this storage is connected. If you want to modify the storage please disconnect the device first.");
69 mitk::NavigationToolReader::Pointer myReader = mitk::NavigationToolReader::New();
72 if (filename ==
"")
return;
73 mitk::NavigationTool::Pointer readTool = myReader->DoRead(filename);
74 if (readTool.IsNull())
MessageBox(
"Error: " + myReader->GetErrorMessage());
83 mitk::RenderingManager::GetInstance()->InitializeViewsByBoundingObjects(
m_DataStorage);
90 if (
m_Controls->m_ToolList->currentItem() ==
nullptr) {
MessageBox(
"Error: Please select tool first!");
return; }
92 mitk::NavigationToolWriter::Pointer myWriter = mitk::NavigationToolWriter::New();
95 if (filename ==
"")
return;
96 std::string fileExt = Poco::Path(filename).getExtension();
97 if (fileExt ==
"") { filename.append(
".IGTTool"); }
99 MessageBox(
"Error: "+ myWriter->GetErrorMessage());
122 connect((QObject*)(
m_Controls->m_ToolCreationWidget), SIGNAL(NavigationToolFinished()),
this, SLOT(
OnAddToolSave()));
159 MessageBox(
"The storage is locked and it cannot be modified. Maybe the tracking device which " \
160 "uses this storage is connected. If you want to modify the storage please " \
161 "disconnect the device first.");
164 int toolIndex =
m_Controls->m_ToolList->currentIndex().row();
168 if (currentNavigationTool.IsNotNull())
170 std::string currentIdentifier = currentNavigationTool->GetIdentifier();
171 int NewNumber =
m_Controls->m_ToolList->currentIndex().row() - 1;
172 if (NewNumber < 0) { MITK_WARN <<
"Cannot move tool up because it is on the top!"; }
187 MessageBox(
"The storage is locked and it cannot be modified. Maybe the tracking device which " \
188 "uses this storage is connected. If you want to modify the storage please " \
189 "disconnect the device first.");
192 int toolIndex =
m_Controls->m_ToolList->currentIndex().row();
196 if (currentNavigationTool.IsNotNull())
198 std::string currentIdentifier = currentNavigationTool->GetIdentifier();
199 unsigned int NewNumber =
m_Controls->m_ToolList->currentIndex().row() + 1;
200 if (NewNumber >=
m_NavigationToolStorage->GetToolCount()) { MITK_WARN <<
"Cannot move tool down because it is the last tool in this storage!"; }
246 MessageBox(
"Storage is locked, cannot modify it. Maybe the tracking device which uses this storage is connected. If you want to modify the storage please disconnect the device first.");
249 else if (
m_Controls->m_ToolList->currentItem() ==
nullptr)
251 MessageBox(
"Error: Please select tool first!");
256 m_Controls->m_ToolCreationWidget->SetDefaultData(selectedTool);
257 m_Controls->m_ToolCreationWidget->ShowToolPreview(
"Tool preview");
259 m_Controls->m_MainWidgets->setCurrentIndex(1);
275 mitk::NavigationToolStorageDeserializer::Pointer myDeserializer = mitk::NavigationToolStorageDeserializer::New(
m_DataStorage);
277 if (filename ==
"")
return;
281 mitk::NavigationToolStorage::Pointer tempStorage =
nullptr;
285 tempStorage = myDeserializer->Deserialize(filename);
287 catch (
const mitk::Exception& exception)
292 if (tempStorage.IsNotNull())
294 Poco::Path myPath = Poco::Path(filename.c_str());
295 tempStorage->SetName(myPath.getFileName());
298 mitk::RenderingManager::GetInstance()->InitializeViewsByBoundingObjects(
m_DataStorage);
304 QFileDialog *fileDialog =
new QFileDialog;
305 fileDialog->setDefaultSuffix(
"IGTToolStorage");
306 QString suffix =
"IGT Tool Storage (*.IGTToolStorage)";
309 QString filename = fileDialog->getSaveFileName(
nullptr, tr(
"Save Navigation Tool Storage"), defaultFileName, suffix, &suffix);
311 if (filename.isEmpty())
return;
314 QFileInfo file(filename);
315 if(file.suffix().isEmpty()) filename +=
".IGTToolStorage";
318 mitk::NavigationToolStorageSerializer::Pointer mySerializer = mitk::NavigationToolStorageSerializer::New();
326 MessageBox(
"Error: " + std::string(e.GetDescription()));
331 Poco::Path myPath = Poco::Path(filename.toStdString());
332 m_Controls->m_StorageName->setText(QString::fromStdString(myPath.getFileName()));
344 MessageBox(
"The storage is locked and it cannot be modified. Maybe the tracking device which " \
345 "uses this storage is connected. If you want to modify the storage please " \
346 "disconnect the device first.");
350 mitk::NavigationTool::Pointer newTool =
m_Controls->m_ToolCreationWidget->GetCreatedTool();
355 editedTool->Graft(newTool);
369 m_Controls->m_MainWidgets->setCurrentIndex(0);
429 m_Controls->m_MoveToolDown->setEnabled(
false);
430 m_Controls->m_selectedLabel->setEnabled(
false);
445 m_Controls->m_selectedLabel->setEnabled(
true);