16#include <mitkSurface.h>
18#include <mitkDataStorage.h>
22#include <qfiledialog.h>
23#include <qinputdialog.h>
24#include <qmessagebox.h>
25#include <qscrollbar.h>
28#include <igtlStringMessage.h>
29#include <igtlBindMessage.h>
30#include <igtlQuaternionTrackingDataMessage.h>
31#include <igtlTrackingDataMessage.h>
37 "org.mitk.views.igtldevicesourcemanagementwidget";
40 QWidget* parent, Qt::WindowFlags f)
41 : QWidget(parent, f), m_IsClient(false), m_MessageReceivedObserverTag(0), m_CommandReceivedObserverTag(0), m_LostConnectionObserverTag(0), m_NewConnectionObserverTag(0), m_StateModifiedObserverTag(0)
63 m_Controls =
new Ui::QmitkIGTLDeviceSourceManagementWidgetControls;
76 connect(
m_Controls->butSend, SIGNAL(clicked()),
103 this->
m_Controls->editSend->setEnabled(
false);
107 if ( this->
m_IGTLDevice->GetNumberOfConnections() == 0 )
110 this->
m_Controls->editSend->setEnabled(
false);
120 mitkThrow() <<
"Invalid Device State";
133 mitk::IGTLDeviceSource::Pointer sourceToLoad)
147 if(sourceToLoad.IsNotNull())
169 typedef itk::SimpleMemberCommand< QmitkIGTLDeviceSourceManagementWidget > CurCommandType;
170 CurCommandType::Pointer messageReceivedCommand = CurCommandType::New();
171 messageReceivedCommand->SetCallbackFunction(
174 this->
m_IGTLDevice->AddObserver(mitk::MessageReceivedEvent(), messageReceivedCommand);
176 CurCommandType::Pointer commandReceivedCommand = CurCommandType::New();
177 commandReceivedCommand->SetCallbackFunction(
180 this->
m_IGTLDevice->AddObserver(mitk::CommandReceivedEvent(), commandReceivedCommand);
182 CurCommandType::Pointer connectionLostCommand = CurCommandType::New();
183 connectionLostCommand->SetCallbackFunction(
186 mitk::LostConnectionEvent(), connectionLostCommand);
188 CurCommandType::Pointer newConnectionCommand = CurCommandType::New();
189 newConnectionCommand->SetCallbackFunction(
192 mitk::NewClientConnectionEvent(), newConnectionCommand);
194 CurCommandType::Pointer stateModifiedCommand = CurCommandType::New();
195 stateModifiedCommand->SetCallbackFunction(
198 itk::ModifiedEvent(), stateModifiedCommand);
209 m_Controls->selectedSourceLabel->setText(
"<none>");
217 std::string toBeSend =
m_Controls->editSend->text().toStdString();
219 igtl::StringMessage::Pointer msg = igtl::StringMessage::New();
220 msg->SetString(toBeSend);
221 this->
m_IGTLDevice->SendMessage(mitk::IGTLMessage::New((igtl::MessageBase::Pointer)msg));
Superclass for OpenIGTLink clients.
IGTLDeviceState
Type for state variable. The IGTLDevice is always in one of these states.