Class FakeReader

java.lang.Object
loci.formats.FormatHandler
loci.formats.FormatReader
loci.formats.in.FakeReader
All Implemented Interfaces:
Closeable, AutoCloseable, loci.formats.IAxisOrientationReader, loci.formats.ICompressedTileReader, loci.formats.IFormatHandler, loci.formats.IFormatReader, loci.formats.IMetadataConfigurable, loci.formats.IPyramidHandler

public class FakeReader extends loci.formats.FormatReader implements loci.formats.IAxisOrientationReader
FakeReader is the file format reader for faking input data. It is mainly useful for testing.

Examples:

  • showinf 'multi-series&series=11&sizeZ=3&sizeC=5&sizeT=7&sizeY=50.fake' -series 9
  • showinf '8bit-signed&pixelType=int8&sizeZ=3&sizeC=5&sizeT=7&sizeY=50.fake'
  • showinf '8bit-unsigned&pixelType=uint8&sizeZ=3&sizeC=5&sizeT=7&sizeY=50.fake'
  • showinf '16bit-signed&pixelType=int16&sizeZ=3&sizeC=5&sizeT=7&sizeY=50.fake'
  • showinf '16bit-unsigned&pixelType=uint16&sizeZ=3&sizeC=5&sizeT=7&sizeY=50.fake'
  • showinf '32bit-signed&pixelType=int32&sizeZ=3&sizeC=5&sizeT=7&sizeY=50.fake'
  • showinf '32bit-unsigned&pixelType=uint32&sizeZ=3&sizeC=5&sizeT=7&sizeY=50.fake'
  • showinf '32bit-floating&pixelType=float&sizeZ=3&sizeC=5&sizeT=7&sizeY=50.fake'
  • showinf '64bit-floating&pixelType=double&sizeZ=3&sizeC=5&sizeT=7&sizeY=50.fake'
  • showinf 'SPW&plates=2&plateRows=3&plateCols=3&fields=8&plateAcqs=5.fake'
  • showinf 'SPW&screens=2&plates=1&plateRows=3&plateCols=3&fields=1&plateAcqs=1.fake'
  • showinf 'Plate&screens=0&plates=1&plateRows=3&plateCols=3&fields=8&plateAcqs=5.fake'
  • showinf 'regions&points=10&ellipses=5&rectangles=10.fake'
  • showinf 'pyramid&sizeX=10000&sizeY=10000&resolutions=5&resolutionScale=2.fake' -noflat -resolution 4
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final String
     
    static final int
     
    static final int
     
    static final int
     
    static final String
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     

    Fields inherited from class loci.formats.FormatReader

    core, coreIndex, datasetDescription, domains, fillColor, filterMetadata, flattenedResolutions, group, hasCompanionFiles, in, indexedAsRGB, metadata, metadataStore, normalizeData, resolution, saveOriginalMetadata, series, suffixNecessary, suffixSufficient, THUMBNAIL_DIMENSION

    Fields inherited from class loci.formats.FormatHandler

    COMPRESSION_SUFFIXES, currentId, format, LOGGER, metadataOptions, suffixes

    Fields inherited from interface loci.formats.IFormatReader

    CAN_GROUP, CANNOT_GROUP, MUST_GROUP
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new fake reader.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    close(boolean fileOnly)
     
    short[][]
     
    byte[][]
     
    loci.formats.Orientation[]
     
    loci.formats.ome.OMEXMLMetadata
     
    loci.formats.services.OMEXMLService
     
    int
     
    int
     
    getSeriesUsedFiles(boolean noPixels)
     
    loci.common.Region
    getTileBoundingBox(int no, int x, int y)
     
    loci.formats.codec.Codec
    getTileCodec(int no)
     
    loci.formats.codec.CodecOptions
    getTileCodecOptions(int no, int x, int y)
     
    int
     
    int
    getTileRows(int no)
     
    protected void
     
    boolean
     
    boolean
    isThisType(String name, boolean open)
     
    byte[]
    openBytes(int no, byte[] buf, int x, int y, int w, int h)
     
    byte[]
    openCompressedBytes(int no, byte[] buf, int x, int y)
     
    byte[]
    openCompressedBytes(int no, int x, int y)
     
    static int[]
    readSpecialPixels(byte[] plane)
    Read byte-encoded metadata from the given plane.
    static int[]
    readSpecialPixels(byte[] plane, int pixelType, boolean little)
    Read byte-encoded metadata from the given plane.
    static int[]
    readSpecialPixels(byte[] plane, int pixelType, boolean little, int rgb, boolean interleaved)
    Read byte-encoded metadata from the given plane.
    void
     

    Methods inherited from class loci.formats.FormatReader

    addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMetaList, addMeta, addMetaList, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMetaList, close, coreIndexToSeries, fileGroupOption, flattenHashtables, getAcquisitionMode, getAdvancedSeriesUsedFiles, getAdvancedUsedFiles, getArcType, getAvailableOptions, getBinning, getBitsPerPixel, getCompression, getContrastMethod, getCoreIndex, getCoreMetadataList, getCorrection, getCurrentCore, getCurrentFile, getDatasetStructureDescription, getDetectorType, getDimensionOrder, getDimensionOrder, getDomains, getEffectiveSizeC, getExperimentType, getFilamentType, getFillColor, getFillRule, getFilterType, getFontFamily, getFontStyle, getGlobalMeta, getGlobalMetadata, getIlluminationType, getImageCount, getImmersion, getIndex, getIndex, getLaserMedium, getLaserType, getMarker, getMedium, getMetadataStore, getMetadataStoreRoot, getMetadataValue, getMicrobeamManipulationType, getMicroscopeType, getModuloC, getModuloT, getModuloZ, getNamingConvention, getPixelType, getPixelType, getPossibleDomains, getPulse, getRequiredDirectories, getResolution, getResolutionCount, getRGBChannelCount, getRotationTransform, getSeries, getSeriesCount, getSeriesMeta, getSeriesMetadata, getSeriesMetadataValue, getSeriesUsedFiles, getSizeC, getSizeT, getSizeX, getSizeY, getSizeZ, getThumbSizeX, getThumbSizeY, getUnderlyingReaders, getUsedFiles, getUsedFiles, getZCTCoords, getZCTModuloCoords, hasCompanionFiles, hasFlattenedResolutions, isFalseColor, isGroupFiles, isIndexed, isInterleaved, isInterleaved, isLittleEndian, isMetadataComplete, isMetadataFiltered, isNormalized, isOrderCertain, isOriginalMetadataPopulated, isRGB, isThisType, isThisType, isThisType, isThumbnailSeries, isUsedFile, makeFilterMetadata, openBytes, openBytes, openBytes, openPlane, openThumbBytes, readPlane, readPlane, readPlane, seriesToCoreIndex, setCoreIndex, setFillColor, setFlattenedResolutions, setGroupFiles, setId, setMetadataFiltered, setMetadataStore, setNormalized, setOriginalMetadataPopulated, setResolution, setSeries, updateMetadataLists

    Methods inherited from class loci.formats.FormatHandler

    checkSuffix, checkSuffix, getFormat, getMetadataOptions, getNativeDataType, getSuffixes, getSupportedMetadataLevels, setMetadataOptions

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface loci.formats.IFormatHandler

    getFormat, getNativeDataType, getSuffixes

    Methods inherited from interface loci.formats.IMetadataConfigurable

    getMetadataOptions, getSupportedMetadataLevels, setMetadataOptions
  • Field Details

  • Constructor Details

    • FakeReader

      public FakeReader()
      Constructs a new fake reader.
  • Method Details

    • readSpecialPixels

      public static int[] readSpecialPixels(byte[] plane)
      Read byte-encoded metadata from the given plane.
      See Also:
    • readSpecialPixels

      public static int[] readSpecialPixels(byte[] plane, int pixelType, boolean little)
      Read byte-encoded metadata from the given plane.
      See Also:
    • readSpecialPixels

      public static int[] readSpecialPixels(byte[] plane, int pixelType, boolean little, int rgb, boolean interleaved)
      Read byte-encoded metadata from the given plane.

      FakeReader encodes the following information in the upper-left section of each plane: series, plane number, Z index, C index, T index. Given an image plane generated by FakeReader (or by anything that follows the same encoding rules), this method decodes the above information and returns it as an array of integers.

      Note that the above numbers are encoded as valid pixels, so that the information is still retrievable after conversion to a pixel-oriented image format (this allows to use the class for testing the ImageJ plugin). Among other things, this implies that the maximum encodable values depend on the pixel type.

      Note:

      In the case of indexed color data, the returned values will be the indices of the actual values in the relevant lookup table (see get8BitLookupTable() and get16BitLookupTable()).

      Parameters:
      plane - an image plane as a byte array
      pixelType - the pixel type of the image; see FormatTools
      little - true if the byte order is little-endian, false otherwise
      rgb - the RGB channel count
      interleaved - true if the channels are interleaved, false otherwise
      Returns:
      an array of integers representing, in order: series; plane number; Z index; C index, T index
    • getTileRows

      public int getTileRows(int no)
      Specified by:
      getTileRows in interface loci.formats.ICompressedTileReader
      Overrides:
      getTileRows in class loci.formats.FormatReader
    • getTileColumns

      public int getTileColumns(int no)
      Specified by:
      getTileColumns in interface loci.formats.ICompressedTileReader
      Overrides:
      getTileColumns in class loci.formats.FormatReader
    • getTileBoundingBox

      public loci.common.Region getTileBoundingBox(int no, int x, int y)
      Specified by:
      getTileBoundingBox in interface loci.formats.ICompressedTileReader
    • openCompressedBytes

      public byte[] openCompressedBytes(int no, int x, int y) throws loci.formats.FormatException, IOException
      Specified by:
      openCompressedBytes in interface loci.formats.ICompressedTileReader
      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
      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
      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
      Throws:
      loci.formats.FormatException
      IOException
    • getAxisOrientations

      public loci.formats.Orientation[] getAxisOrientations()
      Specified by:
      getAxisOrientations in interface loci.formats.IAxisOrientationReader
    • get8BitLookupTable

      public byte[][] get8BitLookupTable() throws loci.formats.FormatException, IOException
      Specified by:
      get8BitLookupTable in interface loci.formats.IFormatReader
      Overrides:
      get8BitLookupTable in class loci.formats.FormatReader
      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.FormatReader
      Throws:
      loci.formats.FormatException
      IOException
    • getOptimalTileWidth

      public int getOptimalTileWidth()
      Specified by:
      getOptimalTileWidth in interface loci.formats.IFormatReader
      Overrides:
      getOptimalTileWidth in class loci.formats.FormatReader
    • getOptimalTileHeight

      public int getOptimalTileHeight()
      Specified by:
      getOptimalTileHeight in interface loci.formats.IFormatReader
      Overrides:
      getOptimalTileHeight in class loci.formats.FormatReader
    • 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
      Specified by:
      openBytes in class loci.formats.FormatReader
      Throws:
      loci.formats.FormatException
      IOException
    • isSingleFile

      public boolean isSingleFile(String id) throws loci.formats.FormatException, IOException
      Specified by:
      isSingleFile in interface loci.formats.IFormatReader
      Overrides:
      isSingleFile in class loci.formats.FormatReader
      Throws:
      loci.formats.FormatException
      IOException
    • isThisType

      public boolean isThisType(String name, boolean open)
      Specified by:
      isThisType in interface loci.formats.IFormatReader
      Overrides:
      isThisType in class loci.formats.FormatReader
    • getSeriesUsedFiles

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

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

      public loci.formats.ome.OMEXMLMetadata getOmeXmlMetadata()
    • getOmeXmlService

      public loci.formats.services.OMEXMLService getOmeXmlService()
    • initFile

      protected void initFile(String id) throws loci.formats.FormatException, IOException
      Overrides:
      initFile in class loci.formats.FormatReader
      Throws:
      loci.formats.FormatException
      IOException
    • reopenFile

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