Medical Imaging Interaction Toolkit  2023.04.00
Medical Imaging Interaction Toolkit
mitk::USIGTLDevice Class Reference

A mitk::USIGTLDevice is a USDevice to receive images over an OpenIGTLink connection. It registers an OIGTL device as a Microservice to receive image messages and transforms them to mitk::Images. It can act both as a server (listening for incoming connections) and as a client (connecting to an existing OIGTL server). More...

#include <mitkUSIGTLDevice.h>

Inheritance diagram for mitk::USIGTLDevice:
Collaboration diagram for mitk::USIGTLDevice:

Public Member Functions

 mitkClassMacro (USIGTLDevice, mitk::USDevice)
 
 mitkNewMacro5Param (Self, std::string, std::string, std::string, int, bool)
 
std::string GetDeviceClass () override
 Returns the Class of the Device. This Method must be reimplemented by every Inheriting Class. More...
 
USImageSource::Pointer GetUSImageSource () override
 
 USIGTLDevice (std::string manufacturer, std::string model, std::string host, int port, bool server)
 
itk::SmartPointer< USAbstractControlInterfaceGetControlInterfaceCustom () override
 
void UnregisterOnService ()
 Remove the IGTLDevice from the micro service. More...
 
std::vector< mitk::USProbe::Pointer > GetAllProbes () override
 Return all probes for this USVideoDevice or an empty vector it no probes were set Returns a std::vector of all probes that exist for this USVideoDevice if there were probes set while creating or modifying this USVideoDevice. Otherwise it returns an empty vector. Therefore always check if vector is filled, before using it! More...
 
void DeleteAllProbes () override
 Cleans the std::vector containing all configured probes. More...
 
mitk::USProbe::Pointer GetCurrentProbe () override
 Return current active probe for this USDevice Returns a pointer to the probe that is currently in use. If there were probes set while creating or modifying this USDevice. Returns null otherwise. More...
 
void AddNewProbe (mitk::USProbe::Pointer probe) override
 adds a new probe to the device More...
 
mitk::USProbe::Pointer GetProbeByName (std::string name) override
 get the probe by its name Returns a pointer to the probe identified by the given name. If no probe of given name exists for this Device 0 is returned. More...
 
void RemoveProbeByName (std::string name) override
 Removes the Probe with the given name. More...
 
void SetDefaultProbeAsCurrentProbe () override
 Sets the first existing probe or the default probe of the video device as the current probe of it. More...
 
void SetCurrentProbe (std::string probename) override
 Sets the probe with the given name as current probe if the named probe exists. More...
 
void SetSpacing (double xSpacing, double ySpacing) override
 Sets the given spacing of the current depth of the current probe. More...
 
- Public Member Functions inherited from mitk::USDevice
 mitkClassMacro (USDevice, mitk::ImageSource)
 
virtual void SetSpawnAcquireThread (bool _arg)
 
virtual bool GetSpawnAcquireThread ()
 
 mitkNewMessage2Macro (PropertyChanged, const std::string &, const std::string &)
 Event for being notified about changes of the micro service properties. This event can be used if no micro service context is available. More...
 
virtual itk::SmartPointer< USControlInterfaceBModeGetControlInterfaceBMode ()
 Default getter for the b mode control interface. Has to be implemented in a subclass if a b mode control interface is available. Default implementation returns null. More...
 
virtual itk::SmartPointer< USControlInterfaceProbesGetControlInterfaceProbes ()
 Default getter for the probes control interface. Has to be implemented in a subclass if a probes control interface is available. Default implementation returns null. More...
 
virtual itk::SmartPointer< USControlInterfaceDopplerGetControlInterfaceDoppler ()
 Default getter for the doppler control interface. Has to be implemented in a subclass if a doppler control interface is available. Default implementation returns null. More...
 
bool Initialize ()
 Changes device state to mitk::USDevice::State_Initialized. During initialization the virtual method mitk::USDevice::OnInitialization will be called. If this method returns false the initialization process will be canceled. Otherwise the mitk::USDevice is registered in a micro service. More...
 
bool Connect ()
 Connects this device. A connected device is ready to deliver images (i.e. be Activated). A Connected Device can be active. A disconnected Device cannot be active. Internally calls onConnect and then registers the device with the service. A device usually should override the OnConnection() method, but never the Connect() method, since this will possibly exclude the device from normal service management. The exact flow of events is: 0. Check if the device is already connected. If yes, return true anyway, but don't do anything. More...
 
