#include <igtlImageMessage.h>
Public Types | |
enum | { UNPACK_UNDEF = 0x0000, UNPACK_HEADER = 0x0001, UNPACK_BODY = 0x0002 } |
enum | { COORDINATE_RAS =1, COORDINATE_LPS =2 } |
enum | { ENDIAN_BIG =1, ENDIAN_LITTLE =2 } |
enum | { DTYPE_SCALAR = 1, DTYPE_VECTOR = 3 } |
enum | { TYPE_INT8 = 2, TYPE_UINT8 = 3, TYPE_INT16 = 4, TYPE_UINT16 = 5, TYPE_INT32 = 6, TYPE_UINT32 = 7, TYPE_FLOAT32 = 10, TYPE_FLOAT64 = 11 } |
typedef SmartPointer< const Self > | ConstPointer |
typedef SmartPointer< Self > | Pointer |
typedef ImageMessage | Self |
typedef MessageBase | Superclass |
Public Member Functions | |
void | AllocatePack () |
void | AllocateScalars () |
int | Copy (const MessageBase *mb) |
virtual LightObject::Pointer | CreateAnother () const |
virtual void | DebugOff () const |
virtual void | DebugOn () const |
virtual void | Delete () |
int | GetBodySizeToRead () |
const char * | GetBodyType () |
int | GetCoordinateSystem () |
bool | GetDebug () const |
const char * | GetDeviceName () |
const char * | GetDeviceType () |
void | GetDimensions (int s[3]) |
void | GetDimensions (int &i, int &j, int &k) |
int | GetEndian () |
int | GetImageSize () |
void | GetMatrix (Matrix4x4 &mat) |
virtual const char * | GetNameOfClass () const |
void | GetNormals (float o[3][3]) |
void | GetNormals (float t[3], float s[3], float n[3]) |
int | GetNumComponents () |
void | GetOrigin (float p[3]) |
void | GetOrigin (float &px, float &py, float &pz) |
void * | GetPackBodyPointer () |
int | GetPackBodySize () |
void * | GetPackPointer () |
int | GetPackSize () |
virtual int | GetReferenceCount () const |
void * | GetScalarPointer () |
int | GetScalarSize () |
int | GetScalarSize (int type) |
int | GetScalarType () |
void | GetSpacing (float s[3]) |
void | GetSpacing (float &si, float &sj, float &sk) |
void | GetSubVolume (int dim[3], int off[3]) |
void | GetSubVolume (int &dimi, int &dimj, int &dimk, int &offi, int &offj, int &offk) |
int | GetSubVolumeImageSize () |
int | GetTimeStamp (unsigned int *sec, unsigned int *frac) |
void | GetTimeStamp (igtl::TimeStamp::Pointer &ts) |
igtlTypeMacro (Object, LightObject) | |
void | InitPack () |
virtual int | Pack () |
void | Print (std::ostream &os) const |
virtual void | Register () const |
void | SetCoordinateSystem (int c) |
void | SetDebug (bool debugFlag) const |
void | SetDeviceName (const char *name) |
void | SetDimensions (int s[3]) |
void | SetDimensions (int i, int j, int k) |
void | SetEndian (int e) |
void | SetMatrix (Matrix4x4 &mat) |
virtual int | SetMessageHeader (const MessageHeader *mb) |
void | SetNormals (float o[3][3]) |
void | SetNormals (float t[3], float s[3], float n[3]) |
void | SetNumComponents (int num) |
void | SetOrigin (float p[3]) |
void | SetOrigin (float px, float py, float pz) |
virtual void | SetReferenceCount (int) |
void | SetScalarType (int t) |
void | SetScalarTypeToInt16 () |
void | SetScalarTypeToInt32 () |
void | SetScalarTypeToInt8 () |
void | SetScalarTypeToUint16 () |
void | SetScalarTypeToUint32 () |
void | SetScalarTypeToUint8 () |
void | SetSpacing (float s[3]) |
void | SetSpacing (float si, float sj, float sk) |
int | SetSubVolume (int dim[3], int off[3]) |
int | SetSubVolume (int dimi, int dimj, int dimk, int offi, int offj, int offk) |
int | SetTimeStamp (unsigned int sec, unsigned int frac) |
void | SetTimeStamp (igtl::TimeStamp::Pointer &ts) |
int | Unpack (int crccheck=0) |
virtual void | UnRegister () const |
Static Public Member Functions | |
static void | BreakOnError () |
static Pointer | New () |
static void | SetGlobalWarningDisplay (bool flag) |
static bool | GetGlobalWarningDisplay () |
static void | GlobalWarningDisplayOn () |
static void | GlobalWarningDisplayOff () |
Protected Member Functions | |
virtual void | AllocatePack (int bodySize) |
int | CopyBody (const MessageBase *mb) |
int | CopyHeader (const MessageBase *mb) |
virtual int | GetBodyPackSize () |
ImageMessage () | |
virtual int | PackBody () |
virtual void | PrintSelf (std::ostream &os) const |
virtual int | UnpackBody () |
~ImageMessage () | |
virtual void | PrintHeader (std::ostream &os) const |
virtual void | PrintTrailer (std::ostream &os) const |
Protected Attributes | |
int | coordinate |
int | dimensions [3] |
int | endian |
unsigned char * | m_Body |
int | m_BodySizeToRead |
std::string | m_BodyType |
std::string | m_DefaultBodyType |
std::string | m_DeviceName |
unsigned char * | m_Header |
unsigned char * | m_Image |
unsigned char * | m_ImageHeader |
int | m_IsBodyUnpacked |
int | m_IsHeaderUnpacked |
int | m_PackSize |
volatile int | m_ReferenceCount |
SimpleFastMutexLock | m_ReferenceCountLock |
unsigned int | m_TimeStampSec |
unsigned int | m_TimeStampSecFraction |
Matrix4x4 | matrix |
int | numComponents |
int | ScalarSizeTable [12] |
int | scalarType |
float | spacing [3] |
int | subDimensions [3] |
int | subOffset [3] |
A class for the IMAGE message type. The IMAGE format supports 2D or 3D images with metric information including image matrix size, voxel size, coordinate system type, position, and orientation. The body section of the IMAGE data consists of two parts: image header to transfer the metric information and image body to transfer the array of pixel or voxel values. The data type of pixel or voxel can be either scalar or vector, and numerical values can be 8-, 16-, 32-bit integer, or 32- or 64-bit floating point. The pixel values can be either big-endian or little-endian, since the sender software can specify the byte order in the image header. The format also supports "partial image transfer", in which a region of the image is transferred instead of the whole image. This mechanism is suitable for real-time applications, in which images are updated region-by-region. The sub-volume must be box-shaped and defined by 6 parameters consisting of the indices for the corner voxel of the sub-volume and matrix size of the sub-volume.
Definition at line 59 of file igtlImageMessage.h.
typedef SmartPointer<const Self> igtl::ImageMessage::ConstPointer |
Definition at line 65 of file igtlImageMessage.h.
typedef SmartPointer<Self> igtl::ImageMessage::Pointer |
Definition at line 64 of file igtlImageMessage.h.
typedef ImageMessage igtl::ImageMessage::Self |
Definition at line 62 of file igtlImageMessage.h.
Definition at line 63 of file igtlImageMessage.h.
|
inherited |
Unpack status. They are returned by the Unpack() function.
Enumerator | |
---|---|
UNPACK_UNDEF | |
UNPACK_HEADER | |
UNPACK_BODY |
Definition at line 68 of file igtlMessageBase.h.
anonymous enum |
Coordinate sysmtem. Either left-posterior-superior (LPS) or right-anterior-superior (RAS).
Enumerator | |
---|---|
COORDINATE_RAS | |
COORDINATE_LPS |
Definition at line 73 of file igtlImageMessage.h.
anonymous enum |
Endian used in the bite array for the image data.
Enumerator | |
---|---|
ENDIAN_BIG | |
ENDIAN_LITTLE |
Definition at line 79 of file igtlImageMessage.h.
anonymous enum |
Pixel data type either scalar or vector.
Enumerator | |
---|---|
DTYPE_SCALAR | |
DTYPE_VECTOR |
Definition at line 85 of file igtlImageMessage.h.
anonymous enum |
Pixel data type.
Enumerator | |
---|---|
TYPE_INT8 | |
TYPE_UINT8 | |
TYPE_INT16 | |
TYPE_UINT16 | |
TYPE_INT32 | |
TYPE_UINT32 | |
TYPE_FLOAT32 | |
TYPE_FLOAT64 |
Definition at line 91 of file igtlImageMessage.h.
|
protected |
|
protected |
|
inherited |
AllocatePack() allocates memory for packing / receiving buffer.
|
protectedvirtualinherited |
Allocates memory specifying the body size. This function is used when creating a brank package to receive data)
Reimplemented in igtl::ImageMessage2.
void igtl::ImageMessage::AllocateScalars | ( | ) |
Allocates a memory area for the scalar data based on the dimensions of the subvolume, the number of components, and the scalar type.
|
staticinherited |
This method is called when igtlExceptionMacro executes. It allows the debugger to break on error.
|
inherited |
Copy() copies contents from the specified Massage class. If the type of the specified class is the same as this class, both general header and body are copied. Otherwise, only general header is copied.
|
protectedinherited |
Copies the serialized body data.
|
protectedinherited |
Copies a header from.
|
virtualinherited |
Create an object from an instance, potentially deferring to a factory. This method allows you to create an instance of an object that is exactly the same type as the referring object. This is useful in cases where an object has been cast back to a base class.
Reimplemented from igtl::LightObject.
|
virtualinherited |
Turn debugging output off.
|
virtualinherited |
Turn debugging output on.
|
virtualinherited |
Delete an igtl object. This method should always be used to delete an object when the new operator was used to create it. Using the C delete method will not work with reference counting.
|
protectedvirtual |
Gets the size of the serialized body.
Reimplemented from igtl::MessageBase.
|
inlineinherited |
GetBodySizeToRead() returns the size of the body to be read. This function must be called after the message header is set.
Definition at line 151 of file igtlMessageBase.h.
|
inlineinherited |
GetBodyType() gets the type of the body.
Definition at line 130 of file igtlMessageBase.h.
|
inline |
Returns coordinate system (COORDINATE_RAS or COORDINATE_LPS)
Definition at line 241 of file igtlImageMessage.h.
|
inherited |
Get the value of the debug flag.
|
inherited |
Gets the device (message) name.
|
inherited |
Gets the device (message) type.
void igtl::ImageMessage::GetDimensions | ( | int | s[3] | ) |
Gets image dimensions as an array of the numbers of pixels in i, j and k directions.
void igtl::ImageMessage::GetDimensions | ( | int & | i, |
int & | j, | ||
int & | k | ||
) |
Gets image dimensions as the numbers of pixels in i, j and k directions.
|
inline |
Gets the Endianess of the image scalars.
Definition at line 230 of file igtlImageMessage.h.
|
staticinherited |
This is a global flag that controls whether any debug, warning or error messages are displayed.
|
inline |
Gets the size (length) of the byte array for the image data. The size is defined by dimensions[0]*dimensions[1]*dimensions[2]*scalarSize*numComponents. TODO: Should returned value be 64-bit integer?
Definition at line 235 of file igtlImageMessage.h.
void igtl::ImageMessage::GetMatrix | ( | Matrix4x4 & | mat | ) |
Gets the origin/orientation matrix.
|
inlinevirtualinherited |
Return the name of this class as a string. Used by the object factory (implemented in New()) to instantiate objects of a named type. Also used for debugging and other output information.
Definition at line 84 of file igtlLightObject.h.
void igtl::ImageMessage::GetNormals | ( | float | o[3][3] | ) |
Gets the orientation of the image using an array of the normal vectors for the i, j and k indeces.
void igtl::ImageMessage::GetNormals | ( | float | t[3], |
float | s[3], | ||
float | n[3] | ||
) |
Gets the orientation of the image using the normal vectors for the i, j and k indeces.
int igtl::ImageMessage::GetNumComponents | ( | ) |
Gets the number of components for each voxel.
void igtl::ImageMessage::GetOrigin | ( | float | p[3] | ) |
Gets the coordinates of the origin using an array of positions along the first (R or L), second (A or P) and the third (S) axes.
void igtl::ImageMessage::GetOrigin | ( | float & | px, |
float & | py, | ||
float & | pz | ||
) |
Gets the coordinates of the origin by positions along the first (R or L), second (A or P) and the third (S) axes.
|
inherited |
Gets a pointer to the raw byte array for the serialized body data.
|
inherited |
Gets the size of the serialized body data.
|
inherited |
Gets a pointer to the raw byte array for the serialized data including the header and the body.
|
inherited |
Gets the size of the serialized data.
|
inlinevirtualinherited |
Gets the reference count on this object.
Definition at line 110 of file igtlLightObject.h.
void* igtl::ImageMessage::GetScalarPointer | ( | ) |
Gets a pointer to the scalar data.
|
inline |
Gets the size of the scalar type used in the current image data. (e.g. 1 byte for 8-bit integer)
Definition at line 221 of file igtlImageMessage.h.
|
inline |
Gets the size of the specified scalar type. (e.g. 1 byte for 8-bit integer)
Definition at line 224 of file igtlImageMessage.h.
|
inline |
Gets the image scalar type.
Definition at line 217 of file igtlImageMessage.h.
void igtl::ImageMessage::GetSpacing | ( | float | s[3] | ) |
Gets spacings using an array of spacing values in i, j and k directions.
void igtl::ImageMessage::GetSpacing | ( | float & | si, |
float & | sj, | ||
float & | sk | ||
) |
Gets spacings using spacing values in i, j and k directions.
void igtl::ImageMessage::GetSubVolume | ( | int | dim[3], |
int | off[3] | ||
) |
Gets sub-volume dimensions and offset using arrays of the dimensions and the offset.
void igtl::ImageMessage::GetSubVolume | ( | int & | dimi, |
int & | dimj, | ||
int & | dimk, | ||
int & | offi, | ||
int & | offj, | ||
int & | offk | ||
) |
Gets sub-volume dimensions and offset by the dimensions and the offset in i, j and k directions.
|
inline |
Gets the size (length) of the byte array for the subvolume image data. The size is defined by subDimensions[0]*subDimensions[1]*subDimensions[2]* scalarSize*numComponents.
Definition at line 250 of file igtlImageMessage.h.
|
inherited |
Gets time of message creation. 'sec' and 'frac' are seconds and fractions of a second respectively.
|
inherited |
Gets time of message creation.
|
inlinestaticinherited |
This is a global flag that controls whether any debug, warning or error messages are displayed.
Definition at line 116 of file igtlObject.h.
References igtl::Object::SetGlobalWarningDisplay().
|
inlinestaticinherited |
This is a global flag that controls whether any debug, warning or error messages are displayed.
Definition at line 114 of file igtlObject.h.
References igtl::Object::SetGlobalWarningDisplay().
|
inherited |
Standard part of all igtl objects.
|
inherited |
Call InitPack() before receive header. This function simply resets the Unpacked flag for both the header and body pack.
|
staticinherited |
Method for creation through the object factory.
|
virtualinherited |
Pack() serializes the header and body based on the member variables. PackBody() must be implemented in the child class.
Reimplemented in igtl::ImageMessage2.
|
protectedvirtual |
Packs (serialize) the body. Must be implemented in a child class.
Reimplemented from igtl::MessageBase.
|
inherited |
Cause the object to print itself out.
|
protectedvirtualinherited |
|
protectedvirtualinherited |
Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.
Reimplemented from igtl::LightObject.
Reimplemented in igtl::MultiThreader, igtl::MutexLock, igtl::ObjectFactoryBase, igtl::Socket, igtl::FastMutexLock, igtl::TimeStamp, igtl::ServerSocket, and igtl::ClientSocket.
|
protectedvirtualinherited |
|
virtualinherited |
Return this objects modified time. Update the modification time for this object. Many filters rely on the modification time to determine if they need to recompute their data. Increase the reference count (mark as used by another object).
Reimplemented from igtl::LightObject.
|
inline |
Sets coordinate system (COORDINATE_RAS or COORDINATE_LPS)
Definition at line 244 of file igtlImageMessage.h.
|
inherited |
Set the value of the debug flag. A non-zero value turns debugging on.
|
inherited |
Sets the device (message) name.
void igtl::ImageMessage::SetDimensions | ( | int | s[3] | ) |
Sets image dimensions by an array of the numbers of pixels in i, j and k directions. SetDimensions() should be called prior to SetSubVolume(), since SetDimensions() sets subvolume parameters automatically assuming that subvolume = entire volume.
void igtl::ImageMessage::SetDimensions | ( | int | i, |
int | j, | ||
int | k | ||
) |
Sets image dimensions by the numbers of pixels in i, j and k directions. SetDimensions() should be called prior to SetSubVolume(), since SetDimensions() sets subvolume parameters automatically assuming that subvolume = entire volume.
|
inline |
Sets the Endianess of the image scalars. (default is ENDIAN_BIG)
Definition at line 227 of file igtlImageMessage.h.
|
staticinherited |
This is a global flag that controls whether any debug, warning or error messages are displayed.
Referenced by igtl::Object::GlobalWarningDisplayOff(), and igtl::Object::GlobalWarningDisplayOn().
void igtl::ImageMessage::SetMatrix | ( | Matrix4x4 & | mat | ) |
Sets the origin/orientation matrix.
|
inlinevirtualinherited |
Sets the message header.
Reimplemented in igtl::PositionMessage.
Definition at line 147 of file igtlMessageBase.h.
void igtl::ImageMessage::SetNormals | ( | float | o[3][3] | ) |
Sets the orientation of the image by an array of the normal vectors for the i, j and k indeces.
void igtl::ImageMessage::SetNormals | ( | float | t[3], |
float | s[3], | ||
float | n[3] | ||
) |
Sets the orientation of the image by the normal vectors for the i, j and k indeces.
void igtl::ImageMessage::SetNumComponents | ( | int | num | ) |
Sets the number of components for each voxel.
void igtl::ImageMessage::SetOrigin | ( | float | p[3] | ) |
Sets the coordinates of the origin by an array of positions along the first (R or L), second (A or P) and the third (S) axes.
void igtl::ImageMessage::SetOrigin | ( | float | px, |
float | py, | ||
float | pz | ||
) |
Sets the coordinates of the origin by positions along the first (R or L), second (A or P) and the third (S) axes.
|
virtualinherited |
Sets the reference count (use with care)
Reimplemented from igtl::LightObject.
|
inline |
Sets the image scalar type.
Definition at line 196 of file igtlImageMessage.h.
|
inline |
Sets the image scalar type to 16-bit integer.
Definition at line 205 of file igtlImageMessage.h.
|
inline |
Sets the image scalar type to 32-bit integer.
Definition at line 211 of file igtlImageMessage.h.
|
inline |
Sets the image scalar type to 8-bit integer.
Definition at line 199 of file igtlImageMessage.h.
|
inline |
Sets the image scalar type to unsigned 16-bit integer.
Definition at line 208 of file igtlImageMessage.h.
|
inline |
Sets the image scalar type to unsigned 32-bit integer.
Definition at line 214 of file igtlImageMessage.h.
|
inline |
Sets the image scalar type to unsigned 8-bit integer.
Definition at line 202 of file igtlImageMessage.h.
void igtl::ImageMessage::SetSpacing | ( | float | s[3] | ) |
Sets spacings by an array of spacing values in i, j and k directions.
void igtl::ImageMessage::SetSpacing | ( | float | si, |
float | sj, | ||
float | sk | ||
) |
Sets spacings by spacing values in i, j and k directions.
int igtl::ImageMessage::SetSubVolume | ( | int | dim[3], |
int | off[3] | ||
) |
Sets sub-volume dimensions and offset by arrays of the dimensions and the offset. SetSubVolume() should be called after calling SetDiemensions(), since SetDimensions() reset the subvolume parameters automatically. Returns non-zero value if the subvolume is successfully specified. Returns zero, if invalid subvolume is specified.
int igtl::ImageMessage::SetSubVolume | ( | int | dimi, |
int | dimj, | ||
int | dimk, | ||
int | offi, | ||
int | offj, | ||
int | offk | ||
) |
Sets sub-volume dimensions and offset by the dimensions and the offset in i, j and k directions. SetSubVolume() should be called after calling SetDiemensions(), since SetDimensions() reset the subvolume parameters automatically. Returns non-zero value if the subvolume is successfully specified. Returns zero, if invalid subvolume is specified.
|
inherited |
Sets time of message creation. 'sec' and 'frac' are seconds and fractions of a second respectively.
|
inherited |
Sets time of message creation.
|
inherited |
Unpack() deserializes the header and/or body, extracting data from the byte stream. If the header has already been deserilized, Unpack() deserializes only the body part. UnpackBody() must be implemented to deserialize the body part. Unpack() performs 64-bit CRC check, when crccheck = 1. It returns:
UNPACK_UNDEF : Nothing deserialized UNPACK_HEADER : The header has been deserialized. UNPACK_BODY : The body has been deserialized. If CRC check fails, Unpack() doesn't deserialize the body, thus it doesn't return UNPACK_BODY flag. UNPACK_HEADER|UNPACK_BODY: Both the header and body have been deserialized
|
protectedvirtual |
Unpacks (deserialize) the body. Must be implemented in a child class.
Reimplemented from igtl::MessageBase.
|
virtualinherited |
Decrease the reference count (release by another object).
Reimplemented from igtl::LightObject.
|
protected |
A variable for the scalar type of the voxels.
Definition at line 299 of file igtlImageMessage.h.
|
protected |
A vector containing the numbers of voxels in i, j and k directions.
Definition at line 273 of file igtlImageMessage.h.
|
protected |
A variable for the Endian of the scalar values in the image.
Definition at line 290 of file igtlImageMessage.h.
|
protectedinherited |
A pointer to the byte array for the serialized body. To prevent large copy of the byte array in the Pack() function, header byte array is concatinated to the byte array for the header.
Definition at line 187 of file igtlMessageBase.h.
|
protectedinherited |
The size of the body to be read. This function must be called after the message header is set.
Definition at line 191 of file igtlMessageBase.h.
|
protectedinherited |
A character string for the device type (message type). This will be used when the header is desrialized from a byte stream received from the network.
Definition at line 198 of file igtlMessageBase.h.
|
protectedinherited |
A character string for the default device type (message type).
Definition at line 194 of file igtlMessageBase.h.
|
protectedinherited |
A character string for the device name (message name).
Definition at line 201 of file igtlMessageBase.h.
|
protectedinherited |
A pointer to the byte array for the serialized header. To prevent large copy of the byte array in the Pack() function, header byte array is concatinated to the byte array for the body.
Definition at line 182 of file igtlMessageBase.h.
|
protected |
A pointer to the serialized image data.
Definition at line 305 of file igtlImageMessage.h.
|
protected |
A pointer to the serialized image header.
Definition at line 302 of file igtlImageMessage.h.
|
protectedinherited |
Unpacking (desrialization) status for the body (0: – 1: unpacked).
Definition at line 215 of file igtlMessageBase.h.
|
protectedinherited |
Unpacking (desrialization) status for the header (0: – 1: unpacked).
Definition at line 212 of file igtlMessageBase.h.
|
protectedinherited |
Definition at line 177 of file igtlMessageBase.h.
|
mutableprotectedinherited |
Number of uses of this object by other objects.
Definition at line 131 of file igtlLightObject.h.
|
mutableprotectedinherited |
Mutex lock to protect modification to the reference count
Definition at line 134 of file igtlLightObject.h.
|
protectedinherited |
A time stamp (second) for message creation. It consists of fields for seconds (m_TimeStampSec)and franctions of a second (m_TimeStampSecFraction).
Definition at line 205 of file igtlMessageBase.h.
|
protectedinherited |
A time stamp (second) for message creation. It consists of fields for seconds (m_TimeStampSec)and franctions of a second (m_TimeStampSecFraction).
Definition at line 209 of file igtlMessageBase.h.
|
protected |
A matrix representing the origin and the orientation of the image. The matrix is set to identity by default
Definition at line 287 of file igtlImageMessage.h.
|
protected |
A variable for the number of components.
Definition at line 293 of file igtlImageMessage.h.
|
protected |
A table to look up the size of a given scalar type.
Definition at line 308 of file igtlImageMessage.h.
|
protected |
A variable for the scalar type of the voxels.
Definition at line 296 of file igtlImageMessage.h.
|
protected |
A vector containing the spacings of the voxels in i, j and k directions.
Definition at line 276 of file igtlImageMessage.h.
|
protected |
A vector containing the numbers of voxels of the subvolume in i, j and k directions.
Definition at line 279 of file igtlImageMessage.h.
|
protected |
A vector containing the offset (number of voxels) of the first voxel of the subvolume from the first voxel of the original image.
Definition at line 283 of file igtlImageMessage.h.