Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkIGTLTransformDeviceSource.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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
18 
19 #include "mitkIGTLMessage.h"
20 
21 //Microservices
22 #include <usGetModuleContext.h>
23 #include <usModule.h>
24 #include <usServiceProperties.h>
25 #include <usModuleContext.h>
26 
27 //itk
28 #include <itkCommand.h>
29 
32 {
33  this->SetName("IGTLDeviceSource (Transforms)");
34 }
35 
37 {
38 }
39 
41 {
42  if (m_IGTLDevice.IsNull())
43  return;
44 
45  /* update output with message from the device */
46  IGTLMessage* msgOut = this->GetOutput();
47  assert(msgOut);
48  igtl::MessageBase::Pointer msgIn = dynamic_cast<igtl::MessageBase*>(m_IGTLDevice->GetNextTransformMessage().GetPointer());
49  if (msgIn.IsNotNull())
50  {
51  assert(msgIn);
52 
53  MITK_INFO << "Received valid image";
54 
55  msgOut->SetMessage(msgIn);
56  msgOut->SetName(msgIn->GetDeviceName());
57  }
58 }
itk::SmartPointer< Self > Pointer
#define MITK_INFO
Definition: mitkLogMacros.h:22
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.
virtual void SetName(const char *_arg)
set the name of the IGTLMessage object
A wrapper for the OpenIGTLink message type.
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...
virtual void GenerateData() override
filter execute method