Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkIGTL2DImageDeviceSource.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
14 
15 #include "mitkIGTLMessage.h"
16 
17 //Microservices
18 #include <usGetModuleContext.h>
19 #include <usModule.h>
20 #include <usServiceProperties.h>
21 #include <usModuleContext.h>
22 
23 //itk
24 #include <itkCommand.h>
25 
28 {
29  this->SetName("IGTLDeviceSource (2D Images)");
30 }
31 
33 {
34 }
35 
37 {
38  if (m_IGTLDevice.IsNull())
39  return;
40 
41  /* update output with message from the device */
42  IGTLMessage* msgOut = this->GetOutput();
43  assert(msgOut);
44  igtl::MessageBase::Pointer msgIn = dynamic_cast<igtl::MessageBase*>(m_IGTLDevice->GetNextImage2dMessage().GetPointer());
45  if (msgIn.IsNotNull())
46  {
47  assert(msgIn);
48  msgOut->SetMessage(msgIn);
49  msgOut->SetName(msgIn->GetDeviceName());
50  }
51 }
void SetMessage(igtl::MessageBase::Pointer msg)
Sets the OpenIGTLink message.
Connects a mitk::IGTLDevice to a MITK-OpenIGTLink-Message-Filter-Pipeline.
DataCollection - Class to facilitate loading/accessing structured data.
mitk::IGTLDevice::Pointer m_IGTLDevice
virtual void SetName(const char *_arg)
set the name of the IGTLMessage object
IGTLMessage * GetOutput(void)
return the output (output with id 0) of the filter
A wrapper for the OpenIGTLink message type.
void GenerateData() override
filter execute method
virtual void SetName(std::string _arg)
Sets the human readable name of this source. There is also a default name, but you can use this metho...