Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitk::USVideoDevice Class Reference

A mitk::USVideoDevice is the common class for video only devices. They capture video input either from a file or from a device and transform the output into an mitk::USImage with attached metadata. This simple implementation does only capture and display 2d images without registration for example. More...

#include <mitkUSVideoDevice.h>

Inheritance diagram for mitk::USVideoDevice:
Collaboration diagram for mitk::USVideoDevice:

Public Member Functions

 mitkClassMacro (USVideoDevice, mitk::USDevice)
 
 mitkNewMacro3Param (Self, int, std::string, std::string)
 
 mitkNewMacro3Param (Self, std::string, std::string, std::string)
 
 mitkNewMacro2Param (Self, int, mitk::USImageMetadata::Pointer)
 
 mitkNewMacro2Param (Self, std::string, mitk::USImageMetadata::Pointer)
 
virtual std::string GetDeviceClass () override
 
virtual itk::SmartPointer< USAbstractControlInterfaceGetControlInterfaceCustom () override
 
void UnregisterOnService ()
 Remove this device from the micro service. This method is public for mitk::USVideoDevice, because this devices can be completly removed. This is not possible for API devices, which should be available while their sub module is loaded. More...
 
virtual USImageSource::Pointer GetUSImageSource () override
 
std::vector< mitk::USProbe::Pointer > GetAllProbes ()
 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...
 
mitk::USProbe::Pointer GetCurrentProbe ()
 Return current active probe for this USVideoDevice Returns a pointer to the probe that is currently in use. If there were probes set while creating or modifying this USVideoDevice. Returns null otherwise. More...
 
void AddNewProbe (mitk::USProbe::Pointer probe)
 adds a new probe to the device More...
 
mitk::USProbe::Pointer GetProbeByName (std::string name)
 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)
 Removes the Probe with the given name. More...
 
bool GetIsSourceFile ()
 True, if this Device plays back a file, false if it recieves data from a device. More...
 
virtual mitk::Image::Pointer GetImage ()
 
virtual int GetDeviceID ()
 
virtual std::string GetFilePath ()
 
- Public Member Functions inherited from mitk::USDevice
 mitkClassMacro (USDevice, mitk::ImageSource)
 
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 ()
 
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
 
virtual itk::DataObject::Pointer MakeOutput (DataObjectPointerArraySizeType idx) override
 Make a DataObject of the correct type to used as the specified output. More...
 
virtual 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...
 

Static Public Member Functions

static std::string GetDeviceClassStatic ()
 
- 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 ()
 

Protected Member Functions

 USVideoDevice (int videoDeviceNumber, std::string manufacturer, std::string model)
 Creates a new device that will deliver USImages taken from a video device. under windows, try -1 for device number, which will grab the first available one (Open CV functionality) More...
 
 USVideoDevice (std::string videoFilePath, std::string manufacturer, std::string model)
 Creates a new device that will deliver USImages taken from a video file. More...
 
 USVideoDevice (int videoDeviceNumber, mitk::USImageMetadata::Pointer metadata)
 Creates a new device that will deliver USImages taken from a video device. under windows, try -1 for device number, which will grab the first available one (Open CV functionality) More...
 
 USVideoDevice (std::string videoFilePath, mitk::USImageMetadata::Pointer metadata)
 Creates a new device that will deliver USImages taken from a video file. More...
 
virtual ~USVideoDevice ()
 
void Init ()
 Initializes common properties for all constructors. More...
 
virtual bool OnInitialization () override
 Is called during the initialization process. Returns true if successful and false if unsuccessful. Additionally, you may throw an exception to clarify what went wrong. More...
 
virtual bool OnConnection () override
 Is called during the connection process. Returns true if successful and false if unsuccessful. Additionally, you may throw an exception to clarify what went wrong. More...
 
virtual bool OnDisconnection () override
 Is called during the disconnection process. Returns true if successful and false if unsuccessful. Additionally, you may throw an exception to clarify what went wrong. More...
 
virtual bool OnActivation () override
 Is called during the activation process. After this method is finsihed, the device should be generating images. More...
 
virtual 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...
 
- Protected Member Functions inherited from mitk::USDevice
virtual void SetImage (mitk::Image::Pointer _arg)
 
virtual void SetSpawnAcquireThread (bool _arg)
 
virtual bool GetSpawnAcquireThread ()
 
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...
 
virtual ~USDevice ()
 
virtual 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 ()
 
virtual ~ImageSource ()
 
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...
 
virtual 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 ()
 
virtual ~BaseDataSource ()
 

Protected Attributes

mitk::USImageVideoSource::Pointer m_Source
 The image source that we use to aquire data. More...
 
bool m_SourceIsFile
 True, if this source plays back a file, false if it recieves data from a device. More...
 
int m_DeviceID
 The device id to connect to. Undefined, if m_SourceIsFile == true;. More...
 
std::string m_FilePath
 The Filepath id to connect to. Undefined, if m_SourceIsFile == false;. More...
 
itk::SmartPointer< USVideoDeviceCustomControlsm_ControlInterfaceCustom
 custom control interface for us video device More...
 
