PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
vtkPlusIgtlMessageCommon.h
Go to the documentation of this file.
1 /*=Plus=header=begin======================================================
2 Program: Plus
3 Copyright (c) Laboratory for Percutaneous Surgery. All rights reserved.
4 See License.txt for details.
5 =========================================================Plus=header=end*/
6 
7 #ifndef __vtkPlusIgtlMessageCommon_h
8 #define __vtkPlusIgtlMessageCommon_h
9 
10 // Local includes
11 #include "PlusConfigure.h"
12 #include "vtkPlusOpenIGTLinkExport.h"
13 
14 // VTK includes
15 #include <vtkObject.h>
16 
17 // OpenIGTLink includes
18 #include <igtlImageMessage.h>
19 #include <igtlImageMetaMessage.h>
20 #include <igtlMessageBase.h>
22 #include <igtlPlusUsMessage.h>
23 #include <igtlPolyDataMessage.h>
24 #include <igtlPositionMessage.h>
25 #include <igtlSocket.h>
26 #include <igtlStringMessage.h>
27 #include <igtlTrackingDataMessage.h>
28 #include <igtlTransformMessage.h>
29 #if defined(OpenIGTLink_ENABLE_VIDEOSTREAMING)
30  #include <igtlCodecCommonClasses.h>
31  #include <igtlVideoMessage.h>
32 #endif
33 
34 class vtkXMLDataElement;
35 //class igsioTrackedFrame;
36 class vtkPolyData;
37 //class vtkIGSIOTransformRepository;
38 class vtkIGSIOFrameConverter;
39 
48 class vtkPlusOpenIGTLinkExport vtkPlusIgtlMessageCommon: public vtkObject
49 {
50 public:
51  static vtkPlusIgtlMessageCommon* New();
52  vtkTypeMacro(vtkPlusIgtlMessageCommon, vtkObject);
53  virtual void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
54 
56  static PlusStatus PackTrackedFrameMessage(igtl::PlusTrackedFrameMessage::Pointer trackedFrameMessage, igsioTrackedFrame& trackedFrame, vtkSmartPointer<vtkMatrix4x4> embeddedImageTransform, const std::vector<igsioTransformName>& requestedTransforms);
57 
59  static PlusStatus UnpackTrackedFrameMessage(igtl::MessageHeader::Pointer headerMsg, igtl::Socket* socket, igsioTrackedFrame& trackedFrame, const igsioTransformName& embeddedTransformName, int crccheck);
60 
62  static PlusStatus PackUsMessage(igtl::PlusUsMessage::Pointer usMessage, igsioTrackedFrame& trackedFrame);
63 
65  static PlusStatus UnpackUsMessage(igtl::MessageHeader::Pointer headerMsg, igtl::Socket* socket, igsioTrackedFrame& trackedFrame, int crccheck);
66 
68  static PlusStatus PackImageMessage(igtl::ImageMessage::Pointer imageMessage, igsioTrackedFrame& trackedFrame, const vtkMatrix4x4& imageToReferenceTransform, vtkIGSIOFrameConverter* frameConverter = NULL);
69 
71  static PlusStatus PackImageMessage(igtl::ImageMessage::Pointer imageMessage, vtkImageData* image, const vtkMatrix4x4& imageToReferenceTransform, double timestamp);
72 
74  static PlusStatus UnpackImageMessage(igtl::MessageHeader::Pointer headerMsg, igtl::Socket* socket, igsioTrackedFrame& trackedFrame, const igsioTransformName& embeddedTransformName, int crccheck);
75 
77  static PlusStatus PackImageMetaMessage(igtl::ImageMetaMessage::Pointer imageMetaMessage, igsioCommon::ImageMetaDataList& imageMetaDataList);
78 
79 #if defined(OpenIGTLink_ENABLE_VIDEOSTREAMING)
80 
81  static PlusStatus PackVideoMessage(igtl::VideoMessage::Pointer imageMessage, igsioTrackedFrame& trackedFrame, vtkMatrix4x4& imageToReferenceTransform, vtkIGSIOFrameConverter* frameConverter = NULL, std::string codecFourCC = "", std::map<std::string, std::string> parameters = std::map<std::string, std::string>());
82 #endif
83 
85  static PlusStatus PackTransformMessage(igtl::TransformMessage::Pointer transformMessage, igsioTransformName& transformName,
86  igtl::Matrix4x4& igtlMatrix, ToolStatus status, double timestamp);
87 
89  static PlusStatus PackPolyDataMessage(igtl::PolyDataMessage::Pointer polydataMessage, vtkSmartPointer<vtkPolyData> polyData, double timestamp);
90 
92  static PlusStatus PackTrackingDataMessage(igtl::TrackingDataMessage::Pointer tdataMessage, const std::vector<igsioTransformName>& names, const vtkIGSIOTransformRepository& repository, double timestamp);
93 
95  static PlusStatus UnpackTrackingDataMessage(igtl::MessageHeader::Pointer headerMsg, igtl::Socket* socket,
96  std::vector<igsioTransformName>& names, vtkIGSIOTransformRepository& repository, double& timestamp, int crccheck);
97 
99  static PlusStatus UnpackTransformMessage(igtl::MessageHeader::Pointer headerMsg, igtl::Socket* socket,
100  vtkMatrix4x4* transformMatrix, ToolStatus& toolStatus, std::string& transformName, double& timestamp, int crccheck);
101 
103  static PlusStatus PackPositionMessage(igtl::PositionMessage::Pointer positionMessage, igsioTransformName& transformName, ToolStatus status,
104  float position[3], float quaternion[4], double timestamp);
105 
107  static PlusStatus UnpackPositionMessage(igtl::MessageHeader::Pointer headerMsg, igtl::Socket* socket,
108  vtkMatrix4x4* transformMatrix, std::string& transformName, ToolStatus& toolStatus, double& timestamp, int crccheck);
109 
111  static PlusStatus PackStringMessage(igtl::StringMessage::Pointer stringMessage, const char* stringName, const char* stringValue, double timestamp);
112  static PlusStatus PackStringMessage(igtl::StringMessage::Pointer stringMessage, const std::string& stringName, const std::string& stringValue, double timestamp);
113 
114 
116  static PlusStatus GetIgtlMatrix(igtl::Matrix4x4& igtlMatrix, vtkIGSIOTransformRepository* transformRepository, igsioTransformName& transformName);
117 
118 protected:
120  virtual ~vtkPlusIgtlMessageCommon();
121 
122 private:
124  void operator=(const vtkPlusIgtlMessageCommon&);
125 };
126 
127 #endif
double * timestamp
Definition: phidget22.h:3432
Helper class for OpenIGTLink message generation.
igsioStatus PlusStatus
Definition: PlusCommon.h:40
#define VTK_OVERRIDE
Definition: PlusCommon.h:49
double * position
Definition: phidget22.h:3303