7 #include "PlusConfigure.h" 8 #include "igsioTrackedFrame.h" 10 #include "igtl_image.h" 11 #include "igtl_header.h" 12 #include "igtl_util.h" 21 size_t headersize = 13 *
sizeof(igtl_uint32);
28 if (igtl_is_little_endian())
30 m_DataType = BYTE_SWAP_INT32(m_DataType);
31 m_TransmitFrequency = BYTE_SWAP_INT32(m_TransmitFrequency);
32 m_SamplingFrequency = BYTE_SWAP_INT32(m_SamplingFrequency);
33 m_DataRate = BYTE_SWAP_INT32(m_DataRate);
34 m_LineDensity = BYTE_SWAP_INT32(m_LineDensity);
36 m_SteeringAngle = BYTE_SWAP_INT32(m_SteeringAngle);
37 m_ProbeID = BYTE_SWAP_INT32(m_ProbeID);
38 m_ExtensionAngle = BYTE_SWAP_INT32(m_ExtensionAngle);
39 m_Elements = BYTE_SWAP_INT32(m_Elements);
40 m_Pitch = BYTE_SWAP_INT32(m_Pitch);
42 m_Radius = BYTE_SWAP_INT32(m_Radius);
43 m_ProbeAngle = BYTE_SWAP_INT32(m_ProbeAngle);
44 m_TxOffset = BYTE_SWAP_INT32(m_TxOffset);
52 this->m_SendMessageType =
"USMESSAGE";
63 igtl::MessageBase::Pointer clone;
65 vtkSmartPointer<vtkPlusIgtlMessageFactory> factory = vtkSmartPointer<vtkPlusIgtlMessageFactory>::New();
66 clone = dynamic_cast<igtl::MessageBase*>(factory->CreateSendMessage(this->GetMessageType(), this->GetHeaderVersion()).GetPointer());
69 igtl::PlusUsMessage::Pointer msg = dynamic_cast<igtl::PlusUsMessage*>(clone.GetPointer());
71 int bodySize = this->m_MessageSize - IGTL_HEADER_SIZE;
73 msg->CopyHeader(
this);
74 msg->AllocateBuffer(bodySize);
80 #if OpenIGTLink_HEADER_VERSION >= 2 81 msg->m_MetaDataHeader = this->m_MetaDataHeader;
82 msg->m_MetaDataMap = this->m_MetaDataMap;
83 msg->m_IsExtendedHeaderUnpacked = this->m_IsExtendedHeaderUnpacked;
102 auto igtlFrameTime = igtl::TimeStamp::New();
105 std::array<int, 3> offset = {0};
106 FrameSizeType imageSizePixels = {0};
112 imageSizePixels[0] = size[1];
113 imageSizePixels[1] = size[0];
114 imageSizePixels[2] = 1;
116 int scalarType = PlusCommon::GetIGTLScalarPixelTypeFromVTK(this->
m_TrackedFrame.GetImageData()->GetVTKScalarPixelType());
118 this->SetDimensions(static_cast<int>(imageSizePixels[0]), static_cast<int>(imageSizePixels[1]), static_cast<int>(imageSizePixels[2]));
119 this->SetSubVolume(static_cast<int>(imageSizePixels[0]), static_cast<int>(imageSizePixels[1]), static_cast<int>(imageSizePixels[2]), offset[0], offset[1], offset[2]);
120 this->SetScalarType(scalarType);
121 this->SetSpacing(0.2, 0.2, 1);
122 this->AllocateScalars();
124 unsigned char* igtlImagePointer = (
unsigned char*)(this->GetScalarPointer());
125 unsigned char* plusImagePointer = (
unsigned char*)(this->
m_TrackedFrame.GetImageData()->GetScalarPointer());
127 memcpy(igtlImagePointer, plusImagePointer, this->GetImageSize());
129 this->SetTimeStamp(igtlFrameTime);
134 std::string fieldValue = this->
m_TrackedFrame.GetFrameField(
"SonixDataType");
139 if (this->
m_TrackedFrame.IsFrameFieldDefined(
"SonixTransmitFrequency"))
141 std::string fieldValue = this->
m_TrackedFrame.GetFrameField(
"SonixTransmitFrequency");
146 if (this->
m_TrackedFrame.IsFrameFieldDefined(
"SonixSamplingFrequency"))
148 std::string fieldValue = this->
m_TrackedFrame.GetFrameField(
"SonixSamplingFrequency");
155 std::string fieldValue = this->
m_TrackedFrame.GetFrameField(
"SonixDataRate");
162 std::string fieldValue = this->
m_TrackedFrame.GetFrameField(
"SonixLineDensity");
167 if (this->
m_TrackedFrame.IsFrameFieldDefined(
"SonixSteeringAngle"))
169 std::string fieldValue = this->
m_TrackedFrame.GetFrameField(
"SonixSteeringAngle");
176 std::string fieldValue = this->
m_TrackedFrame.GetFrameField(
"SonixProbeID");
181 if (this->
m_TrackedFrame.IsFrameFieldDefined(
"SonixExtensionAngle"))
183 std::string fieldValue = this->
m_TrackedFrame.GetFrameField(
"SonixExtensionAngle");
190 std::string fieldValue = this->
m_TrackedFrame.GetFrameField(
"SonixElements");
197 std::string fieldValue = this->
m_TrackedFrame.GetFrameField(
"SonixPitch");
204 std::string fieldValue = this->
m_TrackedFrame.GetFrameField(
"SonixRadius");
211 std::string fieldValue = this->
m_TrackedFrame.GetFrameField(
"SonixProbeAngle");
218 std::string fieldValue = this->
m_TrackedFrame.GetFrameField(
"SonixTxOffset");
234 igtl::ImageMessage::PackContent();
262 igtl::ImageMessage::UnpackContent();
PlusStatus SetTrackedFrame(const igsioTrackedFrame &trackedFrame)
igsioTrackedFrame m_TrackedFrame
virtual int UnpackContent()
virtual igtlUint64 CalculateContentBufferSize()
igsioTrackedFrame & GetTrackedFrame()
virtual int PackContent()
virtual igtl::MessageBase::Pointer Clone()
MessageHeader m_MessageHeader