Package org.medcare.igtl.messages
Class ImageMessage
java.lang.Object
org.medcare.igtl.messages.OpenIGTMessage
org.medcare.igtl.messages.ImageMessage
** This class create an Image object from bytes received or help to generate
bytes to send from it
-
Field Summary
Modifier and TypeFieldDescriptionstatic int
static int
static int
static int
static int
static int
static int
static int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
Fields inherited from class org.medcare.igtl.messages.OpenIGTMessage
bytesArray, deviceName, VERSION
-
Constructor Summary
ConstructorDescriptionImageMessage
(String deviceName) ** Constructor to be used to create message to send them with this constructor you must use method SetImageHeader, then CreateBody and then getBytes to send them **ImageMessage
(Header header, byte[] body) ** Constructor to be used to create message from received data -
Method Summary
Modifier and TypeMethodDescriptionlong[]
** To get Image dimensions **long
** To get Image Endian of image scalar **byte[]
** To get image_data byte array **int
byte[]
** To get image_header byte array **long
** To get Image Size **long
** To get Image image type **double[][]
** To get Image matrix **double[][]
** To get Image normals **double[]
** To get Image origin **long
** To get Image scalar type **double[]
** To get Image spacing **long[]
** To get SubVolume dimensions **long[]
** To get SubVolume offset **long
** To get SubVolume Size **byte[]
packBody()
** To create body from image_header and image_data SetImageHeader and SetImageData must have called firstvoid
setDimensions
(long[] dimensions) ** To set Image dimensionsvoid
setDimensions
(long i, long j, long k) ** To set Image dimensionsvoid
setEndian
(long endian) ** To set Image Endian of image scalar (default is ENDIAN_BIG)void
setImageData
(byte[] image_data) ** To Set image_data byte array **void
setImageHeader
(byte[] image_header) ** To extract image characteristics from image_header byte arraybyte[]
setImageHeader
(long[] dimensions, double[] origin, double[][] normals, long[] subOffset, long[] subDimensions) ** To create image_header from image carateristics and to get the byte array to sendbyte[]
setImageHeader
(long version, long imageType, long scalarType, long endian, long coordinate_type, long[] dimensions, double[] origin, double[][] normals, long[] subOffset, long[] subDimensions) ** To create image_header from image carateristics and to get the byte array to sendvoid
setImageType
(long imageType) ** To set Image image typevoid
setMatrix
(double[][] matrix) ** To set Image matrixvoid
setMatrix
(double[] origin, double[][] normals) ** To set Image matrixvoid
setMatrix
(double[] spacing, double[] origin, double[] norm_i, double[] norm_j, double[] norm_k) ** To set Image matrixvoid
setOrigin
(double[] origin) ** To set Image originvoid
setOrigin
(double px, double py, double pz) ** To set Image originvoid
setScalarType
(long scalarType) ** To set Image scalar typevoid
** To set Image scalar type to Int16 **void
** To set Image scalar type to Int32 **void
** To set Image scalar type to Int8 **void
** To set Image scalar type to Uint16 **void
** To set Image scalar type to Uint32 **void
** To set Image scalar type to Uint8 **void
setSpacing
(double[] spacing) ** To set Image spacingvoid
setSpacing
(float si, float sj, float sk) ** To set Image spacingboolean
setSubVolume
(int dimi, int dimj, int dimk, int offi, int offj, int offk) ** To set Image dimensionsboolean
setSubVolume
(long[] subDimensions, long[] subOffset) ** To set Image dimensionstoString()
** To get image String **boolean
** To create body from body arrayMethods inherited from class org.medcare.igtl.messages.OpenIGTMessage
getBody, getBytes, getDeviceName, getHeader, setBody, setHeader, Unpack
-
Field Details
-
TYPE_INT8
public static final int TYPE_INT8- See Also:
-
TYPE_UINT8
public static final int TYPE_UINT8- See Also:
-
TYPE_INT16
public static final int TYPE_INT16- See Also:
-
TYPE_UINT16
public static final int TYPE_UINT16- See Also:
-
TYPE_INT32
public static final int TYPE_INT32- See Also:
-
TYPE_UINT32
public static final int TYPE_UINT32- See Also:
-
TYPE_FLOAT32
public static final int TYPE_FLOAT32- See Also:
-
TYPE_FLOAT64
public static final int TYPE_FLOAT64- See Also:
-
IGTL_IMAGE_HEADER_SIZE
public static int IGTL_IMAGE_HEADER_SIZE -
IGTL_IMAGE_HEADER_VERSION
public static int IGTL_IMAGE_HEADER_VERSION -
COORDINATE_LPS
public static int COORDINATE_LPS -
COORDINATE_RAS
public static int COORDINATE_RAS -
ENDIAN_BIG
public static int ENDIAN_BIG -
ENDIAN_LITTLE
public static int ENDIAN_LITTLE -
DTYPE_SCALAR
public static int DTYPE_SCALAR -
DTYPE_VECTOR
public static int DTYPE_VECTOR
-
-
Constructor Details
-
ImageMessage
** Constructor to be used to create message to send them with this constructor you must use method SetImageHeader, then CreateBody and then getBytes to send them **- Parameters:
deviceName
- Device Name
-
ImageMessage
** Constructor to be used to create message from received data- Parameters:
header
-body
-- Throws:
Exception
-
-
Method Details
-
unpackBody
** To create body from body array**
- Specified by:
unpackBody
in classOpenIGTMessage
- Returns:
- true if unpacking is ok
- Throws:
Exception
-
getImageDataSize
public int getImageDataSize() -
packBody
public byte[] packBody()** To create body from image_header and image_data SetImageHeader and SetImageData must have called first**
- Specified by:
packBody
in classOpenIGTMessage
- Returns:
- the bytes array containing the body
-
setImageHeader
public byte[] setImageHeader(long version, long imageType, long scalarType, long endian, long coordinate_type, long[] dimensions, double[] origin, double[][] normals, long[] subOffset, long[] subDimensions) ** To create image_header from image carateristics and to get the byte array to send- Parameters:
version
-imageType
-scalarType
-endian
-coordinate_type
-dimensions
-origin
-normals
-subOffset
-subDimensions
- **- Returns:
- the bytes array created from the value
-
setImageHeader
public byte[] setImageHeader(long[] dimensions, double[] origin, double[][] normals, long[] subOffset, long[] subDimensions) ** To create image_header from image carateristics and to get the byte array to send- Parameters:
dimensions
-origin
-normals
-subOffset
-subDimensions
- **- Returns:
- the bytes array created from the value
-
getImageHeader
public byte[] getImageHeader()** To get image_header byte array **- Returns:
- the image_header bytes array
-
setImageHeader
public void setImageHeader(byte[] image_header) ** To extract image characteristics from image_header byte array- Parameters:
image_header
-
-
getImageData
public byte[] getImageData()** To get image_data byte array **- Returns:
- the image_data bytes array
-
setImageData
public void setImageData(byte[] image_data) ** To Set image_data byte array **- Parameters:
image_data
- the image_data bytes array
-
setDimensions
public void setDimensions(long i, long j, long k) ** To set Image dimensions- Parameters:
i
-j
-k
- **
-
getDimensions
public long[] getDimensions()** To get Image dimensions **- Returns:
- the dimensions bytes array
-
setDimensions
public void setDimensions(long[] dimensions) ** To set Image dimensions- Parameters:
dimensions
- **
-
setSubVolume
public boolean setSubVolume(long[] subDimensions, long[] subOffset) ** To set Image dimensions- Parameters:
subDimensions
-subOffset
- **- Returns:
- true if Ok false if not
-
setSubVolume
public boolean setSubVolume(int dimi, int dimj, int dimk, int offi, int offj, int offk) ** To set Image dimensions- Parameters:
dimi
-dimj
-dimk
-offi
-offj
-offk
- **- Returns:
- true if Ok false if not
-
getSubDimensions
public long[] getSubDimensions()** To get SubVolume dimensions **- Returns:
- the SubVolume dimensions bytes array
-
getSubOffset
public long[] getSubOffset()** To get SubVolume offset **- Returns:
- the SubVolume offset bytes array
-
setSpacing
public void setSpacing(float si, float sj, float sk) ** To set Image spacing- Parameters:
si
-sj
-sk
- **
-
getSpacing
public double[] getSpacing()** To get Image spacing **- Returns:
- the spacing bytes array
-
setSpacing
public void setSpacing(double[] spacing) ** To set Image spacing- Parameters:
spacing
- **
-
setOrigin
public void setOrigin(double px, double py, double pz) ** To set Image origin- Parameters:
px
-py
-pz
- **
-
getOrigin
public double[] getOrigin()** To get Image origin **- Returns:
- the origin bytes array
-
setOrigin
public void setOrigin(double[] origin) ** To set Image origin- Parameters:
origin
- **
-
getNormals
public double[][] getNormals()** To get Image normals **- Returns:
- the normals matrix
-
setMatrix
public void setMatrix(double[] spacing, double[] origin, double[] norm_i, double[] norm_j, double[] norm_k) ** To set Image matrix- Parameters:
spacing
- arrayorigin
- arraynorm_i
- arraynorm_j
- arraynorm_k
- array **
-
setMatrix
public void setMatrix(double[] origin, double[][] normals) ** To set Image matrix- Parameters:
origin
- arraynormals
- matrix **
-
getMatrix
public double[][] getMatrix()** To get Image matrix **- Returns:
- the image matrix
-
setMatrix
public void setMatrix(double[][] matrix) ** To set Image matrix- Parameters:
matrix
- **
-
setScalarTypeToInt8
public void setScalarTypeToInt8()** To set Image scalar type to Int8 ** -
setScalarTypeToUint8
public void setScalarTypeToUint8()** To set Image scalar type to Uint8 ** -
setScalarTypeToInt16
public void setScalarTypeToInt16()** To set Image scalar type to Int16 ** -
setScalarTypeToUint16
public void setScalarTypeToUint16()** To set Image scalar type to Uint16 ** -
setScalarTypeToInt32
public void setScalarTypeToInt32()** To set Image scalar type to Int32 ** -
setScalarTypeToUint32
public void setScalarTypeToUint32()** To set Image scalar type to Uint32 ** -
getScalarType
public long getScalarType()** To get Image scalar type **- Returns:
- the scalar type
-
setScalarType
public void setScalarType(long scalarType) ** To set Image scalar type- Parameters:
scalarType
- **
-
getImageType
public long getImageType()** To get Image image type **- Returns:
- the image type
-
setImageType
public void setImageType(long imageType) ** To set Image image type- Parameters:
imageType
- **
-
getEndian
public long getEndian()** To get Image Endian of image scalar **- Returns:
- the endian
-
setEndian
public void setEndian(long endian) ** To set Image Endian of image scalar (default is ENDIAN_BIG)- Parameters:
endian
- **
-
getImageSize
public long getImageSize()** To get Image Size **- Returns:
- the Size
-
getSubVolumeImageSize
public long getSubVolumeImageSize()** To get SubVolume Size **- Returns:
- SubVolume Size
-
toString
** To get image String **- Specified by:
toString
in classOpenIGTMessage
- Returns:
- the image String
-