Class DeltavisionReader

All Implemented Interfaces:
Closeable, AutoCloseable, ICompressedTileReader, IFormatHandler, IFormatReader, IMetadataConfigurable, IPyramidHandler
Direct Known Subclasses:
RCPNLReader

public class DeltavisionReader extends FormatReader
DeltavisionReader is the file format reader for Deltavision files.
Author:
Melissa Linkert melissa at glencoesoftware.com
  • Field Details

    • DV_MAGIC_BYTES_1

      public static final int DV_MAGIC_BYTES_1
      See Also:
    • DV_MAGIC_BYTES_2

      public static final int DV_MAGIC_BYTES_2
      See Also:
    • DATE_FORMAT

      @Deprecated public static final String DATE_FORMAT
      Deprecated.
      Use DATE_FORMATS instead
      See Also:
    • DATE_FORMATS

      public static final String[] DATE_FORMATS
    • LITTLE_ENDIAN

      private static final short LITTLE_ENDIAN
      See Also:
    • HEADER_LENGTH

      private static final int HEADER_LENGTH
      See Also:
    • NEW_TYPE

      private static final int NEW_TYPE
      See Also:
    • MAX_CHANNELS

      private static final int MAX_CHANNELS
      See Also:
    • IMAGE_TYPES

      private static final String[] IMAGE_TYPES
    • extSize

      private int extSize
      Size of extended header.
    • wSize

      protected int wSize
      Size of one wave in the extended header.
    • zSize

      protected int zSize
      Size of one z section in the extended header.
    • tSize

      protected int tSize
      Size of one time element in the extended header.
    • panelSize

      protected int panelSize
    • xTiles

      private int xTiles
      Number of tiles in X direction.
    • yTiles

      private int yTiles
      Number of tiles in Y direction.
    • backwardsStageX

      private boolean backwardsStageX
      Whether or not the stage moved backwards.
    • backwardsStageY

      private boolean backwardsStageY
    • numIntsPerSection

      protected int numIntsPerSection
      The number of ints in each extended header section. These fields appear to be all blank but need to be skipped to get to the floats afterwards
    • numFloatsPerSection

      protected int numFloatsPerSection
    • extHdrFields

      protected DeltavisionReader.DVExtHdrFields[] extHdrFields
      Initialize an array of Extended Header Field structures.
    • ndFilters

      private Double[] ndFilters
    • lengths

      private int[] lengths
    • logFile

      private String logFile
    • deconvolutionLogFile

      private String deconvolutionLogFile
    • truncatedFileFlag

      private boolean truncatedFileFlag
    • imageSequence

      private String imageSequence
    • newFileType

      private boolean newFileType
    • positionInT

      protected boolean positionInT
  • Constructor Details

    • DeltavisionReader

      public DeltavisionReader()
      Constructs a new Deltavision reader.
  • Method Details

    • isSingleFile

      public boolean isSingleFile(String id) throws FormatException, IOException
      Description copied from interface: IFormatReader
      Returns true if the named file is expected to be the only file in the dataset. For single-file formats, always returns true.
      Specified by:
      isSingleFile in interface IFormatReader
      Overrides:
      isSingleFile in class FormatReader
      Throws:
      FormatException
      IOException
    • isThisType

      public boolean isThisType(String name, boolean open)
      Description copied from class: FormatReader
      Checks if a file matches the type of this format reader. Checks filename suffixes against those known for this format. If the suffix check is inconclusive and the open parameter is true, the file is opened and tested with FormatReader.isThisType(RandomAccessInputStream).
      Specified by:
      isThisType in interface IFormatReader
      Overrides:
      isThisType in class FormatReader
      Parameters:
      open - If true, and the file extension is insufficient to determine the file type, the (existing) file is opened for further analysis.
    • 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
    • getSeriesUsedFiles

      public String[] getSeriesUsedFiles(boolean noPixels)
      Description copied from interface: IFormatReader
      Returns an array of filenames needed to open the current series. If the 'noPixels' flag is set, then only files that do not contain pixel data will be returned. The first element in the array is expected to be the path passed to IFormatHandler.setId(String), if appropriate based upon 'noPixels'. The remaining elements are expected to be in a consistent order; if a directory listing is necessary to build the list then it should be sorted first.
      Specified by:
      getSeriesUsedFiles in interface IFormatReader
      Overrides:
      getSeriesUsedFiles in class FormatReader
    • 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
    • setTruncatedFileFlag

      public void setTruncatedFileFlag(boolean truncatedFileFlag)
      This flag indicates if the file is known to be truncated. If true, the dimension size information is kept as it is specified in the file header, otherwise the length of the file is used to override size information. This flag must be set before FormatReader.setId(String) is called. Default is false.
    • 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
    • initPixels

      protected void initPixels() throws FormatException, IOException
      Throws:
      FormatException
      IOException
    • initExtraMetadata

      protected void initExtraMetadata() throws FormatException, IOException
      Throws:
      FormatException
      IOException
    • getPixelString

      private String getPixelString(int filePixelType)
      Get a descriptive string representing the pixel type.
    • getPixelType

      private int getPixelType(int filePixelType)
      Get the OME pixel type from the pixel type stored in the file.
    • getImageSequence

      private String getImageSequence(int imageSequence)
      Get the image sequence string.
    • setOffsetInfo

      private void setOffsetInfo(int numZSections, int numWaves, int numTimes, int numPanels)
      This method calculates the size of a w, t, z section depending on which sequence is being used
      Parameters:
      numZSections -
      numWaves -
      numTimes -
      numPanels -
    • getTotalPlaneHeaderSize

      private int getTotalPlaneHeaderSize()
    • getPlaneIndex

      private int getPlaneIndex(int series, int plane)
    • getPlaneByteOffset

      public long getPlaneByteOffset(int currentZ, int currentW, int currentT)
      Given any specific Z, W, and T of a plane, determine the absolute byte offset of the plane in the file.
      Parameters:
      currentZ -
      currentW -
      currentT -
    • findLogFiles

      private void findLogFiles() throws IOException
      Find the log files.
      Throws:
      IOException
    • parseLogFile

      private boolean parseLogFile(MetadataStore store) throws FormatException, IOException
      Extract metadata from associated log file, if it exists.
      Throws:
      FormatException
      IOException
    • parseDeconvolutionLog

      private void parseDeconvolutionLog(loci.common.RandomAccessInputStream s, MetadataStore store) throws IOException
      Parse deconvolution output, if it exists.
      Throws:
      IOException
    • readWavelength

      private void readWavelength(int channel, MetadataStore store) throws FormatException, IOException
      Throws:
      FormatException
      IOException
    • populateObjective

      protected void populateObjective(MetadataStore store, int lensID) throws FormatException
      Populate an Objective based upon the lens ID. This is based upon information received from Applied Precision.
      Throws:
      FormatException