void ConnectAsynchron ()
 
bool Disconnect ()
 Works analogously to mitk::USDevice::Connect(). Don't override this Method, but onDisconnection instead. More...
 
bool Activate ()
 Activates this device. After the activation process, the device will start to produce images. This Method will fail, if the device is not connected. More...
 
void Deactivate ()
 Deactivates this device. After the deactivation process, the device will no longer produce images, but still be connected. More...
 
virtual void SetIsFreezed (bool freeze)
 Can toggle if ultrasound image is currently updated or freezed. More...
 
virtual bool GetIsFreezed ()
 
void PushFilter (AbstractOpenCVImageFilter::Pointer filter)
 
void PushFilterIfNotPushedBefore (AbstractOpenCVImageFilter::Pointer filter)
 
bool RemoveFilter (AbstractOpenCVImageFilter::Pointer filter)
 
void ProbeChanged (std::string probename)
 To be called when the used probe changed. Will update the service properties. More...
 
void DepthChanged (double depth)
 To be called when the scanning depth of the probe changed. Will update the service properties. More...
 
void UpdateServiceProperty (std::string key, std::string value)
 Given property is updated in the device micro service. This method is mainly for being used by the control interface superclasses. You do not need to call it by yoursefs in your concrete control interface classes. More...
 
void UpdateServiceProperty (std::string key, double value)
 
void UpdateServiceProperty (std::string key, bool value)
 
bool GetIsInitialized ()
 True, if the device object is created and initialized, false otherwise. More...
 
bool GetIsActive ()
 True, if the device is currently generating image data, false otherwise. More...
 
bool GetIsConnected ()
 True, if the device is currently ready to start transmitting image data or is already transmitting image data. A disconnected device cannot be activated. More...
 
mitk::USDevice::USImageCropArea GetCropArea ()
 
unsigned int GetSizeOfImageVector ()
 
std::string GetDeviceManufacturer ()
 Deprecated -> use GetManufacturer() instead. More...
 
std::string GetDeviceModel ()
 Deprecated -> use GetName() instead. More...
 
std::string GetDeviceComment ()
 Deprecated -> use GetCommend() instead. More...
 
virtual std::string GetManufacturer ()
 
virtual std::string GetName ()
 
virtual std::string GetComment ()
 
void SetManufacturer (std::string manufacturer)
 
void SetName (std::string name)
 
void SetComment (std::string comment)
 
virtual DeviceStates GetDeviceState ()
 
virtual us::ServiceProperties GetServiceProperties ()
 
void GrabImage ()
 
- Public Member Functions inherited from mitk::ImageSource
virtual std::vector< std::string > GetClassHierarchy () const override
 
virtual const char * GetClassName () const
 
Pointer Clone () const
 
OutputTypeGetOutput ()
 Get the output data of this image source object. More...
 
const OutputTypeGetOutput () const
 
OutputTypeGetOutput (DataObjectPointerArraySizeType idx)
 
const OutputTypeGetOutput (DataObjectPointerArraySizeType idx) const
 
itk::DataObject::Pointer MakeOutput (DataObjectPointerArraySizeType idx) override
 Make a DataObject of the correct type to used as the specified output. More...
 
itk::DataObject::Pointer MakeOutput (const DataObjectIdentifierType &name) override
 
virtual vtkImageData * GetVtkImageData ()
 
virtual const vtkImageData * GetVtkImageData () const
 
- Public Member Functions inherited from mitk::BaseDataSource
OutputTypeGetOutput ()
 
const OutputTypeGetOutput () const
 
OutputTypeGetOutput (DataObjectPointerArraySizeType idx)
 
const OutputTypeGetOutput (DataObjectPointerArraySizeType idx) const
 
virtual void GraftOutput (OutputType *output)
 Graft the specified BaseData onto this BaseDataSource's output. More...
 
virtual void GraftOutput (const DataObjectIdentifierType &key, OutputType *output)
 
virtual void GraftNthOutput (unsigned int idx, OutputType *output)
 Graft the specified base data object onto this BaseDataSource's idx'th output. More...
 
bool Updating () const
 Access itk::ProcessObject::m_Updating. More...
 

Protected Member Functions

