29 #include <qfiledialog.h>
30 #include <qinputdialog.h>
31 #include <qmessagebox.h>
34 #include <Poco/Path.h>
55 m_Controls =
new Ui::QmitkNavigationToolManagementWidgetControls;
67 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.");
71 std::string
filename = QFileDialog::getOpenFileName(NULL, tr(
"Add Navigation Tool"),
"/",
"*.IGTTool").toLatin1().data();
72 if (filename ==
"")
return;
74 if (readTool.IsNull())
MessageBox(
"Error: " + myReader->GetErrorMessage());
90 if (
m_Controls->m_ToolList->currentItem() == NULL) {
MessageBox(
"Error: Please select tool first!");
return; }
93 std::string
filename = QFileDialog::getSaveFileName(NULL, tr(
"Save Navigation Tool"),
"/",
"*.IGTTool").toLatin1().data();
94 filename.append(
".IGTTool");
95 if (filename ==
"")
return;
97 MessageBox(
"Error: " + myWriter->GetErrorMessage());
118 connect((QObject*)(
m_Controls->m_ToolCreationWidget), SIGNAL(NavigationToolFinished()),
this, SLOT(
OnAddToolSave()));
130 if (storageToLoad.IsNotNull())
153 int toolIndex =
m_Controls->m_ToolList->currentIndex().row();
157 if (currentNavigationTool.IsNotNull())
159 std::string currentIdentifier = currentNavigationTool->GetIdentifier();
160 int NewNumber =
m_Controls->m_ToolList->currentIndex().row() - 1;
161 if (NewNumber < 0) {
MITK_WARN <<
"Cannot move tool up because it is on the top!"; }
174 int toolIndex =
m_Controls->m_ToolList->currentIndex().row();
178 if (currentNavigationTool.IsNotNull())
180 std::string currentIdentifier = currentNavigationTool->GetIdentifier();
181 int NewNumber =
m_Controls->m_ToolList->currentIndex().row() + 1;
195 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.");
200 m_Controls->m_ToolCreationWidget->Initialize(
m_DataStorage, defaultIdentifier.toStdString(), defaultName.toStdString());
202 m_Controls->m_MainWidgets->setCurrentIndex(1);
211 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.");
214 else if (
m_Controls->m_ToolList->currentItem() == NULL)
216 MessageBox(
"Error: Please select tool first!");
230 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.");
233 else if (
m_Controls->m_ToolList->currentItem() == NULL)
235 MessageBox(
"Error: Please select tool first!");
239 m_Controls->m_ToolCreationWidget->SetDefaultData(selectedTool);
242 m_Controls->m_MainWidgets->setCurrentIndex(1);
248 QString storageName = QInputDialog::getText(NULL,
"Storage Name",
"Name of the new tool storage:");
249 if (storageName.isNull())
return;
260 std::string
filename = QFileDialog::getOpenFileName(NULL, tr(
"Open Navigation Tool Storage"),
"/", tr(
"IGT Tool Storage (*.IGTToolStorage)")).toStdString();
261 if (filename ==
"")
return;
267 if (tempStorage.IsNull())
MessageBox(
"Error" + myDeserializer->GetErrorMessage());
270 Poco::Path myPath = Poco::Path(filename.c_str());
271 tempStorage->SetName(myPath.getFileName());
286 QString
filename = QFileDialog::getSaveFileName(NULL, tr(
"Save Navigation Tool Storage"),
"/", tr(
"IGT Tool Storage (*.IGTToolStorage)"));
287 if (filename.isEmpty())
return;
290 if (filename.right(15) !=
".IGTToolStorage") { filename +=
".IGTToolStorage"; }
296 MessageBox(
"Error: " + mySerializer->GetErrorMessage());
299 Poco::Path myPath = Poco::Path(filename.toStdString());
300 m_Controls->m_StorageName->setText(QString::fromStdString(myPath.getFileName()));
314 editedTool->Graft(newTool);
323 m_Controls->m_MainWidgets->setCurrentIndex(0);
329 m_Controls->m_MainWidgets->setCurrentIndex(0);
341 QString currentTool =
"Tool" + QString::number(i) +
": " + QString(
m_NavigationToolStorage->GetTool(i)->GetDataNode()->GetName().c_str()) +
" ";
343 currentTool +=
"(" + QString::fromStdString(
m_NavigationToolStorage->GetTool(i)->GetTrackingDeviceType()) +
"/";
348 currentTool +=
"Instrument)";
break;
350 currentTool +=
"Fiducial)";
break;
352 currentTool +=
"Skinmarker)";
break;
354 currentTool +=
"Unknown)";
363 msgBox.setText(s.c_str());
373 m_Controls->m_MoveToolDown->setEnabled(
false);
374 m_Controls->m_selectedLabel->setEnabled(
false);
389 m_Controls->m_selectedLabel->setEnabled(
true);
Data management class that handles 'was created by' relations.
itk::SmartPointer< Self > Pointer
An object of this class represents an exception of MITK. Please don't instantiate exceptions manually...
static const std::string filename
virtual void Remove(const mitk::DataNode *node)=0
Removes node from the DataStorage.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.