std::vector< mitk::USProbe::Pointer > m_Probes
 probes for this USVideoDevice More...
 
mitk::USProbe::Pointer m_CurrentProbe
 probe that is currently in use More...
 
- Protected Attributes inherited from mitk::USDevice
mitk::Image::Pointer m_Image
 
mitk::Image::Pointer m_OutputImage
 
mitk::IGTLServer::Pointer m_IGTLServer
 
mitk::IGTLMessageProvider::Pointer m_IGTLMessageProvider
 
mitk::ImageToIGTLMessageFilter::Pointer m_ImageToIGTLMsgFilter
 
bool m_IsFreezed
 
DeviceStates m_DeviceState
 
USImageCropArea m_CropArea
 

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
 
- Public Attributes inherited from mitk::USDevice
virtual mitkNewMessage2Macro(PropertyChanged, const std::string &, const std::string &) static mitk itk::SmartPointer< USAbstractControlInterfaceGetControlInterfaceCustom ()
 Event for being notified about changes of the micro service properties. This event can be used if no micro service context is available. More...
 
- Static Protected Member Functions inherited from mitk::USDevice
static ITK_THREAD_RETURN_TYPE Acquire (void *pInfoStruct)
 
static ITK_THREAD_RETURN_TYPE ConnectThread (void *pInfoStruct)
 
- Static Protected Member Functions inherited from mitk::ImageSource
static 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 ()
 

Detailed Description

A mitk::USVideoDevice is the common class for video only devices. They capture video input either from a file or from a device and transform the output into an mitk::USImage with attached metadata. This simple implementation does only capture and display 2d images without registration for example.

Definition at line 44 of file mitkUSVideoDevice.h.

Constructor & Destructor Documentation

mitk::USVideoDevice::USVideoDevice ( int  videoDeviceNumber,
std::string  manufacturer,
std::string  model 
)
protected

Creates a new device that will deliver USImages taken from a video device. under windows, try -1 for device number, which will grab the first available one (Open CV functionality)

Definition at line 20 of file mitkUSVideoDevice.cpp.

References Init(), m_DeviceID, m_FilePath, and m_SourceIsFile.

mitk::USVideoDevice::USVideoDevice ( std::string  videoFilePath,
std::string  manufacturer,
std::string  model 
)
protected

Creates a new device that will deliver USImages taken from a video file.

Definition at line 28 of file mitkUSVideoDevice.cpp.

References Init(), m_FilePath, and m_SourceIsFile.

mitk::USVideoDevice::USVideoDevice ( int  videoDeviceNumber,
mitk::USImageMetadata::Pointer  metadata 
)
protected

Creates a new device that will deliver USImages taken from a video device. under windows, try -1 for device number, which will grab the first available one (Open CV functionality)

Definition at line 35 of file mitkUSVideoDevice.cpp.

References Init(), m_DeviceID, m_FilePath, and m_SourceIsFile.

mitk::USVideoDevice::USVideoDevice ( std::string  videoFilePath,
mitk::USImageMetadata::Pointer  metadata 
)
protected

Creates a new device that will deliver USImages taken from a video file.

Definition at line 43 of file mitkUSVideoDevice.cpp.

References Init(), m_FilePath, and m_SourceIsFile.

mitk::USVideoDevice::~USVideoDevice ( )
protectedvirtual

Definition at line 50 of file mitkUSVideoDevice.cpp.

Member Function Documentation

void mitk::USVideoDevice::AddNewProbe ( mitk::USProbe::Pointer  probe)

adds a new probe to the device

Definition at line 187 of file mitkUSVideoDevice.cpp.

std::vector< mitk::USProbe::Pointer > mitk::USVideoDevice::GetAllProbes ( )

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!

Definition at line 142 of file mitkUSVideoDevice.cpp.

References MITK_INFO.

mitk::USAbstractControlInterface::Pointer mitk::USVideoDevice::GetControlInterfaceCustom ( )
overridevirtual

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

Returns
custom control interface of the video device

Definition at line 78 of file mitkUSVideoDevice.cpp.

mitk::USProbe::Pointer mitk::USVideoDevice::GetCurrentProbe ( )

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

Definition at line 151 of file mitkUSVideoDevice.cpp.

std::string mitk::USVideoDevice::GetDeviceClass ( )
overridevirtual
Returns
the qualified name of this class (as returned by GetDeviceClassStatic())

Implements mitk::USDevice.

Definition at line 68 of file mitkUSVideoDevice.cpp.

References GetDeviceClassStatic().

std::string mitk::USVideoDevice::GetDeviceClassStatic ( )
static

This methode is necessary instead of a static member attribute to avoid "static initialization order fiasco" when an instance of this class is used in a module activator.

Returns
the qualified name of this class

Definition at line 73 of file mitkUSVideoDevice.cpp.

Referenced by GetDeviceClass(), and QmitkUSControlsCustomVideoDeviceWidget::GetDeviceClass().

virtual int mitk::USVideoDevice::GetDeviceID ( )
virtual
virtual std::string mitk::USVideoDevice::GetFilePath ( )
virtual
virtual mitk::Image::Pointer mitk::USVideoDevice::GetImage ( )
virtual
bool mitk::USVideoDevice::GetIsSourceFile ( )

