63 m_Manufacturer(manufacturer),
66 m_SpawnAcquireThread(true),
67 m_UnregisteringStarted(false)
81 this->SetNthOutput(0, newOutput);
101 m_SpawnAcquireThread(true),
102 m_UnregisteringStarted(false)
104 m_Manufacturer = metadata->GetDeviceManufacturer();
105 m_Name = metadata->GetDeviceModel();
106 m_Comment = metadata->GetDeviceComment();
120 this->SetNthOutput(0, newOutput);
135 mitk::USAbstractControlInterface::Pointer
138 MITK_INFO <<
"Custom control interface does not exist for this object.";
142 mitk::USControlInterfaceBMode::Pointer
145 MITK_INFO <<
"Control interface BMode does not exist for this object.";
149 mitk::USControlInterfaceProbes::Pointer
152 MITK_INFO <<
"Control interface Probes does not exist for this object.";
156 mitk::USControlInterfaceDoppler::Pointer
159 MITK_INFO <<
"Control interface Doppler does not exist for this object.";
165 m_Manufacturer = manufacturer;
208 mitk::USControlInterfaceProbes::Pointer probesControls =
210 if (probesControls.IsNotNull() && probesControls->GetIsActive())
212 mitk::USProbe::Pointer probe = probesControls->GetSelectedProbe();
213 if (probe.IsNotNull())
236 m_UnregisteringStarted =
true;
262 MITK_DEBUG <<
"mitk::USDevice::Connect() called";
266 MITK_INFO(
"mitkUSDevice") <<
"Tried to connect an ultrasound device that " 267 "was already connected. Ignoring call...";
274 <<
"Cannot connect device if it is not in initialized state.";
301 MITK_WARN <<
"Tried to disconnect an ultrasound device that was not " 302 "connected. Ignoring call...";
323 <<
"Cannot activate device if it is not in connected state.";
334 if (m_SpawnAcquireThread)
346 mitk::USControlInterfaceBMode::Pointer bmodeControls =
348 if (bmodeControls.IsNotNull())
350 bmodeControls->Initialize();
396 <<
"Cannot deactivate a device which is not activae.";
429 <<
"Cannot freeze or unfreeze if device is not active.";
465 if (imageSource.IsNull())
467 MITK_ERROR <<
"ImageSource must not be null when pushing a filter.";
468 mitkThrow() <<
"ImageSource must not be null when pushing a filter.";
471 imageSource->PushFilter(filter);
475 AbstractOpenCVImageFilter::Pointer filter)
478 if (imageSource.IsNull())
480 MITK_ERROR <<
"ImageSource must not be null when pushing a filter.";
481 mitkThrow() <<
"ImageSource must not be null when pushing a filter.";
484 if (!imageSource->GetIsFilterInThePipeline(filter))
486 imageSource->PushFilter(filter);
493 if (imageSource.IsNull())
495 MITK_ERROR <<
"ImageSource must not be null when pushing a filter.";
496 mitkThrow() <<
"ImageSource must not be null when removing a filter.";
499 return imageSource->RemoveFilter(filter);
508 m_PropertyChangedMessage(key, value);
513 std::stringstream stream;
521 key, value ? std::string(
"true") : std::string(
"false"));
606 for(
size_t index = 0; index <
m_ImageVector.size(); ++index )
609 if(
image.IsNotNull() &&
image->IsInitialized() )
623 for (
unsigned int i = 0; i <
m_ImageVector.size() && i < this->GetNumberOfIndexedOutputs(); ++i)
626 if (
image.IsNull() || !
image->IsInitialized())
634 if (!output->IsInitialized() ||
635 output->GetDimension(0) !=
image->GetDimension(0) ||
636 output->GetDimension(1) !=
image->GetDimension(1) ||
637 output->GetDimension(2) !=
image->GetDimension(2) ||
638 output->GetPixelType() !=
image->GetPixelType())
640 output->Initialize(
image->GetPixelType(),
image->GetDimension(),
641 image->GetDimensions());
646 output->SetImportVolume(inputReadAccessor.
GetData());
647 output->SetGeometry(
image->GetGeometry());
655 std::string isActive;
658 isActive =
" (Active)";
662 isActive =
" (Inactive)";
665 return m_Manufacturer +
" " + m_Name + isActive;
671 struct itk::MultiThreader::ThreadInfoStruct* pInfo =
672 (
struct itk::MultiThreader::ThreadInfoStruct*)pInfoStruct;
689 return ITK_THREAD_RETURN_VALUE;
695 struct itk::MultiThreader::ThreadInfoStruct* pInfo =
696 (
struct itk::MultiThreader::ThreadInfoStruct*)pInfoStruct;
701 return ITK_THREAD_RETURN_VALUE;
virtual itk::SmartPointer< USControlInterfaceBMode > GetControlInterfaceBMode()
Default getter for the b mode control interface. Has to be implemented in a subclass if a b mode cont...
Superclass of all classes generating Images (instances of class Image) as output. ...
bool Activate()
Activates this device. After the activation process, the device will start to produce images...
A device holds information about it's model, make and the connected probes. It is the common super cl...
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 co...
virtual USImageSource::Pointer GetUSImageSource()=0
static ITK_THREAD_RETURN_TYPE Acquire(void *pInfoStruct)
std::string GetDeviceComment()
Deprecated -> use GetCommend() instead.
mitk::IGTLMessageProvider::Pointer m_IGTLMessageProvider
void PushFilterIfNotPushedBefore(AbstractOpenCVImageFilter::Pointer filter)
virtual bool OnInitialization()=0
Is called during the initialization process. Override this method in a subclass to handle the actual ...
USImageCropArea m_CropArea
const std::string US_PROPKEY_LABEL
us::ServiceProperties ConstructServiceProperties()
This Method constructs the service properties which can later be used to register the object with the...
static Pointer New()
Method for creation through the object factory.
DataCollection - Class to facilitate loading/accessing structured data.
static mitk::USDevice::PropertyKeys GetPropertyKeys()
const std::string US_PROPKEY_ISCONNECTED
void DisableOIGTL()
Deregisters the microservices for OpenIGTLink.
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.
bool GetIsConnected()
True, if the device is currently ready to start transmitting image data or is already transmitting im...
itk::ConditionVariable::Pointer m_FreezeBarrier
std::string GetDeviceManufacturer()
Deprecated -> use GetManufacturer() instead.
virtual bool OnDisconnection()=0
Is called during the disconnection process. Override this method in a subclass to handle the actual d...
virtual bool OnDeactivation()=0
Is called during the deactivation process. After a call to this method the device should still be con...
mitk::IGTLServer::Pointer m_IGTLServer
mitk::USDevice::USImageCropArea GetCropArea()
void ProbeChanged(std::string probename)
To be called when the used probe changed. Will update the service properties.
virtual itk::SmartPointer< USControlInterfaceDoppler > GetControlInterfaceDoppler()
Default getter for the doppler control interface. Has to be implemented in a subclass if a doppler co...
void DepthChanged(double depth)
To be called when the scanning depth of the probe changed. Will update the service properties...
virtual std::string GetName()
const std::string US_PROPKEY_CLASS
void SetComment(std::string comment)
mitk::ImageToIGTLMessageFilter::Pointer m_ImageToIGTLMsgFilter
std::string GetDeviceModel()
Deprecated -> use GetName() instead.
These constants are used in conjunction with Microservices. The constants aren't defined as static me...
int m_ThreadID
ID of the started thread.
void SetManufacturer(std::string manufacturer)
unsigned int GetSizeOfImageVector()
itk::MultiThreader::Pointer m_MultiThreader
itk::MultiThreader used for thread handling
virtual void SetIsFreezed(bool freeze)
Can toggle if ultrasound image is currently updated or freezed.
const std::string US_PROPKEY_PROBES_SELECTED
USDevice(std::string manufacturer, std::string model)
Enforces minimal Metadata to be set.
us::ServiceRegistration< Self > m_ServiceRegistration
The device's ServiceRegistration object that allows to modify it's Microservice registraton details...
us::ServiceProperties m_ServiceProperties
Properties of the device's Microservice.
virtual void SetImageVector(std::vector< mitk::Image::Pointer > vec)
bool Initialize()
Changes device state to mitk::USDevice::State_Initialized. During initialization the virtual method m...
mitk::Image::Pointer image
virtual void SetSpacing(double xSpacing, double ySpacing)
void UnregisterOnService()
Remove this device from the micro service.
const std::string US_PROPKEY_MANUFACTURER
US_UNORDERED_MAP_TYPE< std::string, Any > ServiceProperties
unsigned int m_NumberOfOutputs
void SetName(std::string name)
std::vector< mitk::Image::Pointer > m_ImageVector
virtual bool OnConnection()=0
Is called during the connection process. Override this method in a subclass to handle the actual conn...
DeviceStates m_DeviceState
itk::SimpleMutexLock m_FreezeMutex
virtual bool GetIsFreezed()
void Deactivate()
Deactivates this device. After the deactivation process, the device will no longer produce images...
OutputType * GetOutput()
Get the output data of this image source object.
void GenerateData() override
Grabs the next frame from the Video input. This method is called internally, whenever Update() is inv...
void SetProperties(const ServiceProperties &properties)
virtual void OnFreeze(bool)
Called when mitk::USDevice::SetIsFreezed() is called. Subclasses can overwrite this method to do addi...
const std::string US_PROPKEY_ISACTIVE
bool GetIsInitialized()
True, if the device object is created and initialized, false otherwise.
const std::string US_PROPKEY_NAME
itk::FastMutexLock::Pointer m_ImageMutex
mutex for images provided by the image source
static ITK_THREAD_RETURN_TYPE ConnectThread(void *pInfoStruct)
ImageReadAccessor class to get locked read access for a particular image part.
void PushFilter(AbstractOpenCVImageFilter::Pointer filter)
bool GetIsActive()
True, if the device is currently generating image data, false otherwise.
void ProvideViaOIGTL()
Registers an OpenIGTLink device as a microservice so that we can send the images of this device via t...
virtual bool OnActivation()=0
Is called during the activation process. After this method is finished, the device should be generati...
virtual itk::SmartPointer< USAbstractControlInterface > GetControlInterfaceCustom()
Default getter for the custom control interface. Has to be implemented in a subclass if a custom cont...
bool Disconnect()
Works analogously to mitk::USDevice::Connect(). Don't override this Method, but onDisconnection inste...
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
const std::string US_PROPKEY_COMMENT
bool RemoveFilter(AbstractOpenCVImageFilter::Pointer filter)
virtual std::string GetDeviceClass()=0
Returns the Class of the Device. This Method must be reimplemented by every Inheriting Class...
const void * GetData() const
Gives const access to the data.
std::string GetServicePropertyLabel()
virtual itk::SmartPointer< USControlInterfaceProbes > GetControlInterfaceProbes()
Default getter for the probes control interface. Has to be implemented in a subclass if a probes cont...