Package loci.formats

Class FileStitcher

java.lang.Object
loci.formats.ReaderWrapper
loci.formats.FileStitcher
All Implemented Interfaces:
Closeable, AutoCloseable, loci.formats.ICompressedTileReader, loci.formats.IFormatHandler, loci.formats.IFormatReader, loci.formats.IMetadataConfigurable, loci.formats.IPyramidHandler

public class FileStitcher extends loci.formats.ReaderWrapper
Logic to stitch together files with similar names. Assumes that all files have the same characteristics (e.g., dimensions).
  • Constructor Details

    • FileStitcher

      public FileStitcher()
      Constructs a FileStitcher around a new image reader.
    • FileStitcher

      public FileStitcher(boolean patternIds)
      Constructs a FileStitcher around a new image reader.
      Parameters:
      patternIds - Whether string ids given should be treated as file patterns rather than single file paths.
    • FileStitcher

      public FileStitcher(loci.formats.IFormatReader r)
      Constructs a FileStitcher with the given reader.
      Parameters:
      r - The reader to use for reading stitched files.
    • FileStitcher

      public FileStitcher(loci.formats.IFormatReader r, boolean patternIds)
      Constructs a FileStitcher with the given reader.
      Parameters:
      r - The reader to use for reading stitched files.
      patternIds - Whether string ids given should be treated as file patterns rather than single file paths.
  • Method Details

    • setReaderClassList

      public void setReaderClassList(loci.formats.ClassList<loci.formats.IFormatReader> classList)
      Set the ClassList object to use when constructing any helper readers.
    • getReader

      public loci.formats.IFormatReader getReader()
      Gets the wrapped reader prototype.
      Overrides:
      getReader in class loci.formats.ReaderWrapper
    • setUsingPatternIds

      public void setUsingPatternIds(boolean patternIds)
      Sets whether the reader is using file patterns for IDs.
    • isUsingPatternIds

      public boolean isUsingPatternIds()
      Gets whether the reader is using file patterns for IDs.
    • setCanChangePattern

      public void setCanChangePattern(boolean doChange)
    • canChangePattern

      public boolean canChangePattern()
    • getReader

      public loci.formats.IFormatReader getReader(int no) throws loci.formats.FormatException, IOException
      Gets the reader appropriate for use with the given image plane.
      Throws:
      loci.formats.FormatException
      IOException
    • getReader

      public DimensionSwapper getReader(int series, int no)
      Gets the reader that should be used with the given series and image plane.
    • getAdjustedIndex

      public int getAdjustedIndex(int no) throws loci.formats.FormatException, IOException
      Gets the local reader index for use with the given image plane.
      Throws:
      loci.formats.FormatException
      IOException
    • getAxisTypes

      public int[] getAxisTypes()
      Gets the axis type for each dimensional block.
      Returns:
      An array containing values from the enumeration:
      • AxisGuesser.Z_AXIS: focal planes
      • AxisGuesser.T_AXIS: time points
      • AxisGuesser.C_AXIS: channels
      • AxisGuesser.S_AXIS: series
    • setAxisTypes

      public void setAxisTypes(int[] axes) throws loci.formats.FormatException
      Sets the axis type for each dimensional block.
      Parameters:
      axes - An array containing values from the enumeration:
      • AxisGuesser.Z_AXIS: focal planes
      • AxisGuesser.T_AXIS: time points
      • AxisGuesser.C_AXIS: channels
      • AxisGuesser.S_AXIS: series
      Throws:
      loci.formats.FormatException
    • getFilePattern

      public FilePattern getFilePattern()
      Gets the file pattern object used to build the list of files.
    • getAxisGuesser

      public AxisGuesser getAxisGuesser()
      Gets the axis guesser object used to guess which dimensional axes are which.
    • findPattern

      public FilePattern findPattern(String id)
    • findPatterns

      public String[] findPatterns(String id)
      Finds the file pattern for the given ID, based on the state of the file stitcher. Takes both ID map entries and the patternIds flag into account.
    • getRequiredDirectories

      public int getRequiredDirectories(String[] files) throws loci.formats.FormatException, IOException
      Specified by:
      getRequiredDirectories in interface loci.formats.IFormatReader
      Overrides:
      getRequiredDirectories in class loci.formats.ReaderWrapper
      Throws:
      loci.formats.FormatException
      IOException
    • getImageCount

      public int getImageCount()
      Specified by:
      getImageCount in interface loci.formats.IFormatReader
      Overrides:
      getImageCount in class loci.formats.ReaderWrapper
    • isRGB

      public boolean isRGB()
      Specified by:
      isRGB in interface loci.formats.IFormatReader
      Overrides:
      isRGB in class loci.formats.ReaderWrapper
    • getSizeX

      public int getSizeX()
      Specified by:
      getSizeX in interface loci.formats.IFormatReader
      Overrides:
      getSizeX in class loci.formats.ReaderWrapper
    • getSizeY

      public int getSizeY()
      Specified by:
      getSizeY in interface loci.formats.IFormatReader
      Overrides:
      getSizeY in class loci.formats.ReaderWrapper
    • getSizeZ

      public int getSizeZ()
      Specified by:
      getSizeZ in interface loci.formats.IFormatReader
      Overrides:
      getSizeZ in class loci.formats.ReaderWrapper
    • getSizeC

      public int getSizeC()
      Specified by:
      getSizeC in interface loci.formats.IFormatReader
      Overrides:
      getSizeC in class loci.formats.ReaderWrapper
    • getSizeT

      public int getSizeT()
      Specified by:
      getSizeT in interface loci.formats.IFormatReader
      Overrides:
      getSizeT in class loci.formats.ReaderWrapper
    • getPixelType

      public int getPixelType()
      Specified by:
      getPixelType in interface loci.formats.IFormatReader
      Overrides:
      getPixelType in class loci.formats.ReaderWrapper
    • getBitsPerPixel

      public int getBitsPerPixel()
      Specified by:
      getBitsPerPixel in interface loci.formats.IFormatReader
      Overrides:
      getBitsPerPixel in class loci.formats.ReaderWrapper
    • isIndexed

      public boolean isIndexed()
      Specified by:
      isIndexed in interface loci.formats.IFormatReader
      Overrides:
      isIndexed in class loci.formats.ReaderWrapper
    • isFalseColor

      public boolean isFalseColor()
      Specified by:
      isFalseColor in interface loci.formats.IFormatReader
      Overrides:
      isFalseColor in class loci.formats.ReaderWrapper
    • get8BitLookupTable

      public byte[][] get8BitLookupTable() throws loci.formats.FormatException, IOException
      Specified by:
      get8BitLookupTable in interface loci.formats.IFormatReader
      Overrides:
      get8BitLookupTable in class loci.formats.ReaderWrapper
      Throws:
      loci.formats.FormatException
      IOException
    • get16BitLookupTable

      public short[][] get16BitLookupTable() throws loci.formats.FormatException, IOException
      Specified by:
      get16BitLookupTable in interface loci.formats.IFormatReader
      Overrides:
      get16BitLookupTable in class loci.formats.ReaderWrapper
      Throws:
      loci.formats.FormatException
      IOException
    • getThumbSizeX

      public int getThumbSizeX()
      Specified by:
      getThumbSizeX in interface loci.formats.IFormatReader
      Overrides:
      getThumbSizeX in class loci.formats.ReaderWrapper
    • getThumbSizeY

      public int getThumbSizeY()
      Specified by:
      getThumbSizeY in interface loci.formats.IFormatReader
      Overrides:
      getThumbSizeY in class loci.formats.ReaderWrapper
    • isLittleEndian

      public boolean isLittleEndian()
      Specified by:
      isLittleEndian in interface loci.formats.IFormatReader
      Overrides:
      isLittleEndian in class loci.formats.ReaderWrapper
    • getDimensionOrder

      public String getDimensionOrder()
      Specified by:
      getDimensionOrder in interface loci.formats.IFormatReader
      Overrides:
      getDimensionOrder in class loci.formats.ReaderWrapper
    • isOrderCertain

      public boolean isOrderCertain()
      Specified by:
      isOrderCertain in interface loci.formats.IFormatReader
      Overrides:
      isOrderCertain in class loci.formats.ReaderWrapper
    • isThumbnailSeries

      public boolean isThumbnailSeries()
      Specified by:
      isThumbnailSeries in interface loci.formats.IFormatReader
      Overrides:
      isThumbnailSeries in class loci.formats.ReaderWrapper
    • isInterleaved

      public boolean isInterleaved()
      Specified by:
      isInterleaved in interface loci.formats.IFormatReader
      Overrides:
      isInterleaved in class loci.formats.ReaderWrapper
    • isInterleaved

      public boolean isInterleaved(int subC)
      Specified by:
      isInterleaved in interface loci.formats.IFormatReader
      Overrides:
      isInterleaved in class loci.formats.ReaderWrapper
    • openBytes

      public byte[] openBytes(int no) throws loci.formats.FormatException, IOException
      Specified by:
      openBytes in interface loci.formats.IFormatReader
      Overrides:
      openBytes in class loci.formats.ReaderWrapper
      Throws:
      loci.formats.FormatException
      IOException
    • openBytes

      public byte[] openBytes(int no, byte[] buf) throws loci.formats.FormatException, IOException
      Specified by:
      openBytes in interface loci.formats.IFormatReader
      Overrides:
      openBytes in class loci.formats.ReaderWrapper
      Throws:
      loci.formats.FormatException
      IOException
    • openBytes

      public byte[] openBytes(int no, int x, int y, int w, int h) throws loci.formats.FormatException, IOException
      Specified by:
      openBytes in interface loci.formats.IFormatReader
      Overrides:
      openBytes in class loci.formats.ReaderWrapper
      Throws:
      loci.formats.FormatException
      IOException
    • openBytes

      public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws loci.formats.FormatException, IOException
      Specified by:
      openBytes in interface loci.formats.IFormatReader
      Overrides:
      openBytes in class loci.formats.ReaderWrapper
      Throws:
      loci.formats.FormatException
      IOException
    • openPlane

      public Object openPlane(int no, int x, int y, int w, int h) throws loci.formats.FormatException, IOException
      Specified by:
      openPlane in interface loci.formats.IFormatReader
      Overrides:
      openPlane in class loci.formats.ReaderWrapper
      Throws:
      loci.formats.FormatException
      IOException
    • openThumbBytes

      public byte[] openThumbBytes(int no) throws loci.formats.FormatException, IOException
      Specified by:
      openThumbBytes in interface loci.formats.IFormatReader
      Overrides:
      openThumbBytes in class loci.formats.ReaderWrapper
      Throws:
      loci.formats.FormatException
      IOException
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class loci.formats.ReaderWrapper
      Throws:
      IOException
    • close

      public void close(boolean fileOnly) throws IOException
      Specified by:
      close in interface loci.formats.IFormatReader
      Overrides:
      close in class loci.formats.ReaderWrapper
      Throws:
      IOException
    • getSeriesCount

      public int getSeriesCount()
      Specified by:
      getSeriesCount in interface loci.formats.IFormatReader
      Overrides:
      getSeriesCount in class loci.formats.ReaderWrapper
    • setSeries

      public void setSeries(int no)
      Specified by:
      setSeries in interface loci.formats.IFormatReader
      Overrides:
      setSeries in class loci.formats.ReaderWrapper
    • getSeries

      public int getSeries()
      Specified by:
      getSeries in interface loci.formats.IFormatReader
      Overrides:
      getSeries in class loci.formats.ReaderWrapper
    • setResolution

      public void setResolution(int no)
      Specified by:
      setResolution in interface loci.formats.IPyramidHandler
      Overrides:
      setResolution in class loci.formats.ReaderWrapper
    • getResolution

      public int getResolution()
      Specified by:
      getResolution in interface loci.formats.IPyramidHandler
      Overrides:
      getResolution in class loci.formats.ReaderWrapper
    • seriesToCoreIndex

      public int seriesToCoreIndex(int series)
      Specified by:
      seriesToCoreIndex in interface loci.formats.IFormatReader
      Overrides:
      seriesToCoreIndex in class loci.formats.ReaderWrapper
    • coreIndexToSeries

      public int coreIndexToSeries(int index)
      Specified by:
      coreIndexToSeries in interface loci.formats.IFormatReader
      Overrides:
      coreIndexToSeries in class loci.formats.ReaderWrapper
    • setCoreIndex

      public void setCoreIndex(int no)
      Specified by:
      setCoreIndex in interface loci.formats.IFormatReader
      Overrides:
      setCoreIndex in class loci.formats.ReaderWrapper
    • getCoreIndex

      public int getCoreIndex()
      Specified by:
      getCoreIndex in interface loci.formats.IFormatReader
      Overrides:
      getCoreIndex in class loci.formats.ReaderWrapper
    • setFlattenedResolutions

      public void setFlattenedResolutions(boolean flatten)
      Specified by:
      setFlattenedResolutions in interface loci.formats.IFormatReader
      Overrides:
      setFlattenedResolutions in class loci.formats.ReaderWrapper
    • setGroupFiles

      public void setGroupFiles(boolean group)
      Specified by:
      setGroupFiles in interface loci.formats.IFormatReader
      Overrides:
      setGroupFiles in class loci.formats.ReaderWrapper
    • isGroupFiles

      public boolean isGroupFiles()
      Specified by:
      isGroupFiles in interface loci.formats.IFormatReader
      Overrides:
      isGroupFiles in class loci.formats.ReaderWrapper
    • setMetadataOptions

      public void setMetadataOptions(loci.formats.in.MetadataOptions options)
      Specified by:
      setMetadataOptions in interface loci.formats.IMetadataConfigurable
      Overrides:
      setMetadataOptions in class loci.formats.ReaderWrapper
    • setNormalized

      public void setNormalized(boolean normalize)
      Specified by:
      setNormalized in interface loci.formats.IFormatReader
      Overrides:
      setNormalized in class loci.formats.ReaderWrapper
    • setOriginalMetadataPopulated

      public void setOriginalMetadataPopulated(boolean populate)
      Specified by:
      setOriginalMetadataPopulated in interface loci.formats.IFormatReader
      Overrides:
      setOriginalMetadataPopulated in class loci.formats.ReaderWrapper
    • getUsedFiles

      public String[] getUsedFiles()
      Specified by:
      getUsedFiles in interface loci.formats.IFormatReader
      Overrides:
      getUsedFiles in class loci.formats.ReaderWrapper
    • getUsedFiles

      public String[] getUsedFiles(boolean noPixels)
      Specified by:
      getUsedFiles in interface loci.formats.IFormatReader
      Overrides:
      getUsedFiles in class loci.formats.ReaderWrapper
    • getSeriesUsedFiles

      public String[] getSeriesUsedFiles()
      Specified by:
      getSeriesUsedFiles in interface loci.formats.IFormatReader
      Overrides:
      getSeriesUsedFiles in class loci.formats.ReaderWrapper
    • getSeriesUsedFiles

      public String[] getSeriesUsedFiles(boolean noPixels)
      Specified by:
      getSeriesUsedFiles in interface loci.formats.IFormatReader
      Overrides:
      getSeriesUsedFiles in class loci.formats.ReaderWrapper
    • getAdvancedUsedFiles

      public loci.formats.FileInfo[] getAdvancedUsedFiles(boolean noPixels)
      Specified by:
      getAdvancedUsedFiles in interface loci.formats.IFormatReader
      Overrides:
      getAdvancedUsedFiles in class loci.formats.ReaderWrapper
    • getAdvancedSeriesUsedFiles

      public loci.formats.FileInfo[] getAdvancedSeriesUsedFiles(boolean noPixels)
      Specified by:
      getAdvancedSeriesUsedFiles in interface loci.formats.IFormatReader
      Overrides:
      getAdvancedSeriesUsedFiles in class loci.formats.ReaderWrapper
    • getIndex

      public int getIndex(int z, int c, int t)
      Specified by:
      getIndex in interface loci.formats.IFormatReader
      Overrides:
      getIndex in class loci.formats.ReaderWrapper
    • getIndex

      public int getIndex(int z, int c, int t, int moduloZ, int moduloC, int moduloT)
      Specified by:
      getIndex in interface loci.formats.IFormatReader
      Overrides:
      getIndex in class loci.formats.ReaderWrapper
    • getZCTCoords

      public int[] getZCTCoords(int index)
      Specified by:
      getZCTCoords in interface loci.formats.IFormatReader
      Overrides:
      getZCTCoords in class loci.formats.ReaderWrapper
    • getZCTModuloCoords

      public int[] getZCTModuloCoords(int index)
      Specified by:
      getZCTModuloCoords in interface loci.formats.IFormatReader
      Overrides:
      getZCTModuloCoords in class loci.formats.ReaderWrapper
    • getSeriesMetadata

      public Hashtable<String,Object> getSeriesMetadata()
      Specified by:
      getSeriesMetadata in interface loci.formats.IFormatReader
      Overrides:
      getSeriesMetadata in class loci.formats.ReaderWrapper
    • getCoreMetadataList

      public List<loci.formats.CoreMetadata> getCoreMetadataList()
      Specified by:
      getCoreMetadataList in interface loci.formats.IFormatReader
      Overrides:
      getCoreMetadataList in class loci.formats.ReaderWrapper
    • setMetadataStore

      public void setMetadataStore(loci.formats.meta.MetadataStore store)
      Specified by:
      setMetadataStore in interface loci.formats.IFormatReader
      Overrides:
      setMetadataStore in class loci.formats.ReaderWrapper
    • getMetadataStore

      public loci.formats.meta.MetadataStore getMetadataStore()
      Specified by:
      getMetadataStore in interface loci.formats.IFormatReader
      Overrides:
      getMetadataStore in class loci.formats.ReaderWrapper
    • getMetadataStoreRoot

      public Object getMetadataStoreRoot()
      Specified by:
      getMetadataStoreRoot in interface loci.formats.IFormatReader
      Overrides:
      getMetadataStoreRoot in class loci.formats.ReaderWrapper
    • getUnderlyingReaders

      public loci.formats.IFormatReader[] getUnderlyingReaders()
      Specified by:
      getUnderlyingReaders in interface loci.formats.IFormatReader
      Overrides:
      getUnderlyingReaders in class loci.formats.ReaderWrapper
    • reopenFile

      public void reopenFile() throws IOException
      Specified by:
      reopenFile in interface loci.formats.IFormatReader
      Overrides:
      reopenFile in class loci.formats.ReaderWrapper
      Throws:
      IOException
    • setId

      public void setId(String id) throws loci.formats.FormatException, IOException
      Specified by:
      setId in interface loci.formats.IFormatHandler
      Overrides:
      setId in class loci.formats.ReaderWrapper
      Throws:
      loci.formats.FormatException
      IOException
    • openCompressedBytes

      public byte[] openCompressedBytes(int no, int x, int y) throws loci.formats.FormatException, IOException
      Specified by:
      openCompressedBytes in interface loci.formats.ICompressedTileReader
      Overrides:
      openCompressedBytes in class loci.formats.ReaderWrapper
      Throws:
      loci.formats.FormatException
      IOException
    • openCompressedBytes

      public byte[] openCompressedBytes(int no, byte[] buf, int x, int y) throws loci.formats.FormatException, IOException
      Specified by:
      openCompressedBytes in interface loci.formats.ICompressedTileReader
      Overrides:
      openCompressedBytes in class loci.formats.ReaderWrapper
      Throws:
      loci.formats.FormatException
      IOException
    • getTileCodec

      public loci.formats.codec.Codec getTileCodec(int no) throws loci.formats.FormatException, IOException
      Specified by:
      getTileCodec in interface loci.formats.ICompressedTileReader
      Overrides:
      getTileCodec in class loci.formats.ReaderWrapper
      Throws:
      loci.formats.FormatException
      IOException
    • getTileCodecOptions

      public loci.formats.codec.CodecOptions getTileCodecOptions(int no, int x, int y) throws loci.formats.FormatException, IOException
      Specified by:
      getTileCodecOptions in interface loci.formats.ICompressedTileReader
      Overrides:
      getTileCodecOptions in class loci.formats.ReaderWrapper
      Throws:
      loci.formats.FormatException
      IOException
    • initFile

      protected void initFile(String id) throws loci.formats.FormatException, IOException
      Initializes the given file or file pattern.
      Throws:
      loci.formats.FormatException
      IOException
    • computeAxisLengths

      protected void computeAxisLengths() throws loci.formats.FormatException
      Computes axis length arrays, and total axis lengths.
      Throws:
      loci.formats.FormatException
    • computeIndices

      protected int[] computeIndices(int no) throws loci.formats.FormatException, IOException
      Gets the file index, and image index into that file, corresponding to the given global image index.
      Returns:
      An array of size 2, dimensioned {file index, image index}.
      Throws:
      loci.formats.FormatException
      IOException
    • initReader

      protected void initReader(int sno, int fno)