15#ifndef __igtlNDArrayMessage_h
16#define __igtlNDArrayMessage_h
25#define IGTL_STRING_MESSAGE_DEFAULT_ENCODING 3
93 if (Get1DIndex(index) <= GetNumberOfElements()) {
94 T* ByteArray = (T*)GetRawArray();
95 ByteArray[Get1DIndex(index) *
sizeof(T)] = value;
105 if (Get1DIndex(index) <= GetNumberOfElements()) {
106 T* ByteArray = (T*)GetRawArray();
107 value = ByteArray[Get1DIndex(index) *
sizeof(T)];
virtual int GetElementSize()=0
Gets the size of a element of the array.
igtlUint32 GetNumberOfElements()
Gets the number of elements in the array.
std::vector< igtlUint16 > IndexType
Vector type for an index of N-D array.
IndexType GetSize()
Gets the size of the N-D array.
int SetSize(IndexType size)
Sets the size of the N-D array. Returns non-zero value, if success.
void * GetRawArray()
Gets the raw byte array stored in the class.
int GetDimension()
Gets the dimension of the N-D array.
int SetArray(void *array)
igtlUint64 GetRawArraySize()
Gets the size of the raw byte array stored in the class.
igtlUint32 Get1DIndex(IndexType index)
int SetValue(IndexType index, T value)
Sets a value of the element specified by 'index'.
virtual int GetElementSize()
Gets the size of elements (e.g. 1 byte in case of 8-bit integer)
int GetValue(IndexType index, T &value)
Gets a value of the element specified by 'index'.
int SetArray(int type, ArrayBase *a)
Sets an array with an element type.
int m_Type
A variable for the type of the N-D array.
ArrayBase * GetArray()
Gets a pointer to the array.
SmartPointer< Self > Pointer
ArrayBase * m_Array
A pointer to the N-D array.
virtual int GetBodyPackSize()
Gets the size of the serialized body.
igtlNewMacro(igtl::NDArrayMessage)
int GetType()
Gets the type of elements of the array. (e.g. TYPE_INT8)
virtual int UnpackBody()
Unpacks (deserialize) the body. Must be implemented in a child class.
virtual int PackBody()
Packs (serialize) the body. Must be implemented in a child class.
igtlTypeMacro(igtl::NDArrayMessage, igtl::MessageBase)
SmartPointer< const Self > ConstPointer
Implements transparent reference counting.
The "igtl" namespace contains all OpenIGTLink classes. There are several nested namespaces within the...