bool OnInitialization () override
 Is called during the initialization process. Override this method in a subclass to handle the actual initialization. If it returns false, the initialization process will be canceled. More...
 
bool OnConnection () override
 Is called during the connection process. Override this method in a subclass to handle the actual connection. If it returns false, the connection process will be canceled. More...
 
bool OnDisconnection () override
 Is called during the disconnection process. Override this method in a subclass to handle the actual disconnection. If it returns false, the disconnection process will be canceled. More...
 
bool OnActivation () override
 Is called during the activation process. After this method is finished, the device should be generating images. If it returns false, the activation process will be canceled. More...
 
bool OnDeactivation () override
 Is called during the deactivation process. After a call to this method the device should still be connected, but not producing images anymore. More...
 
void GenerateData () override
 Grabs the next frame from the Video input. This method is called internally, whenever Update() is invoked by an Output. More...
 
- Protected Member Functions inherited from mitk::USDevice
virtual void SetImageVector (std::vector< mitk::Image::Pointer > vec)
 
void Acquire ()
 
void ConnectThread ()
 
void ProvideViaOIGTL ()
 Registers an OpenIGTLink device as a microservice so that we can send the images of this device via the network. More...
 
void DisableOIGTL ()
 Deregisters the microservices for OpenIGTLink. More...
 
us::ServiceProperties ConstructServiceProperties ()
 This Method constructs the service properties which can later be used to register the object with the Microservices Return service properties. More...
 
void UnregisterOnService ()
 Remove this device from the micro service. More...
 
virtual void OnFreeze (bool)
 Called when mitk::USDevice::SetIsFreezed() is called. Subclasses can overwrite this method to do additional actions. Default implementation does noting. More...
 
 USDevice (std::string manufacturer, std::string model)
 Enforces minimal Metadata to be set. More...
 
 USDevice (mitk::USImageMetadata::Pointer metadata)
 Constructs a device with the given Metadata. Make sure the Metadata contains meaningful content! More...
 
 ~USDevice () override
 
void GenerateData () override
 Grabs the next frame from the Video input. This method is called internally, whenever Update() is invoked by an Output. More...
 
std::string GetServicePropertyLabel ()
 
- Protected Member Functions inherited from mitk::ImageSource
 ImageSource ()
 
 ~ImageSource () override
 
void GenerateData () override
 A version of GenerateData() specific for image processing filters. More...
 
virtual void ThreadedGenerateData (const OutputImageRegionType &outputRegionForThread, itk::ThreadIdType threadId)
 If an imaging filter can be implemented as a multithreaded algorithm, the filter will provide an implementation of ThreadedGenerateData(). More...
 
void PrepareOutputs () override
 This method is intentionally left blank. More...
 
virtual void AllocateOutputs ()
 The GenerateData method normally allocates the buffers for all of the outputs of a filter. More...
 
virtual void BeforeThreadedGenerateData ()
 If an imaging filter needs to perform processing after the buffer has been allocated but before threads are spawned, the filter can can provide an implementation for BeforeThreadedGenerateData(). More...
 
virtual void AfterThreadedGenerateData ()
 If an imaging filter needs to perform processing after all processing threads have completed, the filter can can provide an implementation for AfterThreadedGenerateData(). More...
 
virtual unsigned int SplitRequestedRegion (unsigned int i, unsigned int num, OutputImageRegionType &splitRegion)
 Split the output's RequestedRegion into "num" pieces, returning region "i" as "splitRegion". More...
 
- Protected Member Functions inherited from mitk::BaseDataSource
 BaseDataSource ()
 
 ~BaseDataSource () override
 

Additional Inherited Members

- Public Types inherited from mitk::USDevice
enum  DeviceStates { State_NoState, State_Initialized, State_Connected, State_Activated }
 
- Public Types inherited from mitk::ImageSource
typedef ImageSource Self
 
typedef BaseDataSource Superclass
 
typedef itk::SmartPointer< SelfPointer
 
typedef itk::SmartPointer< const SelfConstPointer
 
typedef mitk::Image OutputImageType
 Some convenient typedefs. More...
 
typedef OutputImageType OutputType
 
typedef OutputImageType::Pointer OutputImagePointer
 
typedef SlicedData::RegionType OutputImageRegionType
 
- Public Types inherited from mitk::BaseDataSource
typedef BaseDataSource Self
 
