23 "org.mitk.services.IGTLMessageSource";
25 US_INTERFACE_NAME +
".devicename";
27 US_INTERFACE_NAME +
".devicetype";
29 US_INTERFACE_NAME +
".id";
31 US_INTERFACE_NAME +
".isActive";
34 :
itk::ProcessObject(), m_Name(
"IGTLMessageSource (no defined type)"),
35 m_Type(
"NONE"), m_StreamingFPS(0)
47 if (this->GetNumberOfIndexedOutputs() < 1)
49 MITK_WARN <<
"IGTLMessageSource contained no outputs. Returning nullptr.";
53 return static_cast<IGTLMessage*
>(this->ProcessObject::GetPrimaryOutput());
57 DataObjectPointerArraySizeType idx)
60 dynamic_cast<IGTLMessage*
>( this->ProcessObject::GetOutput(idx) );
61 if ( out ==
nullptr && this->ProcessObject::GetOutput(idx) != nullptr )
63 itkWarningMacro (<<
"Unable to convert output number " << idx <<
" to type " 70 const std::string& messageName)
72 DataObjectPointerArray outputs = this->GetOutputs();
73 for (DataObjectPointerArray::iterator it = outputs.begin();
78 (static_cast<IGTLMessage*>(it->GetPointer()))->GetName())
86 itk::ProcessObject::DataObjectPointerArraySizeType
89 DataObjectPointerArray outputs = this->GetOutputs();
90 for (DataObjectPointerArray::size_type i = 0; i < outputs.size(); ++i)
93 (static_cast<IGTLMessage*>(outputs.at(i).GetPointer()))->GetName())
98 throw std::invalid_argument(
"output name does not exist");
129 return referenceProperty.
ToString();
138 itk::DataObject *graft)
140 if ( idx >= this->GetNumberOfIndexedOutputs() )
142 itkExceptionMacro(<<
"Requested to graft output " << idx <<
" but this filter" 143 "only has " << this->GetNumberOfIndexedOutputs() <<
" Outputs.");
148 itkExceptionMacro(<<
"Requested to graft output with a nullptr pointer object" );
151 itk::DataObject* output = this->
GetOutput(idx);
154 itkExceptionMacro(<<
"Requested to graft output that is a nullptr pointer" );
157 output->Graft( graft );
167 itkDebugMacro(
"MakeOutput(" << name <<
")");
168 if( this->IsIndexedOutputName(name) )
170 return this->
MakeOutput( this->MakeIndexFromOutputName(name) );
193 unsigned int fps = 0;
ServiceReference< I1 > GetReference(InterfaceType< I1 >) const
virtual void RegisterAsMicroservice()
Registers this object as a Microservice, making it available to every module and/or plugin...
virtual void UnRegisterMicroservice()
Registers this object as a Microservice, making it available to every module and/or plugin...
static const std::string US_PROPKEY_ISACTIVE
us::ServiceRegistration< Self > m_ServiceRegistration
itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) override
virtual void GraftNthOutput(unsigned int idx, itk::DataObject *graft)
Graft the specified DataObject onto this ProcessObject's output.
unsigned int m_StreamingFPS
~IGTLMessageSource() override
std::string ToString() const
unsigned int GetFPS()
Gets the fps used for streaming this source.
IGTLMessage * GetOutput(void)
return the output (output with id 0) of the filter
A wrapper for the OpenIGTLink message type.
static const std::string US_PROPKEY_DEVICETYPE
std::string GetMicroserviceID()
Returns the id that this device is registered with. The id will only be valid, if the IGTLMessageSour...
itk::SmartPointer< const Self > ConstPointer
virtual mitk::PropertyList::ConstPointer GetParameters() const
Get all filter parameters as a PropertyList.
itk::FastMutexLock::Pointer m_StreamingFPSMutex
static const std::string US_PROPKEY_ID
US_UNORDERED_MAP_TYPE< std::string, Any > ServiceProperties
static const std::string US_PROPKEY_DEVICENAME
virtual void GraftOutput(itk::DataObject *graft)
Graft the specified DataObject onto this ProcessObject's output.
static const std::string US_INTERFACE_NAME
These Constants are used in conjunction with Microservices.
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
DataObjectPointerArraySizeType GetOutputIndex(std::string messageName)
return the index of the output with name messageName, -1 if no output with that name was found ...
void SetFPS(unsigned int fps)
Sets the fps used for streaming this source.