True, if this Device plays back a file, false if it recieves data from a device.

Definition at line 192 of file mitkUSVideoDevice.cpp.

mitk::USProbe::Pointer mitk::USVideoDevice::GetProbeByName ( std::string  name)

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.

Definition at line 163 of file mitkUSVideoDevice.cpp.

References MITK_INFO.

mitk::USImageSource::Pointer mitk::USVideoDevice::GetUSImageSource ( )
overridevirtual
Returns
mitk::USImageSource connected to this device

Implements mitk::USDevice.

Definition at line 137 of file mitkUSVideoDevice.cpp.

void mitk::USVideoDevice::Init ( )
protected

Initializes common properties for all constructors.

Definition at line 56 of file mitkUSVideoDevice.cpp.

References mitk::New(), and mitk::USImageVideoSource::New().

Referenced by USVideoDevice().

mitk::USVideoDevice::mitkClassMacro ( USVideoDevice  ,
mitk::USDevice   
)
mitk::USVideoDevice::mitkNewMacro2Param ( Self  ,
int  ,
mitk::USImageMetadata::Pointer   
)
mitk::USVideoDevice::mitkNewMacro2Param ( Self  ,
std::string  ,
mitk::USImageMetadata::Pointer   
)
mitk::USVideoDevice::mitkNewMacro3Param ( Self  ,
int  ,
std::string  ,
std::string   
)
mitk::USVideoDevice::mitkNewMacro3Param ( Self  ,
std::string  ,
std::string  ,
std::string   
)
bool mitk::USVideoDevice::OnActivation ( )
overrideprotectedvirtual

Is called during the activation process. After this method is finsihed, the device should be generating images.

Implements mitk::USDevice.

Definition at line 110 of file mitkUSVideoDevice.cpp.

References MITK_INFO, and MITK_WARN.

bool mitk::USVideoDevice::OnConnection ( )
overrideprotectedvirtual

Is called during the connection process. Returns true if successful and false if unsuccessful. Additionally, you may throw an exception to clarify what went wrong.

Implements mitk::USDevice.

Definition at line 89 of file mitkUSVideoDevice.cpp.

bool mitk::USVideoDevice::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.

Implements mitk::USDevice.

Definition at line 123 of file mitkUSVideoDevice.cpp.

bool mitk::USVideoDevice::OnDisconnection ( )
overrideprotectedvirtual

Is called during the disconnection process. Returns true if successful and false if unsuccessful. Additionally, you may throw an exception to clarify what went wrong.

Implements mitk::USDevice.

Definition at line 101 of file mitkUSVideoDevice.cpp.

bool mitk::USVideoDevice::OnInitialization ( )
overrideprotectedvirtual

Is called during the initialization process. Returns true if successful and false if unsuccessful. Additionally, you may throw an exception to clarify what went wrong.

Implements mitk::USDevice.

Definition at line 83 of file mitkUSVideoDevice.cpp.

void mitk::USVideoDevice::RemoveProbeByName ( std::string  name)

Removes the Probe with the given name.

Definition at line 174 of file mitkUSVideoDevice.cpp.

References MITK_INFO.

void mitk::USVideoDevice::UnregisterOnService ( )

Remove this device from the micro service. This method is public for mitk::USVideoDevice, because this devices can be completly removed. This is not possible for API devices, which should be available while their sub module is loaded.

Definition at line 129 of file mitkUSVideoDevice.cpp.

References mitk::USDevice::UnregisterOnService().

Member Data Documentation

itk::SmartPointer<USVideoDeviceCustomControls> mitk::USVideoDevice::m_ControlInterfaceCustom
protected

custom control interface for us video device

Definition at line 211 of file mitkUSVideoDevice.h.

mitk::USProbe::Pointer mitk::USVideoDevice::m_CurrentProbe
protected

probe that is currently in use

Definition at line 221 of file mitkUSVideoDevice.h.

int mitk::USVideoDevice::m_DeviceID
protected

The device id to connect to. Undefined, if m_SourceIsFile == true;.

Definition at line 201 of file mitkUSVideoDevice.h.

Referenced by USVideoDevice().

std::string mitk::USVideoDevice::m_FilePath
protected

The Filepath id to connect to. Undefined, if m_SourceIsFile == false;.

Definition at line 206 of file mitkUSVideoDevice.h.

Referenced by USVideoDevice().

std::vector< mitk::USProbe::Pointer > mitk::USVideoDevice::m_Probes
protected

probes for this USVideoDevice

Definition at line 216 of file mitkUSVideoDevice.h.

mitk::USImageVideoSource::Pointer mitk::USVideoDevice::m_Source
protected

The image source that we use to aquire data.

Definition at line 191 of file mitkUSVideoDevice.h.

bool mitk::USVideoDevice::m_SourceIsFile
protected

True, if this source plays back a file, false if it recieves data from a device.

Definition at line 196 of file mitkUSVideoDevice.h.

Referenced by USVideoDevice().


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