typedef itk::ProcessObject Superclass
 
typedef itk::SmartPointer< SelfPointer
 
typedef itk::SmartPointer< const SelfConstPointer
 
typedef BaseData OutputType
 
typedef itk::DataObject::DataObjectIdentifierType DataObjectIdentifierType
 
- Static Public Member Functions inherited from mitk::USDevice
static mitk::USDevice::PropertyKeys GetPropertyKeys ()
 
- Static Public Member Functions inherited from mitk::ImageSource
static const char * GetStaticNameOfClass ()
 
static Pointer New ()
 Method for creation through the object factory. More...
 
- Static Public Member Functions inherited from mitk::BaseDataSource
static const char * GetStaticNameOfClass ()
 
- Static Protected Member Functions inherited from mitk::ImageSource
static itk::ITK_THREAD_RETURN_TYPE ThreaderCallback (void *arg)
 Static function used as a "callback" by the MultiThreader. More...
 
- Static Protected Member Functions inherited from mitk::BaseDataSource
static Pointer New ()
 
- Protected Attributes inherited from mitk::USDevice
std::condition_variable m_FreezeBarrier
 
std::mutex m_FreezeMutex
 
std::mutex m_ImageMutex
 mutex for images provided by the image source More...
 
std::thread m_Thread
 
std::vector< mitk::Image::Pointerm_ImageVector
 
mitk::Vector3D m_Spacing
 
mitk::IGTLServer::Pointer m_IGTLServer
 
mitk::IGTLMessageProvider::Pointer m_IGTLMessageProvider
 
mitk::ImageToIGTLMessageFilter::Pointer m_ImageToIGTLMsgFilter
 
bool m_IsFreezed
 
DeviceStates m_DeviceState
 
USImageCropArea m_CropArea
 
unsigned int m_NumberOfOutputs
 
us::ServiceProperties m_ServiceProperties
 Properties of the device's Microservice. More...
 
us::ServiceRegistration< Selfm_ServiceRegistration
 The device's ServiceRegistration object that allows to modify it's Microservice registraton details. More...
 

Detailed Description

A mitk::USIGTLDevice is a USDevice to receive images over an OpenIGTLink connection. It registers an OIGTL device as a Microservice to receive image messages and transforms them to mitk::Images. It can act both as a server (listening for incoming connections) and as a client (connecting to an existing OIGTL server).

Definition at line 44 of file mitkUSIGTLDevice.h.

Constructor & Destructor Documentation

◆ USIGTLDevice()

mitk::USIGTLDevice::USIGTLDevice ( std::string  manufacturer,
std::string  model,
std::string  host,
int  port,
bool  server 
)

Member Function Documentation

◆ AddNewProbe()

void mitk::USIGTLDevice::AddNewProbe ( mitk::USProbe::Pointer  probe)
overridevirtual

adds a new probe to the device

Reimplemented from mitk::USDevice.

◆ DeleteAllProbes()

void mitk::USIGTLDevice::DeleteAllProbes ( )
overridevirtual

Cleans the std::vector containing all configured probes.

Reimplemented from mitk::USDevice.

◆ GenerateData()

void mitk::USIGTLDevice::GenerateData ( )
overrideprotected

Grabs the next frame from the Video input. This method is called internally, whenever Update() is invoked by an Output.

◆ GetAllProbes()

std::vector<mitk::USProbe::Pointer> mitk::USIGTLDevice::GetAllProbes ( )
overridevirtual

Return all probes for this USVideoDevice or an empty vector it no probes were set Returns a std::vector of all probes that exist for this USVideoDevice if there were probes set while creating or modifying this USVideoDevice. Otherwise it returns an empty vector. Therefore always check if vector is filled, before using it!

Implements mitk::USDevice.

◆ GetControlInterfaceCustom()

itk::SmartPointer<USAbstractControlInterface> mitk::USIGTLDevice::GetControlInterfaceCustom ( )
overridevirtual

Getter for the custom control interface which was created during the construction process of mitk::USIGTLDevice.

Returns
custom control interface of the video device

Reimplemented from mitk::USDevice.

◆ GetCurrentProbe()

mitk::USProbe::Pointer mitk::USIGTLDevice::GetCurrentProbe ( )
overridevirtual

Return current active probe for this USDevice Returns a pointer to the probe that is currently in use. If there were probes set while creating or modifying this USDevice. Returns null otherwise.

