Class ImageMessage

java.lang.Object
org.medcare.igtl.messages.OpenIGTMessage
org.medcare.igtl.messages.ImageMessage

public class ImageMessage extends OpenIGTMessage
** This class create an Image object from bytes received or help to generate bytes to send from it
  • 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

      public ImageMessage(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 **
      Parameters:
      deviceName - Device Name
    • ImageMessage

      public ImageMessage(Header header, byte[] body) throws Exception
      ** Constructor to be used to create message from received data
      Parameters:
      header -
      body -
      Throws:
      Exception
  • Method Details

    • unpackBody

      public boolean unpackBody() throws Exception
      ** To create body from body array

      **

      Specified by:
      unpackBody in class OpenIGTMessage
      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 class OpenIGTMessage
      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 - array
      origin - array
      norm_i - array
      norm_j - array
      norm_k - array **
    • setMatrix

      public void setMatrix(double[] origin, double[][] normals)
      ** To set Image matrix
      Parameters:
      origin - array
      normals - 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

      public String toString()
      ** To get image String **
      Specified by:
      toString in class OpenIGTMessage
      Returns:
      the image String