Package loci.formats.in
Class SPEReader.SpeHeader
java.lang.Object
loci.formats.in.SPEReader.SpeHeader
- Enclosing class:
SPEReader
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate intgetByte(int index) Private method used to retrieve a Byte value from the SPE headerintgetByte(SPEReader.SpeHeaderEntry entry) Method used to retrieve data values for Byte entries into the SPE header tablebyte[]intprivate intgetInt(int index) Private method used to retrieve an Integer value from the SPE headerintgetInt(SPEReader.SpeHeaderEntry entry) Method used to retrieve data values for Integer entries into the SPE header tableint[]Method used to retrieve data values for Integer Array entries into the SPE header tableprivate longgetLong(int index) Private method used to retrieve a Long value from the SPE headerlonggetLong(SPEReader.SpeHeaderEntry entry) Method used to retrieve data values for Long enteries into the SPE header tablelong[]Method used to retrieve data values for Long Array entries into the SPE header tablegetROIs()Method used to read and return meta data for upto 10 rectangular ROI's stored in the SPE header tableprivate intgetShort(int index) Private method used to retrieve a Short value from the SPE headerintgetShort(SPEReader.SpeHeaderEntry entry) Method used to retrieve data values for Short entries into the SPE header tableint[]Method used to retrieve data values for Short Array entries into the SPE header tableintMethod used to determined the stack size of the SPE file.private StringgetString(int index, int length) Private method used to retrieve a String value from the SPE headerMethod used to retrieve data values for String entries into the SPE header tableprivate booleansetByte(int index, int value) Private method used to set a Byte value in the SPE headervoidsetHeader(byte[] header) private voidsetInt(int index, int value) Private method used to set an Integer value in the SPE headerprivate voidsetLong(int index, int value) Private method used to set a Long value in the SPE headerprivate booleansetShort(int index, int value) Private method used to set a Short value in the SPE headerprivate voidPrivate method used to set a String value in the SPE header
-
Field Details
-
headerSize
private static final int headerSize- See Also:
-
header
private byte[] header
-
-
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
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 valuevalue- The Byte value to be written to the SPE header
-
getShort
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 valuevalue- The Short value to be written to the SPE header
-
getInt
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 valuevalue- The Integer value to be written to the SPE header
-
getLong
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 valuevalue- The Long value to be written to the SPE header
-
getString
public String getString(SPEReader.SpeHeaderEntry entry) throws FormatException, 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 determinedUnsupportedEncodingException- Thrown if the String value found in the header location is not in UTF-8 encoding
-
getString
Private method used to retrieve a String value from the SPE header- Parameters:
index- The starting index of the expected value in the header arraylength- 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 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 Stringstring- The String to be written to the SPE header
-
getIntArray
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
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
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
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
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
-