Medical Imaging Interaction Toolkit
2018.4.99-389bf124
Medical Imaging Interaction Toolkit
|
Provides information/objects from a MITK-Pipeline to other OpenIGTLink devices. More...
#include <mitkIGTLMessageProvider.h>
Public Types | |
typedef itk::SimpleMemberCommand< mitk::IGTLMessageProvider > | ProviderCommand |
Public Member Functions | |
mitkClassMacro (IGTLMessageProvider, IGTLDeviceSource) | |
Pointer | Clone () const |
void | Send (mitk::IGTLMessage::Pointer msg) |
sends the msg to the requesting client More... | |
void | StartStreamingOfSource (mitk::IGTLMessageSource *src, unsigned int fps) |
Starts the streaming of the given message source with the given fps. More... | |
void | StopStreamingOfSource (mitk::IGTLMessageSource *src) |
Stops the streaming of the given message source. More... | |
void | StopStreamingOfAllSources () |
Stops the streaming of all message source. More... | |
bool | IsStreaming () |
Returns the streaming state. More... | |
virtual unsigned int | GetStreamingTime () |
Get method for the streaming time. More... | |
void | Update () override |
![]() | |
mitkClassMacro (IGTLDeviceSource, IGTLMessageSource) | |
Pointer | Clone () const |
virtual void | SetIGTLDevice (mitk::IGTLDevice *td) |
sets the OpenIGTLink device that will be used as a data source More... | |
virtual mitk::IGTLDevice * | GetIGTLDevice () |
returns the OpenIGTLink device that is used by this filter More... | |
void | RegisterAsMicroservice () override |
Registers this object as a Microservice, making it available to every module and/or plugin. To unregister, call UnregisterMicroservice(). More... | |
void | Connect () |
Establishes a connection to the OpenIGTLink device. If there is already a connection the method does nothing. More... | |
void | Disconnect () |
Closes the connection to the OpenIGTLink device. More... | |
void | StartCommunication () |
starts the communication of the device. This needs to be called before Update() or GetOutput()->Update(). If the device is already communicating the method does nothing. More... | |
void | StopCommunication () |
stops the communication of the device. More... | |
virtual bool | IsConnected () |
returns true if a connection to the OpenIGTLink device is established More... | |
virtual bool | IsCommunicating () |
returns true if communication is in progress More... | |
void | UpdateOutputInformation () override |
Used for pipeline update. More... | |
![]() | |
mitkClassMacroItkParent (IGTLMessageSource, itk::ProcessObject) | |
virtual std::string | GetName () |
virtual void | SetName (std::string _arg) |
Sets the human readable name of this source. There is also a default name, but you can use this method if you need to define it on your own. More... | |
virtual std::string | GetType () |
virtual void | SetType (std::string _arg) |
IGTLMessage * | GetOutput (void) |
return the output (output with id 0) of the filter More... | |
IGTLMessage * | GetOutput (DataObjectPointerArraySizeType idx) |
return the output with id idx of the filter More... | |
IGTLMessage * | GetOutput (const std::string &messageName) |
return the output with name messageName of the filter More... | |
DataObjectPointerArraySizeType | GetOutputIndex (std::string messageName) |
return the index of the output with name messageName, -1 if no output with that name was found More... | |
virtual void | UnRegisterMicroservice () |
Registers this object as a Microservice, making it available to every module and/or plugin. More... | |
std::string | GetMicroserviceID () |
Returns the id that this device is registered with. The id will only be valid, if the IGTLMessageSource has been registered using RegisterAsMicroservice(). More... | |
virtual void | GraftNthOutput (unsigned int idx, itk::DataObject *graft) |
Graft the specified DataObject onto this ProcessObject's output. More... | |
virtual void | GraftOutput (itk::DataObject *graft) |
Graft the specified DataObject onto this ProcessObject's output. More... | |
itk::DataObject::Pointer | MakeOutput (DataObjectPointerArraySizeType idx) override |
itk::DataObject::Pointer | MakeOutput (const DataObjectIdentifierType &name) override |
virtual void | SetParameters (const mitk::PropertyList *) |
Set all filter parameters as the PropertyList p. More... | |
virtual mitk::PropertyList::ConstPointer | GetParameters () const |
Get all filter parameters as a PropertyList. More... | |
void | SetFPS (unsigned int fps) |
Sets the fps used for streaming this source. More... | |
unsigned int | GetFPS () |
Gets the fps used for streaming this source. More... | |
Static Public Member Functions | |
static Pointer | New () |
![]() | |
static Pointer | New () |
Protected Member Functions | |
IGTLMessageProvider () | |
~IGTLMessageProvider () override | |
void | GenerateData () override |
filter execute method More... | |
void | CreateOutputs () |
Create the necessary outputs for the m_IGTLDevice. More... | |
void | OnIncomingMessage () override |
This method is called when the IGTL device hold by this class receives a new message. More... | |
void | OnIncomingCommand () override |
This method is called when the IGTL device hold by this class receives a new command. More... | |
void | OnLostConnection () override |
This method is called when the IGTL device lost the connection to the other side. More... | |
void | ConnectTo (mitk::IGTLMessageSource *UpstreamFilter) |
Connects the input of this filter to the outputs of the given IGTLMessageSource. More... | |
void | DisconnectFrom (mitk::IGTLMessageSource *UpstreamFilter) |
Disconnects this filter from the outputs of the given IGTLMessageSource. More... | |
mitk::IGTLMessageSource::Pointer | GetFittingSource (const char *requestedType) |
Looks for microservices that provide messages with the requested type. More... | |
void | InvokeStartStreamingEvent () |
void | InvokeStopStreamingEvent () |
![]() | |
IGTLDeviceSource () | |
~IGTLDeviceSource () override | |
void | GenerateData () override |
filter execute method More... | |
void | CreateOutputs () |
Create the necessary outputs for the m_IGTLDevice. More... | |
virtual void | RemoveObservers () |
Removes all observers that listen to the igtl device. More... | |
virtual void | SetInput (unsigned int idx, const IGTLMessage *msg) |
Set input with id idx of this filter. More... | |
const IGTLMessage * | GetInput (void) const |
Get the input of this filter. More... | |
const IGTLMessage * | GetInput (unsigned int idx) const |
Get the input with id idx of this filter. More... | |
const IGTLMessage * | GetInput (std::string msgName) const |
Get the input with name messageName of this filter. More... | |
DataObjectPointerArraySizeType | GetInputIndex (std::string msgName) |
return the index of the input with name msgName, throw std::invalid_argument exception if that name was not found More... | |
DataObjectPointerArraySizeType | GetOutputIndex (std::string msgName) |
return the index of the output with name msgName, -1 if no output with that name was found More... | |
![]() | |
IGTLMessageSource () | |
~IGTLMessageSource () override | |
Additional Inherited Members | |
![]() | |
static const std::string | US_PROPKEY_IGTLDEVICENAME |
These Constants are used in conjunction with Microservices. More... | |
![]() | |
static const std::string | US_INTERFACE_NAME |
These Constants are used in conjunction with Microservices. More... | |
static const std::string | US_PROPKEY_DEVICENAME |
static const std::string | US_PROPKEY_DEVICETYPE |
static const std::string | US_PROPKEY_ID |
static const std::string | US_PROPKEY_ISACTIVE |
![]() | |
mitk::IGTLDevice::Pointer | m_IGTLDevice |
unsigned int | m_LostConnectionObserverTag |
unsigned int | m_IncomingCommandObserverTag |
unsigned int | m_IncomingMessageObserverTag |
![]() | |
std::string | m_Name |
std::string | m_Type |
itk::FastMutexLock::Pointer | m_StreamingFPSMutex |
unsigned int | m_StreamingFPS |
us::ServiceRegistration< Self > | m_ServiceRegistration |
Provides information/objects from a MITK-Pipeline to other OpenIGTLink devices.
This class is intended as the drain of the pipeline. Other OpenIGTLink devices connect with the IGTLDevice hold by this provider. The other device asks for a certain data type. The provider checks if there are other IGTLMessageSources available that provide this data type. If yes the provider connects with this source and sends the message to the requesting device.
If a STT message was received the provider looks for fitting messageSources. Once found it connects with it, starts a timing thread (which updates the pipeline) and sends the result to the requesting device.
If a GET message was received the provider just calls an update of the found source and sends the result without connecting to the source.
If a STP message was received it stops the thread and disconnects from the previous source.
So far the provider can just connect with one source.
Definition at line 47 of file mitkIGTLMessageProvider.h.
typedef itk::SimpleMemberCommand<mitk::IGTLMessageProvider> mitk::IGTLMessageProvider::ProviderCommand |
Definition at line 52 of file mitkIGTLMessageProvider.h.
|
protected |
Definition at line 37 of file mitkIGTLMessageProvider.cpp.
References InvokeStartStreamingEvent(), InvokeStopStreamingEvent(), and mitk::IGTLMessageSource::SetName().
|
overrideprotected |
Definition at line 57 of file mitkIGTLMessageProvider.cpp.
Pointer mitk::IGTLMessageProvider::Clone | ( | ) | const |
|
protected |
Connects the input of this filter to the outputs of the given IGTLMessageSource.
This method does not support smartpointer. use FilterX.GetPointer() to retrieve a dumbpointer.
Definition at line 360 of file mitkIGTLMessageProvider.cpp.
References mitk::IGTLMessageSource::GetOutput(), and mitk::IGTLDeviceSource::SetInput().
Referenced by StartStreamingOfSource().
|
protected |
Create the necessary outputs for the m_IGTLDevice.
This Method is called internally whenever outputs need to be reset. Old Outputs are deleted when called.
Definition at line 112 of file mitkIGTLMessageProvider.cpp.
References mitk::IGTLMessageSource::GetOutput(), mitk::IGTLDeviceSource::m_IGTLDevice, and mitk::IGTLMessageSource::MakeOutput().
|
protected |
Disconnects this filter from the outputs of the given IGTLMessageSource.
This method does not support smartpointer. use FilterX.GetPointer() to retrieve a dumbpointer.
Definition at line 370 of file mitkIGTLMessageProvider.cpp.
References mitk::IGTLDeviceSource::GetInput(), and mitk::IGTLMessageSource::GetOutput().
Referenced by StopStreamingOfSource().
|
overrideprotected |
filter execute method
queries the OpenIGTLink device for new messages and updates its output igtl::MessageBase objects with it.
Definition at line 90 of file mitkIGTLMessageProvider.cpp.
References mitk::IGTLDeviceSource::GetInput(), and mitk::IGTLDeviceSource::m_IGTLDevice.
|
protected |
Looks for microservices that provide messages with the requested type.
Definition at line 323 of file mitkIGTLMessageProvider.cpp.
References us::GetModuleContext(), mitk::IGTLMessageSource::US_INTERFACE_NAME, and mitk::IGTLMessageSource::US_PROPKEY_DEVICETYPE.
Referenced by OnIncomingCommand().
|
virtual |
Get method for the streaming time.
|
protected |
Invokes the start streaming event. This separate method is required, because it has to be started from the main thread. (It is used as callback function)
Definition at line 285 of file mitkIGTLMessageProvider.cpp.
Referenced by IGTLMessageProvider().
|
protected |
Invokes the stop streaming event. This separate method is required, because it has to be started from the main thread. (It is used as callback function)
Definition at line 290 of file mitkIGTLMessageProvider.cpp.
Referenced by IGTLMessageProvider().
bool mitk::IGTLMessageProvider::IsStreaming | ( | ) |
Returns the streaming state.
Definition at line 242 of file mitkIGTLMessageProvider.cpp.
mitk::IGTLMessageProvider::mitkClassMacro | ( | IGTLMessageProvider | , |
IGTLDeviceSource | |||
) |
|
static |
Referenced by mitk::USDevice::ProvideViaOIGTL().
|
overrideprotectedvirtual |
This method is called when the IGTL device hold by this class receives a new command.
Reimplemented from mitk::IGTLDeviceSource.
Definition at line 162 of file mitkIGTLMessageProvider.cpp.
References GetFittingSource(), mitk::IGTLDeviceSource::GetIGTLDevice(), mitk::IGTLDeviceSource::m_IGTLDevice, MITK_WARN, RemoveRequestPrefixes(), mitk::IGTLDevice::SendMessage(), mitk::IGTLDevice::SendRTSMessage(), StartStreamingOfSource(), and StopStreamingOfSource().
|
overrideprotectedvirtual |
This method is called when the IGTL device hold by this class receives a new message.
Reimplemented from mitk::IGTLDeviceSource.
Definition at line 142 of file mitkIGTLMessageProvider.cpp.
|
overrideprotectedvirtual |
This method is called when the IGTL device lost the connection to the other side.
Reimplemented from mitk::IGTLDeviceSource.
Definition at line 147 of file mitkIGTLMessageProvider.cpp.
References MITK_DEBUG, and StopStreamingOfAllSources().
void mitk::IGTLMessageProvider::Send | ( | mitk::IGTLMessage::Pointer | msg | ) |
sends the msg to the requesting client
Note: so far it broadcasts the message to all registered clients
Definition at line 350 of file mitkIGTLMessageProvider.cpp.
References mitk::IGTLDeviceSource::m_IGTLDevice, and MITK_INFO.
void mitk::IGTLMessageProvider::StartStreamingOfSource | ( | mitk::IGTLMessageSource * | src, |
unsigned int | fps | ||
) |
Starts the streaming of the given message source with the given fps.
Definition at line 247 of file mitkIGTLMessageProvider.cpp.
References mitk::CallbackFromGUIThread::CallThisFromGUIThread(), ConnectTo(), mitk::CallbackFromGUIThread::GetInstance(), and MITK_WARN.
Referenced by OnIncomingCommand().
void mitk::IGTLMessageProvider::StopStreamingOfAllSources | ( | ) |
Stops the streaming of all message source.
Definition at line 312 of file mitkIGTLMessageProvider.cpp.
References mitk::CallbackFromGUIThread::CallThisFromGUIThread(), and mitk::CallbackFromGUIThread::GetInstance().
Referenced by OnLostConnection().
void mitk::IGTLMessageProvider::StopStreamingOfSource | ( | mitk::IGTLMessageSource * | src | ) |
Stops the streaming of the given message source.
Definition at line 295 of file mitkIGTLMessageProvider.cpp.
References mitk::CallbackFromGUIThread::CallThisFromGUIThread(), DisconnectFrom(), and mitk::CallbackFromGUIThread::GetInstance().
Referenced by OnIncomingCommand().
|
override |
Definition at line 70 of file mitkIGTLMessageProvider.cpp.
References mitk::IGTLDeviceSource::GetInput(), mitk::IGTLMessage::GetMessage(), and Update().