Class FlowSightReader

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

public class FlowSightReader extends FormatReader
Author:
Lee Kamentsky Reader for the Amris ImageStream / FlowSight file format The cif file format is tiff-like, but doesn't adhere to the TIFF standard, so we use the TiffParser where we can, but do not use the TiffReader hierarchy.
  • Field Details

    • CHANNEL_COUNT_TAG

      private static final int CHANNEL_COUNT_TAG
      See Also:
    • ACQUISITION_TIME_TAG

      private static final int ACQUISITION_TIME_TAG
      See Also:
    • CHANNEL_NAMES_TAG

      private static final int CHANNEL_NAMES_TAG
      See Also:
    • CHANNEL_DESCS_TAG

      private static final int CHANNEL_DESCS_TAG
      See Also:
    • METADATA_XML_TAG

      private static final int METADATA_XML_TAG
      See Also:
    • GREYSCALE_COMPRESSION

      private static final int GREYSCALE_COMPRESSION
      See Also:
    • BITMASK_COMPRESSION

      private static final int BITMASK_COMPRESSION
      See Also:
    • MINIMAL_TAGS

      private static final int[] MINIMAL_TAGS
      The tags that must be present for this reader to function properly
    • tiffParser

      private transient TiffParser tiffParser
    • ifdOffsets

      private long[] ifdOffsets
    • channelNames

      private String[] channelNames
    • channelDescs

      private String[] channelDescs
  • Constructor Details

    • FlowSightReader

      public FlowSightReader()
  • 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
    • 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
    • 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
    • reopenFile

      public void reopenFile() throws IOException
      Description copied from interface: IFormatReader
      Reopen any files that were closed, and which are expected to be open while the reader is open. This assumes that IFormatHandler.setId(java.lang.String) has been called, but close(false) has not been called.
      Specified by:
      reopenFile in interface IFormatReader
      Overrides:
      reopenFile in class FormatReader
      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.
    • openBitmaskBytes

      private byte[] openBitmaskBytes(IFD ifd, int imageWidth, int imageHeight) throws FormatException
      Decode the whole IFD plane using bitmask compression
      Parameters:
      ifd - - the IFD to decode
      imageWidth - the width of the IFD plane
      imageHeight - the height of the IFD plane
      Returns:
      a byte array of length imageWidth * imageHeight containing the uncompressed data
      Throws:
      FormatException
    • openGreyscaleBytes

      private byte[] openGreyscaleBytes(IFD ifd, int imageWidth, int imageHeight) throws FormatException
      Decode the whole IFD plane using greyscale compression
      Parameters:
      ifd -
      imageWidth -
      imageHeight -
      Returns:
      a byte array
      Throws:
      FormatException