17#include <condition_variable>
24#include <MitkUSExports.h>
34#include <mitkCommon.h>
35#include <mitkMessage.h>
36#include <mitkImageSource.h>
39#include <itkObjectFactory.h>
42#include <mitkServiceInterface.h>
43#include <usServiceRegistration.h>
44#include <usServiceProperties.h>
50 template<
class T>
class SmartPointer;
54 class USAbstractControlInterface;
55 class USControlInterfaceBMode;
56 class USControlInterfaceProbes;
57 class USControlInterfaceDoppler;
75 class MITKUS_EXPORT
USDevice :
public mitk::ImageSource
78 enum DeviceStates { State_NoState, State_Initialized, State_Connected, State_Activated };
120 : US_INTERFACE_NAME(
"org.mitk.services.UltrasoundDevice"),
121 US_PROPKEY_MANUFACTURER(US_INTERFACE_NAME +
".manufacturer"),
122 US_PROPKEY_NAME(US_INTERFACE_NAME +
".name"),
123 US_PROPKEY_COMMENT(US_INTERFACE_NAME +
".comment"),
124 US_PROPKEY_LABEL(US_INTERFACE_NAME +
".label"),
125 US_PROPKEY_ISCONNECTED(US_INTERFACE_NAME +
".isConnected"),
126 US_PROPKEY_ISACTIVE(US_INTERFACE_NAME +
".isActive"),
127 US_PROPKEY_CLASS(US_INTERFACE_NAME +
".class"),
128 US_PROPKEY_PROBES_SELECTED(US_INTERFACE_NAME +
".probes.selected"),
129 US_PROPKEY_BMODE_FREQUENCY(US_INTERFACE_NAME +
".bmode.frequency"),
130 US_PROPKEY_BMODE_POWER(US_INTERFACE_NAME +
".bmode.power"),
131 US_PROPKEY_BMODE_DEPTH(US_INTERFACE_NAME +
".bmode.depth"),
132 US_PROPKEY_BMODE_GAIN(US_INTERFACE_NAME +
".bmode.gain"),
133 US_PROPKEY_BMODE_REJECTION(US_INTERFACE_NAME +
".bmode.rejection"),
134 US_PROPKEY_BMODE_DYNAMIC_RANGE(US_INTERFACE_NAME +
".bmode.dynamicRange")
207 void ConnectAsynchron();
233 virtual void SetIsFreezed(
bool freeze);
238 virtual bool GetIsFreezed();
240 void PushFilter(AbstractOpenCVImageFilter::Pointer filter);
241 void PushFilterIfNotPushedBefore(AbstractOpenCVImageFilter::Pointer filter);
242 bool RemoveFilter(AbstractOpenCVImageFilter::Pointer filter);
248 void ProbeChanged(std::string probename);
254 void DepthChanged(
double depth);
262 void UpdateServiceProperty(std::string key, std::string value);
263 void UpdateServiceProperty(std::string key,
double value);
264 void UpdateServiceProperty(std::string key,
bool value);
276 bool GetIsInitialized();
287 bool GetIsConnected();
293 unsigned int GetSizeOfImageVector();
309 void SetManufacturer(std::string manufacturer);
310 void SetName(std::string name);
311 void SetComment(std::string comment);
365 virtual void SetSpacing(
double xSpacing,
double ySpacing);
377 if (this->m_ImageVector != vec)
379 this->m_ImageVector = vec;
385 void ConnectThread();
396 void ProvideViaOIGTL();
419 us::ServiceProperties ConstructServiceProperties();
424 void UnregisterOnService();
486 USDevice(std::string manufacturer, std::string model);
492 USDevice(mitk::USImageMetadata::Pointer metadata);
500 void GenerateData()
override;
502 std::string GetServicePropertyLabel();
519 std::string m_Manufacturer;
521 std::string m_Comment;
523 bool m_SpawnAcquireThread;
525 bool m_UnregisteringStarted;
530MITK_DECLARE_SERVICE_INTERFACE(
mitk::USDevice,
"org.mitk.services.UltrasoundDevice")
A device holds information about it's model, make and the connected probes. It is the common super cl...
virtual void SetCurrentProbe(std::string)
Sets the probe with the given name as current probe if the named probe exists.
std::mutex m_ImageMutex
mutex for images provided by the image source
std::vector< mitk::Image::Pointer > m_ImageVector
virtual mitk::USProbe::Pointer GetCurrentProbe()=0
Return current active probe for this USDevice Returns a pointer to the probe that is currently in use...
virtual void AddNewProbe(mitk::USProbe::Pointer)
adds a new probe to the device
itkGetMacro(DeviceState, DeviceStates)
DEPRECATED(std::string GetDeviceComment())
Deprecated -> use GetCommend() instead.
itkGetMacro(Manufacturer, std::string)
virtual void RemoveProbeByName(std::string)
Removes the Probe with the given name.
DEPRECATED(std::string GetDeviceModel())
Deprecated -> use GetName() instead.
virtual bool OnDisconnection()=0
Is called during the disconnection process. Override this method in a subclass to handle the actual d...
DeviceStates m_DeviceState
virtual USImageSource::Pointer GetUSImageSource()=0
virtual void DeleteAllProbes()
Cleans the std::vector containing all configured probes.
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 ...
USImageCropArea m_CropArea
virtual void SetImageVector(std::vector< mitk::Image::Pointer > vec)
itkGetMacro(ServiceProperties, us::ServiceProperties)
us::ServiceRegistration< Self > m_ServiceRegistration
The device's ServiceRegistration object that allows to modify it's Microservice registraton details.
virtual mitk::USProbe::Pointer GetProbeByName(std::string name)=0
get the probe by its name Returns a pointer to the probe identified by the given name....
us::ServiceProperties m_ServiceProperties
Properties of the device's Microservice.
itkGetMacro(Comment, std::string)
std::condition_variable m_FreezeBarrier
mitkClassMacro(USDevice, mitk::ImageSource)
virtual bool OnConnection()=0
Is called during the connection process. Override this method in a subclass to handle the actual conn...
itkGetMacro(Name, std::string)
virtual void OnFreeze(bool)
Called when mitk::USDevice::SetIsFreezed() is called. Subclasses can overwrite this method to do addi...
mitk::IGTLMessageProvider::Pointer m_IGTLMessageProvider
itkGetMacro(SpawnAcquireThread, bool)
virtual bool OnInitialization()=0
Is called during the initialization process. Override this method in a subclass to handle the actual ...
mitk::ImageToIGTLMessageFilter::Pointer m_ImageToIGTLMsgFilter
mitk::IGTLServer::Pointer m_IGTLServer
itkSetMacro(SpawnAcquireThread, bool)
virtual std::string GetDeviceClass()=0
Returns the Class of the Device. This Method must be reimplemented by every Inheriting Class.
virtual bool OnActivation()=0
Is called during the activation process. After this method is finished, the device should be generati...
unsigned int m_NumberOfOutputs
virtual bool OnDeactivation()=0
Is called during the deactivation process. After a call to this method the device should still be con...
DEPRECATED(std::string GetDeviceManufacturer())
Deprecated -> use GetManufacturer() instead.
virtual std::vector< mitk::USProbe::Pointer > GetAllProbes()=0
Returns all probes for this device or an empty vector it no probes were set Returns a std::vector of ...
virtual void SetDefaultProbeAsCurrentProbe()
Sets the first existing probe or the default probe of the ultrasound device as the current probe of i...
These constants are used in conjunction with Microservices. The constants aren't defined as static me...
const std::string US_PROPKEY_CLASS
const std::string US_PROPKEY_ISACTIVE
const std::string US_PROPKEY_BMODE_GAIN
const std::string US_PROPKEY_COMMENT
const std::string US_PROPKEY_BMODE_DEPTH
const std::string US_INTERFACE_NAME
const std::string US_PROPKEY_ISCONNECTED
const std::string US_PROPKEY_BMODE_POWER
const std::string US_PROPKEY_MANUFACTURER
const std::string US_PROPKEY_NAME
const std::string US_PROPKEY_BMODE_DYNAMIC_RANGE
const std::string US_PROPKEY_PROBES_SELECTED
const std::string US_PROPKEY_BMODE_REJECTION
const std::string US_PROPKEY_LABEL
const std::string US_PROPKEY_BMODE_FREQUENCY