Class TissueFAXSReader

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

public class TissueFAXSReader extends FormatReader
Reader for TissueFAXS format from TissueGnostics.
  • Field Details

  • Constructor Details

    • TissueFAXSReader

      public TissueFAXSReader()
      Constructs a new TissueGnostics TissueFAXS reader.
  • Method Details

    • 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
    • getOptimalTileWidth

      public int getOptimalTileWidth()
      Description copied from interface: IFormatReader
      Returns the optimal sub-image width for use with openBytes.
      Specified by:
      getOptimalTileWidth in interface IFormatReader
      Overrides:
      getOptimalTileWidth in class FormatReader
    • getOptimalTileHeight

      public int getOptimalTileHeight()
      Description copied from interface: IFormatReader
      Returns the optimal sub-image height for use with openBytes.
      Specified by:
      getOptimalTileHeight in interface IFormatReader
      Overrides:
      getOptimalTileHeight in class FormatReader
    • 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:
    • 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
    • findDBFiles

      private void findDBFiles()
      If a .tfcyto file was provided, then that is the only file that should be read. If an .aqproj file was provided, look for all associated .tfcyto files.
    • getAllRegions

      private List<TissueFAXSReader.ScanRegion> getAllRegions(int t) throws FormatException
      Throws:
      FormatException
    • getRegion

      private TissueFAXSReader.ScanRegion getRegion() throws FormatException
      Throws:
      FormatException
    • getRegion

      private TissueFAXSReader.ScanRegion getRegion(int t) throws FormatException
      Throws:
      FormatException
    • isCorrectionImage

      private boolean isCorrectionImage(TissueFAXSReader.ScanRegion r)
    • getLevel

      private int getLevel() throws FormatException
      Throws:
      FormatException
    • getCodec

      private Codec getCodec(int compression) throws UnsupportedCompressionException
      Throws:
      UnsupportedCompressionException
    • getCodecOptions

      private CodecOptions getCodecOptions(TissueFAXSReader.ScanRegion region)
    • splitFOVs

      private byte[][] splitFOVs(TissueFAXSReader.ScanRegion region, byte[] tile, int scale)
      The largest resolution stores one field of view (FOV) per tile. Each sub-resolution has the same tile size as the largest resolution, so the number of FOVs stored in one tile increases as the resolutions get smaller. For example, with a tile size of 2048x2048 and a downsample factor of 4, resolution 1 will have 16 (4x4) FOVs per tile, with each FOV being 512x512. However, none of the FOV positions or overlaps are taken into account. So the first step in assembling a sub-resolution is to split each tile into its component FOVs. Then each FOV can be repositioned according to its associated stitching rectangle and overlap. This method only splits the given tile into component FOVs. This is not necessary for the largest resolution, only sub-resolutions.
    • copyRegionToBuffer

      private void copyRegionToBuffer(TissueFAXSReader.ScanRegion region, int level, loci.common.Region dest, int[] zct, byte[] buf) throws FormatException, IOException
      Throws:
      FormatException
      IOException
    • copyRegion

      private void copyRegion(loci.common.Region srcRegion, byte[] src, loci.common.Region destRegion, byte[] dest, int tileWidth)
    • copyCorrectionImageToBuffer

      private void copyCorrectionImageToBuffer(TissueFAXSReader.ScanRegion region, loci.common.Region dest, int[] zct, byte[] buf) throws FormatException, IOException
      Throws:
      FormatException
      IOException
    • openConnection

      private Connection openConnection(String file) throws IOException
      Throws:
      IOException
    • applyTransformation

      public byte[] applyTransformation(byte[] tile, int regionID, int level, int channel, int zIndex, int fovRow, int fovColumn)
      Extension point for doing something to an FOV immediately after decompression, before any stitching or cropping. Overriding this in a subclass could be used to apply a correction image. Currently this method is a no-op.