Class SlidebookReader

All Implemented Interfaces:
Closeable, AutoCloseable, ICompressedTileReader, IFormatHandler, IFormatReader, IMetadataConfigurable, IPyramidHandler

public class SlidebookReader extends FormatReader
SlidebookReader is the file format reader for 3I Slidebook files. The strategies employed by this reader are highly suboptimal, as we have very little information on the Slidebook format.
Author:
Melissa Linkert melissa at glencoesoftware.com
  • Field Details

    • SLD_MAGIC_BYTES_1_0

      public static final int SLD_MAGIC_BYTES_1_0
      See Also:
    • SLD_MAGIC_BYTES_1_1

      public static final int SLD_MAGIC_BYTES_1_1
      See Also:
    • SLD_MAGIC_BYTES_1_2

      public static final int SLD_MAGIC_BYTES_1_2
      See Also:
    • SLD_MAGIC_BYTES_2_0

      public static final int SLD_MAGIC_BYTES_2_0
      See Also:
    • SLD_MAGIC_BYTES_2_1

      public static final int SLD_MAGIC_BYTES_2_1
      See Also:
    • SLD_MAGIC_BYTES_3

      public static final long SLD_MAGIC_BYTES_3
      See Also:
    • metadataOffsets

      private List<Long> metadataOffsets
    • pixelOffsets

      private List<Long> pixelOffsets
    • pixelLengths

      private List<Long> pixelLengths
    • ndFilters

      private List<Double> ndFilters
    • imageDescriptions

      private Map<Integer,String> imageDescriptions
    • planeOffset

      private long[][] planeOffset
    • adjust

      private boolean adjust
    • isSpool

      private boolean isSpool
    • metadataInPlanes

      private Map<Integer,Integer> metadataInPlanes
  • Constructor Details

    • SlidebookReader

      public SlidebookReader()
      Constructs a new Slidebook reader.
  • Method Details

    • isThisType

      public boolean isThisType(loci.common.RandomAccessInputStream stream) throws IOException
      Description copied from interface: IFormatReader
      Checks if the given stream is a valid stream for this file format. The number of bytes read is format-dependent.
      Specified by:
      isThisType in interface IFormatReader
      Overrides:
      isThisType in class FormatReader
      Parameters:
      stream - A RandomAccessInputStream representing the file to check. The first byte in the stream is assumed to be the first byte in the file.
      Returns:
      true if the file represented by the stream can be read by this reader; false otherwise.
      Throws:
      IOException
    • openBytes

      public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, IOException
      Description copied from interface: IFormatReader
      Obtains a sub-image of the specified image plane into a pre-allocated byte array.
      Specified by:
      openBytes in interface IFormatReader
      Specified by:
      openBytes in class FormatReader
      Parameters:
      no - the plane index within the current series.
      buf - a pre-allocated buffer.
      x - X coordinate of the upper-left corner of the sub-image
      y - Y coordinate of the upper-left corner of the sub-image
      w - width of the sub-image
      h - height of the sub-image
      Returns:
      the pre-allocated buffer buf for convenience.
      Throws:
      FormatException - if there was a problem parsing the metadata of the file.
      IOException - if there was a problem reading the file.
      See Also:
    • close

      public void close(boolean fileOnly) throws IOException
      Description copied from interface: IFormatReader
      Closes the currently open file. If the flag is set, this is all that happens; if unset, it is equivalent to calling Closeable.close().
      Specified by:
      close in interface IFormatReader
      Overrides:
      close in class FormatReader
      Throws:
      IOException
    • initFile

      protected void initFile(String id) throws FormatException, IOException
      Description copied from class: FormatReader
      Initializes the given file (parsing header information, etc.). Most subclasses should override this method to perform initialization operations such as parsing metadata.
      Overrides:
      initFile in class FormatReader
      Throws:
      FormatException - if a parsing error occurs processing the file.
      IOException - if an I/O error occurs processing the file
    • withinPixels

      private boolean withinPixels(long offset)
    • isGreaterThanEpsilon

      private boolean isGreaterThanEpsilon(double v)
      Returns true if the given double is greater than epsilon (defined here as 0.000001), i.e. positive and not a very, very small number. Returns false if the given double is negative or less than epsilon. See also: http://en.wikipedia.org/wiki/(%CE%B5,_%CE%B4)-definition_of_limit
    • readCString

      private String readCString() throws IOException
      Throws:
      IOException