/usr/include/openigtlink/igtlQuaternionTrackingDataMessage.h is in libopenigtlink-dev 1.11.0-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | /*=========================================================================
Program: The OpenIGTLink Library
Language: C++
Web page: http://openigtlink.org/
Copyright (c) Insight Software Consortium. All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __igtlQuaternionTrackingDataMessage_h
#define __igtlQuaternionTrackingDataMessage_h
#include <vector>
#include <string>
#include "igtlObject.h"
#include "igtlMath.h"
#include "igtlMessageBase.h"
#include "igtlTypes.h"
namespace igtl
{
/// A class to manage tracking data as a quaternion used in the QTDATA message type.
/// A QuaternionTrackingDataElement class instance holds tracking data for 1 tracking device.
class IGTLCommon_EXPORT QuaternionTrackingDataElement: public Object
{
public:
typedef QuaternionTrackingDataElement Self;
typedef Object Superclass;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
igtlTypeMacro(igtl::QuaternionTrackingDataElement, igtl::Object);
igtlNewMacro(igtl::QuaternionTrackingDataElement);
/// Tracking data type.
/// TYPE_TRACKER: Tracker
/// TYPE_6D: 6D instrument: (regular instrument)
/// TYPE_3D: 3D instrument (only tip of the instrument defined)
/// TYPE_5D: 5D instrument (tip and handle are defined, but not the normal vector)
enum {
TYPE_TRACKER = 1,
TYPE_6D = 2,
TYPE_3D = 3,
TYPE_5D = 4,
};
public:
/// Sets the name of the instrument/tracker.
int SetName(const char* name);
/// Gets the name of the instrument/tracker.
const char* GetName() { return this->m_Name.c_str(); };
/// Sets the type of the instrument/tracker.
int SetType(igtlUint8 type);
/// Gets the type of the instrument/tracker.
igtlUint8 GetType() { return this->m_Type; };
/// Sets the position by 3-element array of x, y, and z coordinates.
void SetPosition(float p[3]);
/// Gets the position. The function substitutes 3-element array of x, y and z coordinates in 'p'.
void GetPosition(float p[3]);
/// Sets the position by x, y, and z coordinates.
void SetPosition(float px, float py, float pz);
/// Gets the position. The function substitutes the xyz coordinates in 'px', 'py', and 'pz'.
void GetPosition(float* px, float* py, float* pz);
/// Sets the quaternion by 4-element array.
void SetQuaternion(float q[4]);
/// Gets the quaternion. The function substitutes the array of elements of the quaternion in 'q'.
void GetQuaternion(float q[4]);
/// Sets the quaternion by elements of the quaternion (x, y, z and w).
void SetQuaternion(float qx, float qy, float qz, float w);
/// Gets the quaternion. The function substitutes the elements of the quaternion in 'qx', 'qy', 'qz' and 'qw'.
void GetQuaternion(float* qx, float* qy, float* qz, float* w);
protected:
QuaternionTrackingDataElement();
~QuaternionTrackingDataElement();
protected:
/// Name / description (< 20 bytes)
std::string m_Name;
/// Tracking data type (TYPE_TRACKER, TYPE_6D, TYPE_3D, TYPE_5D)
igtlUint8 m_Type;
/// position (x, y, z)
igtlFloat32 m_position[3];
/// orientation as quaternion (qx, qy, qz, w)
igtlFloat32 m_quaternion[4];
};
/// A class for the STT_QTDATA message type.
class IGTLCommon_EXPORT StartQuaternionTrackingDataMessage: public MessageBase
{
public:
typedef StartQuaternionTrackingDataMessage Self;
typedef MessageBase Superclass;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
igtlTypeMacro(igtl::StartQuaternionTrackingDataMessage, igtl::MessageBase);
igtlNewMacro(igtl::StartQuaternionTrackingDataMessage);
public:
/// Sets the time resolution for streaming of QTDATA messages
void SetResolution(igtlInt32 res) { this->m_Resolution = res; }; // ms
/// Gets the time resolution for streaming of QTDATA messages
igtlInt32 GetResolution() { return this->m_Resolution; };
/// Sets the name of the coordinate system. The name must be defined by the user.
int SetCoordinateName(const char* name);
/// Gets the name of the coordinate system.
const char* GetCoordinateName() { return this->m_CoordinateName.c_str(); };
protected:
StartQuaternionTrackingDataMessage();
~StartQuaternionTrackingDataMessage();
protected:
virtual int GetBodyPackSize();
virtual int PackBody();
virtual int UnpackBody();
protected:
/// Minimum time between two frames (ms). Use 0 for as fast as possible.
igtlInt32 m_Resolution;
/// Name of the coordinate system
std::string m_CoordinateName;
};
class IGTLCommon_EXPORT StopQuaternionTrackingDataMessage: public MessageBase
{
public:
typedef StopQuaternionTrackingDataMessage Self;
typedef MessageBase Superclass;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
igtlTypeMacro(igtl::StopQuaternionTrackingDataMessage, igtl::MessageBase);
igtlNewMacro(igtl::StopQuaternionTrackingDataMessage);
protected:
StopQuaternionTrackingDataMessage() : MessageBase() { this->m_DefaultBodyType = "STP_QTDATA"; };
~StopQuaternionTrackingDataMessage() {};
protected:
virtual int GetBodyPackSize() { return 0; };
virtual int PackBody() { AllocatePack(); return 1; };
virtual int UnpackBody() { return 1; };
};
/// A class for the RTS_QTDATA message type.
class IGTLCommon_EXPORT RTSQuaternionTrackingDataMessage: public MessageBase
{
public:
typedef RTSQuaternionTrackingDataMessage Self;
typedef MessageBase Superclass;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
/// Status types
enum {
STATUS_SUCCESS = 0,
STATUS_ERROR = 1
};
igtlTypeMacro(igtl::RTSQuaternionTrackingDataMessage, igtl::MessageBase);
igtlNewMacro(igtl::RTSQuaternionTrackingDataMessage);
/// Sets the status. 'status' must be either STATUS_SUCCESS or STATUS_ERROR.
void SetStatus(igtlUint8 status){ this->m_Status = status; }
/// Gets the status. The function returns either STATUS_SUCCESS or STATUS_ERROR.
igtlUint8 GetStatus() { return this->m_Status; };
protected:
RTSQuaternionTrackingDataMessage() : MessageBase(), m_Status(0) { this->m_DefaultBodyType = "RTS_QTDATA"; };
~RTSQuaternionTrackingDataMessage() {};
/// A variable to store the status.
igtlUint8 m_Status;
protected:
virtual int GetBodyPackSize();
virtual int PackBody();
virtual int UnpackBody();
};
/// The QTDATA message type is intended for transferring 3D positions of surgical tools,
/// markers etc. Its role is almost identical to TDATA, except that QTDATA describes
/// orientation by using quaternion.
class IGTLCommon_EXPORT QuaternionTrackingDataMessage: public MessageBase
{
public:
typedef QuaternionTrackingDataMessage Self;
typedef MessageBase Superclass;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
igtlTypeMacro(igtl::QuaternionTrackingDataMessage, igtl::MessageBase);
igtlNewMacro(igtl::QuaternionTrackingDataMessage);
public:
/// Adds tracking data element.
int AddQuaternionTrackingDataElement(QuaternionTrackingDataElement::Pointer& elem);
/// Clears the all tracking data element in the list.
void ClearQuaternionTrackingDataElements();
/// Gets the number of tracking data elements in the list.
int GetNumberOfQuaternionTrackingDataElements();
/// Gets the tracking data element specified by 'index'.
void GetQuaternionTrackingDataElement(int index, QuaternionTrackingDataElement::Pointer& elem);
protected:
QuaternionTrackingDataMessage();
~QuaternionTrackingDataMessage();
protected:
virtual int GetBodyPackSize();
virtual int PackBody();
virtual int UnpackBody();
/// The list of trakcing data elements.
std::vector<QuaternionTrackingDataElement::Pointer> m_QuaternionTrackingDataList;
};
} // namespace igtl
#endif // _igtlQuaternionTrackingDataMessage_h
|