#include <igtlImageMessage2.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 ImageMessage2 | Self |
| typedef MessageBase | Superclass |
Static Public Member Functions | |
| static void | BreakOnError () |
| static Pointer | New () |
Public Attributes | |
| int | coordinate |
| int | dimensions [3] |
| int | endian |
| unsigned char * | m_Image |
| unsigned char * | m_ImageHeader |
| int | m_ImageSize |
| int | m_SelfAllocatedImage |
| int | m_SelfAllocatedImageHeader |
| unsigned char * | m_SinglePack |
| int | m_SinglePackSize |
| Matrix4x4 | matrix |
| int | numComponents |
| int | ScalarSizeTable [12] |
| int | scalarType |
| float | spacing [3] |
| int | subDimensions [3] |
| int | subOffset [3] |
Protected Member Functions | |
| virtual void | AllocateUnpack (int bodySizeToRead) |
| virtual int | CalculateContentBufferSize () |
| int | CopyBody (const MessageBase *mb) |
| int | CopyHeader (const MessageBase *mb) |
| ImageMessage2 () | |
| void | UnpackBody (int crccheck, int &r) |
| void | UnpackHeader (int &r) |
| ~ImageMessage2 () | |
Protected Attributes | |
| unsigned char * | m_Body |
| int | m_BodySizeToRead |
| unsigned char * | m_Content |
| std::string | m_DeviceName |
| unsigned char * | m_Header |
| unsigned short | m_HeaderVersion |
| bool | m_IsBodyPacked |
| bool | m_IsBodyUnpacked |
| bool | m_IsHeaderUnpacked |
| int | m_MessageSize |
| std::string | m_ReceiveMessageType |
| std::string | m_SendMessageType |
| unsigned int | m_TimeStampSec |
| unsigned int | m_TimeStampSecFraction |
| virtual void | PrintSelf (std::ostream &os) const |
| static void | SetGlobalWarningDisplay (bool flag) |
| static bool | GetGlobalWarningDisplay () |
| static void | GlobalWarningDisplayOn () |
| static void | GlobalWarningDisplayOff () |
| virtual void | PrintHeader (std::ostream &os) const |
| virtual void | PrintTrailer (std::ostream &os) const |
| volatile int | m_ReferenceCount |
| SimpleFastMutexLock | m_ReferenceCountLock |
A class for the IMAGE message type with support for fragmented packing. 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.
The difference between the ImageMessage and ImageMessage2 classes is that the ImageMessage2 class supports fragmented pack. Fragmeted pack allows allocating memory for each segment independently. The version 1 library assumes that the memory area for entire message pack is allocated at once, causing extra memory copies in some applications. (For example, copying image from source into the pack memory)
Definition at line 79 of file igtlImageMessage2.h.
Definition at line 85 of file igtlImageMessage2.h.
Definition at line 84 of file igtlImageMessage2.h.
Definition at line 82 of file igtlImageMessage2.h.
Definition at line 83 of file igtlImageMessage2.h.
Unpack status. They are returned by the Unpack() function.
| Enumerator | |
|---|---|
| UNPACK_UNDEF | |
| UNPACK_HEADER | |
| UNPACK_BODY | |
Definition at line 95 of file igtlMessageBase.h.
Coordinate system. Either left-posterior-superior (LPS) or right-anterior-superior (RAS).
| Enumerator | |
|---|---|
| COORDINATE_RAS | |
| COORDINATE_LPS | |
Definition at line 93 of file igtlImageMessage2.h.
Endian used in the bite array for the image data.
| Enumerator | |
|---|---|
| ENDIAN_BIG | |
| ENDIAN_LITTLE | |
Definition at line 99 of file igtlImageMessage2.h.
Pixel data type either scalar or vector.
| Enumerator | |
|---|---|
| DTYPE_SCALAR | |
| DTYPE_VECTOR | |
Definition at line 105 of file igtlImageMessage2.h.
Pixel data type.
| Enumerator | |
|---|---|
| TYPE_INT8 | |
| TYPE_UINT8 | |
| TYPE_INT16 | |
| TYPE_UINT16 | |
| TYPE_INT32 | |
| TYPE_UINT32 | |
| TYPE_FLOAT32 | |
| TYPE_FLOAT64 | |
Definition at line 111 of file igtlImageMessage2.h.
|
protected |
|
protected |
|
inherited |
AllocatePack() allocates memory for underlying buffer If m_BodySizeToRead > 0, we are allocating for receiving a message
Allocate memory specifying the body size (used when create a brank package to receive data) (for fragmented pack support)
Reimplemented from igtl::MessageBase.
|
inlineinherited |
Definition at line 242 of file igtlMessageBase.h.
Allocates a memory area for the scalar data based on the dimensions of the subvolume, the number of components, and the scalar type. Note: If FragmentedPack is active, GetScalarPointer() causes extra memory allocation to create a single pack memroy degrading the performance.
Allocates memory specifying the unpack content size Size of body to allocate is determined from v1 message header field 'body_size'
This method is called when igtlExceptionMacro executes. It allows the debugger to break on error.
Gets the size of the serialized content.
Reimplemented from igtl::MessageBase.
|
inherited |
Calculate the size of the received content data Returns -1 if the extended header has not been properly initialized (meta data size, meta data header size, etc...) Used when receiving data, not sending
|
virtualinherited |
Create a clone of this message, new memory but all internals are preserved.
|
inherited |
Copy() copies contents from the specified Massage class. If the type of the specified class is the same as this class, general header and body are copied.
|
protectedinherited |
Copies the serialized body data.
|
protectedinherited |
Copies a header from given message.
|
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.
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.
|
inherited |
GetBodySizeToRead() returns the size of the body to be read. This function must be called after the message header is set.
|
inherited |
Gets a pointer to the raw byte array for the serialized body data.
|
inherited |
Gets the size of the serialized body data.
| void * igtl::ImageMessage2::GetBufferPointer | ( | ) |
Gets a pointer to the scalar data (for fragmented pack support).
|
inherited |
Gets the size of the serialized message data.
|
inline |
Returns coordinate system (COORDINATE_RAS or COORDINATE_LPS)
Definition at line 261 of file igtlImageMessage2.h.
|
inherited |
Get the value of the debug flag.
|
inherited |
Gets the device name.
Gets image dimensions as the numbers of pixels in i, j and k directions.
Gets image dimensions as an array of the numbers of pixels in i, j and k directions.
|
inline |
Gets the Endianess of the image scalars.
Definition at line 250 of file igtlImageMessage2.h.
Gets the message version number.
|
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.
Definition at line 255 of file igtlImageMessage2.h.
|
inherited |
Gets the message type.
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.
Gets the orientation of the image using an array of the normal vectors for the i, j and k indeces.
Gets the orientation of the image using the normal vectors for the i, j and k indeces.
|
inline |
Gets the number of fragments for the packed (serialized) data. Returns 3 consisting of header, image header and image body. (for fragmented pack support)
Definition at line 293 of file igtlImageMessage2.h.
| int igtl::ImageMessage2::GetNumComponents | ( | ) |
Gets the number of components for each voxel.
Gets the coordinates of the origin by positions along the first (R or L), second (A or P) and the third (S) axes.
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.
|
inlineinherited |
Definition at line 218 of file igtlMessageBase.h.
|
inlineinherited |
Definition at line 226 of file igtlMessageBase.h.
Gets a pointer to the specified fragment of the packed data. (for fragmented pack support)
Gets the size of the specified fragment. (for fragmented pack support)
|
inlineinherited |
Definition at line 214 of file igtlMessageBase.h.
|
inlineinherited |
Definition at line 222 of file igtlMessageBase.h.
Gets the reference count on this object.
Definition at line 110 of file igtlLightObject.h.
|
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 241 of file igtlImageMessage2.h.
Gets the size of the specified scalar type. (e.g. 1 byte for 8-bit integer)
Definition at line 244 of file igtlImageMessage2.h.
|
inline |
Gets the image scalar type.
Definition at line 237 of file igtlImageMessage2.h.
Gets spacings using spacing values in i, j and k directions.
Gets spacings using an array of spacing values in i, j and k directions.
| void igtl::ImageMessage2::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.
Gets sub-volume dimensions and offset using arrays of the dimensions and the offset.
|
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 269 of file igtlImageMessage2.h.
|
inherited |
Gets time of message creation.
Gets time of message creation. 'sec' and 'frac' are seconds and fractions of a second respectively.
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.
Definition at line 116 of file igtlObject.h.
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.
Definition at line 114 of file igtlObject.h.
|
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 Only allocate the original 58 byte header
|
inlineinherited |
Definition at line 249 of file igtlMessageBase.h.
Method for creation through the object factory.
Pack() serializes the header and body based on the member variables. PackBody() must be implemented in the child class. (for fragmented pack support)
Reimplemented from igtl::MessageBase.
Packs (serialize) the content. Must be implemented in all child classes.
Reimplemented from igtl::MessageBase.
|
inherited |
Cause the object to print itself out.
Number of uses of this object by other objects.
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::ClientSocket, igtl::FastMutexLock, igtl::MultiThreader, igtl::MutexLock, igtl::ObjectFactoryBase, igtl::ServerSocket, igtl::Socket, and igtl::TimeStamp.
Number of uses of this object by other objects.
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.
Sets coordinate system (COORDINATE_RAS or COORDINATE_LPS)
Definition at line 264 of file igtlImageMessage2.h.
Set the value of the debug flag. A non-zero value turns debugging on.
Sets the device (message) type.
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.
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.
Sets the Endianess of the image scalars. (default is ENDIAN_BIG)
Definition at line 247 of file igtlImageMessage2.h.
This is a global flag that controls whether any debug, warning or error messages are displayed.
Sets the message version number.
|
virtualinherited |
Sets the message header.
Reimplemented in igtl::PositionMessage.
Sets the orientation of the image by an array of the normal vectors for the i, j and k indeces.
Sets the orientation of the image by the normal vectors for the i, j and k indeces.
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.
Sets the coordinates of the origin by positions along the first (R or L), second (A or P) and the third (S) axes.
Sets the reference count (use with care)
Reimplemented from igtl::LightObject.
Sets the pointer to the scalar data (for fragmented pack support).
Sets the image scalar type.
Definition at line 216 of file igtlImageMessage2.h.
|
inline |
Sets the image scalar type to 16-bit integer.
Definition at line 225 of file igtlImageMessage2.h.
|
inline |
Sets the image scalar type to 32-bit integer.
Definition at line 231 of file igtlImageMessage2.h.
|
inline |
Sets the image scalar type to 8-bit integer.
Definition at line 219 of file igtlImageMessage2.h.
|
inline |
Sets the image scalar type to unsigned 16-bit integer.
Definition at line 228 of file igtlImageMessage2.h.
|
inline |
Sets the image scalar type to unsigned 32-bit integer.
Definition at line 234 of file igtlImageMessage2.h.
|
inline |
Sets the image scalar type to unsigned 8-bit integer.
Definition at line 222 of file igtlImageMessage2.h.
Sets spacings by an array of spacing values in i, j and k directions.
Sets spacings by spacing values in i, j and k directions.
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::ImageMessage2::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.
Sets time of message creation. 'sec' and 'frac' are seconds and fractions of a second respectively.
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
Unpack the body If it's a v3 message, body is ext header + content + metadataheader + metadata<optional>
Unpacks (deserialize) the content. Must be implemented in all child classes.
Reimplemented from igtl::MessageBase.
Decrease the reference count (release by another object).
Reimplemented from igtl::LightObject.
| int igtl::ImageMessage2::coordinate |
A variable for the scalar type of the voxels.
Definition at line 355 of file igtlImageMessage2.h.
| int igtl::ImageMessage2::dimensions[3] |
A vector containing the numbers of voxels in i, j and k directions.
Definition at line 329 of file igtlImageMessage2.h.
| int igtl::ImageMessage2::endian |
A variable for the Endian of the scalar values in the image.
Definition at line 346 of file igtlImageMessage2.h.
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 concatenated to the byte array for the header.
Definition at line 308 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 315 of file igtlMessageBase.h.
A pointer to the underlying content of a message.
Definition at line 311 of file igtlMessageBase.h.
|
protectedinherited |
A character string for the device name (message name).
Definition at line 328 of file igtlMessageBase.h.
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 concatenated to the byte array for the body.
Definition at line 303 of file igtlMessageBase.h.
An unsigned short for the message format version.
Definition at line 325 of file igtlMessageBase.h.
A pointer to the serialized image data.
Definition at line 361 of file igtlImageMessage2.h.
A pointer to the serialized image header.
Definition at line 358 of file igtlImageMessage2.h.
| int igtl::ImageMessage2::m_ImageSize |
A variable for the memory size of this->m_Image (for backward compatibility with the conventional packing)
Definition at line 372 of file igtlImageMessage2.h.
|
protectedinherited |
Packing (serialization) status for the body.
Definition at line 345 of file igtlMessageBase.h.
|
protectedinherited |
Unpacking (deserialization) status for the body.
Definition at line 342 of file igtlMessageBase.h.
|
protectedinherited |
Unpacking (deserialization) status for the header.
Definition at line 339 of file igtlMessageBase.h.
|
protectedinherited |
Definition at line 298 of file igtlMessageBase.h.
|
protectedinherited |
A character string for the device type (message type). This will be used when the header is deserialized from a byte stream received from the network.
Definition at line 322 of file igtlMessageBase.h.
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.
| int igtl::ImageMessage2::m_SelfAllocatedImage |
A flag for the fragmented image pack (allocated by this class).
Definition at line 375 of file igtlImageMessage2.h.
| int igtl::ImageMessage2::m_SelfAllocatedImageHeader |
A flag for the fragmented image pack (allocated by this class).
Definition at line 378 of file igtlImageMessage2.h.
|
protectedinherited |
A character string for the send device type (message type).
Definition at line 318 of file igtlMessageBase.h.
A pointer to the serialized data (for backward compatibility with the conventional packing)
Definition at line 365 of file igtlImageMessage2.h.
| int igtl::ImageMessage2::m_SinglePackSize |
A variable for the memory size of this->m_SinglePack (for backward compatibility with the conventional packing)
Definition at line 369 of file igtlImageMessage2.h.
A time stamp (second) for message creation. It consists of fields for seconds (m_TimeStampSec)and fractions of a second (m_TimeStampSecFraction).
Definition at line 332 of file igtlMessageBase.h.
A time stamp (second) for message creation. It consists of fields for seconds (m_TimeStampSec)and fractions of a second (m_TimeStampSecFraction).
Definition at line 336 of file igtlMessageBase.h.
| Matrix4x4 igtl::ImageMessage2::matrix |
A matrix representing the origin and the orientation of the image. The matrix is set to identity by default
Definition at line 343 of file igtlImageMessage2.h.
| int igtl::ImageMessage2::numComponents |
A variable for the number of components.
Definition at line 349 of file igtlImageMessage2.h.
| int igtl::ImageMessage2::ScalarSizeTable[12] |
A table to look up the size of a given scalar type.
Definition at line 383 of file igtlImageMessage2.h.
| int igtl::ImageMessage2::scalarType |
A variable for the scalar type of the voxels.
Definition at line 352 of file igtlImageMessage2.h.
| float igtl::ImageMessage2::spacing[3] |
A vector containing the spacings of the voxels in i, j and k directions.
Definition at line 332 of file igtlImageMessage2.h.
| int igtl::ImageMessage2::subDimensions[3] |
A vector containing the numbers of voxels of the subvolume in i, j and k directions.
Definition at line 335 of file igtlImageMessage2.h.
| int igtl::ImageMessage2::subOffset[3] |
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 339 of file igtlImageMessage2.h.