27 "org.mitk.services.IGTLMessageSource";
29 US_INTERFACE_NAME +
".devicename";
31 US_INTERFACE_NAME +
".devicetype";
33 US_INTERFACE_NAME +
".id";
35 US_INTERFACE_NAME +
".isActive";
38 :
itk::ProcessObject(), m_Name(
"IGTLMessageSource (no defined type)"),
39 m_Type(
"NONE"), m_StreamingFPS(0)
51 if (this->GetNumberOfIndexedOutputs() < 1)
53 MITK_WARN <<
"IGTLMessageSource contained no outputs. Returning nullptr.";
57 return static_cast<IGTLMessage*
>(this->ProcessObject::GetPrimaryOutput());
61 DataObjectPointerArraySizeType idx)
64 dynamic_cast<IGTLMessage*
>( this->ProcessObject::GetOutput(idx) );
65 if ( out ==
nullptr && this->ProcessObject::GetOutput(idx) != NULL )
67 itkWarningMacro (<<
"Unable to convert output number " << idx <<
" to type "
74 const std::string& messageName)
76 DataObjectPointerArray outputs = this->GetOutputs();
77 for (DataObjectPointerArray::iterator it = outputs.begin();
82 (static_cast<IGTLMessage*>(it->GetPointer()))->GetName())
90 itk::ProcessObject::DataObjectPointerArraySizeType
93 DataObjectPointerArray outputs = this->GetOutputs();
94 for (DataObjectPointerArray::size_type i = 0; i < outputs.size(); ++i)
97 (static_cast<IGTLMessage*>(outputs.at(i).GetPointer()))->GetName())
102 throw std::invalid_argument(
"output name does not exist");
114 props[ US_PROPKEY_ID ] = uidGen.
GetUID();
115 props[ US_PROPKEY_DEVICENAME ] = m_Name;
116 props[ US_PROPKEY_DEVICETYPE ] = m_Type;
117 m_ServiceRegistration = context->RegisterService(
this, props);
122 if (m_ServiceRegistration !=
nullptr)
123 m_ServiceRegistration.Unregister();
124 m_ServiceRegistration = 0;
130 this->m_ServiceRegistration.GetReference().GetProperty(US_PROPKEY_ID);
131 return referenceProperty.
ToString();
136 this->GraftNthOutput(0, graft);
140 itk::DataObject *graft)
142 if ( idx >= this->GetNumberOfIndexedOutputs() )
144 itkExceptionMacro(<<
"Requested to graft output " << idx <<
" but this filter"
145 "only has " << this->GetNumberOfIndexedOutputs() <<
" Outputs.");
150 itkExceptionMacro(<<
"Requested to graft output with a NULL pointer object" );
153 itk::DataObject* output = this->GetOutput(idx);
156 itkExceptionMacro(<<
"Requested to graft output that is a NULL pointer" );
159 output->Graft( graft );
169 itkDebugMacro(
"MakeOutput(" << name <<
")");
170 if( this->IsIndexedOutputName(name) )
172 return this->MakeOutput( this->MakeIndexFromOutputName(name) );
187 this->m_StreamingFPSMutex->Lock();
188 this->m_StreamingFPS = fps;
189 this->m_StreamingFPSMutex->Unlock();
195 unsigned int fps = 0;
196 this->m_StreamingFPSMutex->Lock();
197 fps = this->m_StreamingFPS;
198 this->m_StreamingFPSMutex->Unlock();
virtual void RegisterAsMicroservice()
Registers this object as a Microservice, making it available to every module and/or plugin...
itk::SmartPointer< Self > Pointer
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
virtual 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.
virtual ~IGTLMessageSource()
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
std::string ToString() const
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.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.