7 #ifndef __vtkPlusIgtlMessageCommon_h 8 #define __vtkPlusIgtlMessageCommon_h 11 #include "PlusConfigure.h" 12 #include "vtkPlusOpenIGTLinkExport.h" 15 #include <vtkObject.h> 18 #include <igtlImageMessage.h> 19 #include <igtlImageMetaMessage.h> 20 #include <igtlMessageBase.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> 34 class vtkXMLDataElement;
38 class vtkIGSIOFrameConverter;
53 virtual void PrintSelf(ostream& os, vtkIndent indent)
VTK_OVERRIDE;
56 static PlusStatus PackTrackedFrameMessage(igtl::PlusTrackedFrameMessage::Pointer trackedFrameMessage, igsioTrackedFrame& trackedFrame, vtkSmartPointer<vtkMatrix4x4> embeddedImageTransform,
const std::vector<igsioTransformName>& requestedTransforms);
59 static PlusStatus UnpackTrackedFrameMessage(igtl::MessageHeader::Pointer headerMsg, igtl::Socket* socket, igsioTrackedFrame& trackedFrame,
const igsioTransformName& embeddedTransformName,
int crccheck);
62 static PlusStatus PackUsMessage(igtl::PlusUsMessage::Pointer usMessage, igsioTrackedFrame& trackedFrame);
65 static PlusStatus UnpackUsMessage(igtl::MessageHeader::Pointer headerMsg, igtl::Socket* socket, igsioTrackedFrame& trackedFrame,
int crccheck);
68 static PlusStatus PackImageMessage(igtl::ImageMessage::Pointer imageMessage, igsioTrackedFrame& trackedFrame,
const vtkMatrix4x4& imageToReferenceTransform, vtkIGSIOFrameConverter* frameConverter = NULL);
71 static PlusStatus PackImageMessage(igtl::ImageMessage::Pointer imageMessage, vtkImageData* image,
const vtkMatrix4x4& imageToReferenceTransform,
double timestamp);
74 static PlusStatus UnpackImageMessage(igtl::MessageHeader::Pointer headerMsg, igtl::Socket* socket, igsioTrackedFrame& trackedFrame,
const igsioTransformName& embeddedTransformName,
int crccheck);
77 static PlusStatus PackImageMetaMessage(igtl::ImageMetaMessage::Pointer imageMetaMessage, igsioCommon::ImageMetaDataList& imageMetaDataList);
79 #if defined(OpenIGTLink_ENABLE_VIDEOSTREAMING) 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>());
85 static PlusStatus PackTransformMessage(igtl::TransformMessage::Pointer transformMessage, igsioTransformName& transformName,
86 igtl::Matrix4x4& igtlMatrix, ToolStatus status,
double timestamp);
89 static PlusStatus PackPolyDataMessage(igtl::PolyDataMessage::Pointer polydataMessage, vtkSmartPointer<vtkPolyData> polyData,
double timestamp);
92 static PlusStatus PackTrackingDataMessage(igtl::TrackingDataMessage::Pointer tdataMessage,
const std::vector<igsioTransformName>& names,
const vtkIGSIOTransformRepository& repository,
double timestamp);
95 static PlusStatus UnpackTrackingDataMessage(igtl::MessageHeader::Pointer headerMsg, igtl::Socket* socket,
96 std::vector<igsioTransformName>& names, vtkIGSIOTransformRepository& repository,
double&
timestamp,
int crccheck);
99 static PlusStatus UnpackTransformMessage(igtl::MessageHeader::Pointer headerMsg, igtl::Socket* socket,
100 vtkMatrix4x4* transformMatrix, ToolStatus& toolStatus, std::string& transformName,
double&
timestamp,
int crccheck);
103 static PlusStatus PackPositionMessage(igtl::PositionMessage::Pointer positionMessage, igsioTransformName& transformName, ToolStatus status,
107 static PlusStatus UnpackPositionMessage(igtl::MessageHeader::Pointer headerMsg, igtl::Socket* socket,
108 vtkMatrix4x4* transformMatrix, std::string& transformName, ToolStatus& toolStatus,
double&
timestamp,
int crccheck);
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);
116 static PlusStatus GetIgtlMatrix(igtl::Matrix4x4& igtlMatrix, vtkIGSIOTransformRepository* transformRepository, igsioTransformName& transformName);
Helper class for OpenIGTLink message generation.