Implements mitk::USDevice.

◆ GetDeviceClass()

std::string mitk::USIGTLDevice::GetDeviceClass ( )
overridevirtual

Returns the Class of the Device. This Method must be reimplemented by every Inheriting Class.

Implements mitk::USDevice.

◆ GetProbeByName()

mitk::USProbe::Pointer mitk::USIGTLDevice::GetProbeByName ( std::string  name)
overridevirtual

get the probe by its name Returns a pointer to the probe identified by the given name. If no probe of given name exists for this Device 0 is returned.

Implements mitk::USDevice.

◆ GetUSImageSource()

USImageSource::Pointer mitk::USIGTLDevice::GetUSImageSource ( )
overridevirtual
Returns
Returns the current image source of this device.

Implements mitk::USDevice.

◆ mitkClassMacro()

mitk::USIGTLDevice::mitkClassMacro ( USIGTLDevice  ,
mitk::USDevice   
)

◆ mitkNewMacro5Param()

mitk::USIGTLDevice::mitkNewMacro5Param ( Self  ,
std::string  ,
std::string  ,
std::string  ,
int  ,
bool   
)

◆ OnActivation()

bool mitk::USIGTLDevice::OnActivation ( )
overrideprotectedvirtual

Is called during the activation process. After this method is finished, the device should be generating images. If it returns false, the activation process will be canceled.

Returns
true if successful and false if unsuccessful
Exceptions
mitk::Exceptionimplementation may throw an exception to clarify what went wrong

Implements mitk::USDevice.

◆ OnConnection()

bool mitk::USIGTLDevice::OnConnection ( )
overrideprotectedvirtual

Is called during the connection process. Override this method in a subclass to handle the actual connection. If it returns false, the connection process will be canceled.

Returns
true if successful and false if unsuccessful
Exceptions
mitk::Exceptionimplementation may throw an exception to clarify what went wrong

Implements mitk::USDevice.

◆ OnDeactivation()

bool mitk::USIGTLDevice::OnDeactivation ( )
overrideprotectedvirtual

Is called during the deactivation process. After a call to this method the device should still be connected, but not producing images anymore.

Returns
true if successful and false if unsuccessful
Exceptions
mitk::Exceptionimplementation may throw an exception to clarify what went wrong

Implements mitk::USDevice.

◆ OnDisconnection()

bool mitk::USIGTLDevice::OnDisconnection ( )
overrideprotectedvirtual

Is called during the disconnection process. Override this method in a subclass to handle the actual disconnection. If it returns false, the disconnection process will be canceled.

Returns
true if successful and false if unsuccessful
Exceptions
mitk::Exceptionimplementation may throw an exception to clarify what went wrong

Implements mitk::USDevice.

◆ OnInitialization()

bool mitk::USIGTLDevice::OnInitialization ( )
overrideprotectedvirtual

Is called during the initialization process. Override this method in a subclass to handle the actual initialization. If it returns false, the initialization process will be canceled.

Returns
true if successful and false if unsuccessful
Exceptions
mitk::Exceptionimplementation may throw an exception to clarify what went wrong

Implements mitk::USDevice.

◆ RemoveProbeByName()

void mitk::USIGTLDevice::RemoveProbeByName ( std::string  name)
overridevirtual

Removes the Probe with the given name.

Reimplemented from mitk::USDevice.

◆ SetCurrentProbe()

void mitk::USIGTLDevice::SetCurrentProbe ( std::string  probename)
overridevirtual

Sets the probe with the given name as current probe if the named probe exists.

Reimplemented from mitk::USDevice.

◆ SetDefaultProbeAsCurrentProbe()

void mitk::USIGTLDevice::SetDefaultProbeAsCurrentProbe ( )
overridevirtual

Sets the first existing probe or the default probe of the video device as the current probe of it.

Reimplemented from mitk::USDevice.

◆ SetSpacing()

void mitk::USIGTLDevice::SetSpacing ( double  xSpacing,
double  ySpacing 
)
overridevirtual

Sets the given spacing of the current depth of the current probe.

Reimplemented from mitk::USDevice.

◆ UnregisterOnService()

void mitk::USIGTLDevice::UnregisterOnService ( )

Remove the IGTLDevice from the micro service.


The documentation for this class was generated from the following file: