Class SPEReader.SpeHeader

java.lang.Object
loci.formats.in.SPEReader.SpeHeader
Enclosing class:
SPEReader

private class SPEReader.SpeHeader extends Object
SpeHeader holds a byte array containing the SPE binary data header along with associated methods for reading SPE Header Entry values in various formats
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private byte[]
     
    private static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    SpeHeader(byte[] header)
    Constructor for SpeHeader
  • Method Summary

    Modifier and Type
    Method
    Description
    private int
    getByte(int index)
    Private method used to retrieve a Byte value from the SPE header
    int
    Method used to retrieve data values for Byte entries into the SPE header table
    byte[]
     
    int
     
    private int
    getInt(int index)
    Private method used to retrieve an Integer value from the SPE header
    int
    Method used to retrieve data values for Integer entries into the SPE header table
    int[]
    Method used to retrieve data values for Integer Array entries into the SPE header table
    private long
    getLong(int index)
    Private method used to retrieve a Long value from the SPE header
    long
    Method used to retrieve data values for Long enteries into the SPE header table
    long[]
    Method used to retrieve data values for Long Array entries into the SPE header table
    Method used to read and return meta data for upto 10 rectangular ROI's stored in the SPE header table
    private int
    getShort(int index)
    Private method used to retrieve a Short value from the SPE header
    int
    Method used to retrieve data values for Short entries into the SPE header table
    int[]
    Method used to retrieve data values for Short Array entries into the SPE header table
    int
    Method used to determined the stack size of the SPE file.
    private String
    getString(int index, int length)
    Private method used to retrieve a String value from the SPE header
    Method used to retrieve data values for String entries into the SPE header table
    private boolean
    setByte(int index, int value)
    Private method used to set a Byte value in the SPE header
    void
    setHeader(byte[] header)
     
    private void
    setInt(int index, int value)
    Private method used to set an Integer value in the SPE header
    private void
    setLong(int index, int value)
    Private method used to set a Long value in the SPE header
    private boolean
    setShort(int index, int value)
    Private method used to set a Short value in the SPE header
    private void
    setString(int index, String string)
    Private method used to set a String value in the SPE header

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • headerSize

      private static final int headerSize
      See Also:
  • Constructor Details

    • SpeHeader

      public SpeHeader(byte[] header)
      Constructor for SpeHeader
      Parameters:
      header - The binary data header read from the associated SPE file
  • Method Details

    • getHeader

      public byte[] getHeader()
      Returns:
      The raw binary data header
    • setHeader

      public void setHeader(byte[] header)
      Parameters:
      header - The binary data header to be used
    • getHeaderSize

      public int getHeaderSize()
      Returns:
      The expected size of the SPE data header
    • getByte

      public int getByte(SPEReader.SpeHeaderEntry entry) throws FormatException
      Method used to retrieve data values for Byte entries into the SPE header table
      Parameters:
      entry - The header entry to read
      Returns:
      The value read at the given header entry location
      Throws:
      FormatException - Thrown if the value at the given header entry location is not of type Byte
    • getByte

      private int getByte(int index)
      Private method used to retrieve a Byte value from the SPE header
      Parameters:
      index - The index of the expected value in the header array
      Returns:
      The value read at the given header entry location
    • setByte

      private boolean setByte(int index, int value)
      Private method used to set a Byte value in the SPE header
      Parameters:
      index - The starting index in the header array in which to write the value
      value - The Byte value to be written to the SPE header
    • getShort

      public int getShort(SPEReader.SpeHeaderEntry entry) throws FormatException
      Method used to retrieve data values for Short entries into the SPE header table
      Parameters:
      entry - The header entry to read
      Returns:
      The value read at the given header entry location
      Throws:
      FormatException - Thrown if the value at the given header entry location is not of type Short
    • getShort

      private int getShort(int index)
      Private method used to retrieve a Short value from the SPE header
      Parameters:
      index - The index of the expected value in the header array
      Returns:
      The value read at the given header entry location
    • setShort

      private boolean setShort(int index, int value)
      Private method used to set a Short value in the SPE header
      Parameters:
      index - The starting index in the header array in which to write the value
      value - The Short value to be written to the SPE header
    • getInt

      public int getInt(SPEReader.SpeHeaderEntry entry) throws FormatException
      Method used to retrieve data values for Integer entries into the SPE header table
      Parameters:
      entry - The header entry to read
      Returns:
      The value read at the given header entry location
      Throws:
      FormatException - Thrown if the value at the given header entry location is not of type Integer
    • getInt

      private int getInt(int index)
      Private method used to retrieve an Integer value from the SPE header
      Parameters:
      index - The index of the expected value in the header array
      Returns:
      The value read at the given header entry location
    • setInt

      private void setInt(int index, int value)
      Private method used to set an Integer value in the SPE header
      Parameters:
      index - The starting index in the header array in which to write the value
      value - The Integer value to be written to the SPE header
    • getLong

      public long getLong(SPEReader.SpeHeaderEntry entry) throws FormatException
      Method used to retrieve data values for Long enteries into the SPE header table
      Parameters:
      entry - The header entry to read
      Returns:
      The value read at the given header entry location
      Throws:
      FormatException - Thrown if the value at the given header entry location is not of type Long
    • getLong

      private long getLong(int index)
      Private method used to retrieve a Long value from the SPE header
      Parameters:
      index - The index of the expected value in the header array
      Returns:
      The value read at the given header entry location
    • setLong

      private void setLong(int index, int value)
      Private method used to set a Long value in the SPE header
      Parameters:
      index - The starting index in the header array in which to write the value
      value - The Long value to be written to the SPE header
    • getString

      Method used to retrieve data values for String entries into the SPE header table
      Parameters:
      entry - The header entry to read
      Returns:
      The value read at the given header entry location
      Throws:
      FormatException - Thrown if the value at the given header entry location is not of type String or if the length of the String cannot be determined
      UnsupportedEncodingException - Thrown if the String value found in the header location is not in UTF-8 encoding
    • getString

      private String getString(int index, int length) throws UnsupportedEncodingException
      Private method used to retrieve a String value from the SPE header
      Parameters:
      index - The starting index of the expected value in the header array
      length - The length of the String to be read from the array
      Returns:
      The String value read at the given header entry location
      Throws:
      UnsupportedEncodingException - Thrown if the String read at the given location is not in UTF-8 encoding
    • setString

      private void setString(int index, String string)
      Private method used to set a String value in the SPE header
      Parameters:
      index - The starting index in the header array in which to write the String
      string - The String to be written to the SPE header
    • getIntArray

      public int[] getIntArray(SPEReader.SpeHeaderEntry entry) throws FormatException
      Method used to retrieve data values for Integer Array entries into the SPE header table
      Parameters:
      entry - The header entry to read
      Returns:
      The array of Integer values read at the given header entry location. Returns null if all values read are 0.
      Throws:
      FormatException - Thrown if the value at the given header entry location is not of type Integer Array
    • getShortArray

      public int[] getShortArray(SPEReader.SpeHeaderEntry entry) throws FormatException
      Method used to retrieve data values for Short Array entries into the SPE header table
      Parameters:
      entry - The header entry to read
      Returns:
      The array of Short values read at the given header entry location. Returns null if all values read are 0.
      Throws:
      FormatException - Thrown if the value at the given header entry location is not of type Short Array
    • getLongArray

      public long[] getLongArray(SPEReader.SpeHeaderEntry entry) throws FormatException
      Method used to retrieve data values for Long Array entries into the SPE header table
      Parameters:
      entry - The header entry to read
      Returns:
      The array of Long values read at the given header entry location. Returns null if all values read are 0.
      Throws:
      FormatException - Thrown if the value at the given header entry location is not of type Long Array
    • getROIs

      public SPEReader.SpeROI[] getROIs() throws FormatException
      Method used to read and return meta data for upto 10 rectangular ROI's stored in the SPE header table
      Returns:
      An array of SpeROI objects, each containing meta data for a single ROI
      Throws:
      FormatException - Thrown if any of the values read during the call are not in the correct format
    • getStackSize

      public int getStackSize() throws FormatException
      Method used to determined the stack size of the SPE file. This should usually be the value in the Number of Frames header entry, but other older entry values are also still supported if still in use.
      Returns:
      The stack size of the SPE file
      Throws:
      FormatException - Thrown if any of the values read during the call are not in the correct format