loci.formats.in

## Class SPEReader.SpeHeader

- java.lang.Object
- - loci.formats.in.SPEReader.SpeHeader

- Enclosing class:
    SPEReader

      private class SPEReader.SpeHeader
      extends java.lang.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 and Description
    --- | ---
    `private byte[]` | `header`
    `private static int` | `headerSize`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SpeHeader(byte[] header)` Constructor for SpeHeader

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `private int` | `getByte(int index)` Private method used to retrieve a Byte value from the SPE header
    `int` | `getByte(SPEReader.SpeHeaderEntry entry)` Method used to retrieve data values for Byte entries into the SPE header table
    `byte[]` | `getHeader()`
    `int` | `getHeaderSize()`
    `private int` | `getInt(int index)` Private method used to retrieve an Integer value from the SPE header
    `int` | `getInt(SPEReader.SpeHeaderEntry entry)` Method used to retrieve data values for Integer entries into the SPE header table
    `int[]` | `getIntArray(SPEReader.SpeHeaderEntry entry)` 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` | `getLong(SPEReader.SpeHeaderEntry entry)` Method used to retrieve data values for Long enteries into the SPE header table
    `long[]` | `getLongArray(SPEReader.SpeHeaderEntry entry)` Method used to retrieve data values for Long Array entries into the SPE header table
    `SPEReader.SpeROI[]` | `getROIs()` 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` | `getShort(SPEReader.SpeHeaderEntry entry)` Method used to retrieve data values for Short entries into the SPE header table
    `int[]` | `getShortArray(SPEReader.SpeHeaderEntry entry)` Method used to retrieve data values for Short Array entries into the SPE header table
    `int` | `getStackSize()` Method used to determined the stack size of the SPE file.
    `private java.lang.String` | `getString(int index, int length)` Private method used to retrieve a String value from the SPE header
    `java.lang.String` | `getString(SPEReader.SpeHeaderEntry entry)` 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, java.lang.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 Detail

    - #### headerSize

          private static final int headerSize

      See Also:
        Constant Field Values

    - #### header

          private byte[] header

  - ### Constructor Detail

    - #### SpeHeader

          public SpeHeader(byte[] header)

      Constructor for SpeHeader
      Parameters:
        `header` - The binary data header read from the associated SPE file

  - ### Method Detail

    - #### 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

          public java.lang.String getString(SPEReader.SpeHeaderEntry entry)
                                     throws FormatException,
                                            java.io.UnsupportedEncodingException

      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
        `java.io.UnsupportedEncodingException` - Thrown if the String value found in the header location is not in UTF-8 encoding

    - #### getString

          private java.lang.String getString(int index,
                                             int length)
                                      throws java.io.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:
        `java.io.UnsupportedEncodingException` - Thrown if the String read at the given location is not in UTF-8 encoding

    - #### setString

          private void setString(int index,
                                 java.lang.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

Copyright © 2026 Open Microscopy Environment