Package loci.formats

Class FormatReader

java.lang.Object
loci.formats.FormatHandler
loci.formats.FormatReader
All Implemented Interfaces:
Closeable, AutoCloseable, ICompressedTileReader, IFormatHandler, IFormatReader, IMetadataConfigurable, IPyramidHandler
Direct Known Subclasses:
AFIReader, AIMReader, AliconaReader, AmiraReader, AnalyzeReader, APLReader, APNGReader, ARFReader, AVIReader, BaseZeissReader, BDReader, BDVReader, BIFormatReader, BioRadGelReader, BioRadReader, BioRadSCNReader, BMPReader, BrukerReader, BurleighReader, CanonRawReader, CellH5Reader, CellomicsReader, CellSensReader, CellVoyagerReader, CellWorxReader, ColumbusReader, CV7000Reader, DCIMGReader, DelegateReader, DeltavisionReader, Ecat7Reader, EPSReader, FakeReader, FEIReader, FitsReader, FlexReader, FlowSightReader, FujiReader, FV1000Reader, GatanDM2Reader, GatanReader, GIFReader, HamamatsuVMSReader, HISReader, HitachiReader, HRDGDFReader, I2IReader, ICSReader, IM3Reader, ImagicReader, ImarisReader, IMODReader, ImspectorReader, InCell3000Reader, InCellReader, INRReader, InveonReader, IPLabReader, IPWReader, IvisionReader, JDCEReader, JEOLReader, JPEG2000Reader, JPXReader, KhorosReader, KLBReader, KodakReader, L2DReader, LeicaReader, LiFlimReader, LIFReader, LIMReader, LMSFileReader, MIASReader, MicroCTReader, MicromanagerReader, MINCReader, MolecularImagingReader, MRCReader, MRWReader, NAFReader, NDPISReader, NiftiReader, NRRDReader, OBFReader, OIRReader, OlympusTileReader, OMEXMLReader, OpenlabRawReader, OpenlabReader, OperettaReader, OxfordInstrumentsReader, PCIReader, PCORAWReader, PCXReader, PDSReader, PerkinElmerReader, PGMReader, PictReader, PovrayReader, PQBinReader, PrairieReader, PSDReader, QTReader, QuesantReader, RHKReader, SBIGReader, ScanrReader, SDTReader, SeikoReader, SIFReader, SlideBook7Reader, SlidebookReader, SMCameraReader, SPCReader, SPEReader, SpiderReader, SubResolutionFormatReader, TargaReader, TCSReader, TecanReader, TextReader, TileJPEGReader, TillVisionReader, TissueFAXSReader, TopometrixReader, UBMReader, UnisokuReader, VarianFDFReader, VeecoReader, VGSAMReader, VisitechReader, VolocityClippingReader, VolocityReader, WATOPReader, WrappedReader, ZeissCZIReader, ZeissLMSReader, ZeissLSMReader, ZeissXRMReader, ZipReader

public abstract class FormatReader extends FormatHandler implements IFormatReader
Abstract superclass of all biological file format readers.
  • Field Details

    • THUMBNAIL_DIMENSION

      protected static final int THUMBNAIL_DIMENSION
      Default thumbnail width and height.
      See Also:
    • in

      protected transient loci.common.RandomAccessInputStream in
      Current file.
    • metadata

      protected Hashtable<String,Object> metadata
      Hashtable containing metadata key/value pairs.
    • coreIndex

      protected int coreIndex
      The number of the current series.
    • series

      protected int series
      The number of the current series (non flat).
    • core

      protected List<CoreMetadata> core
      Core metadata values.
    • resolution

      protected int resolution
      The number of the current resolution.
    • flattenedResolutions

      protected boolean flattenedResolutions
      Whether or not resolutions are flattened.
    • suffixNecessary

      protected boolean suffixNecessary
      Whether the file extension matching one of the reader's suffixes is necessary to identify the file as an instance of this format.
    • suffixSufficient

      protected boolean suffixSufficient
      Whether the file extension matching one of the reader's suffixes is sufficient to identify the file as an instance of this format.
    • hasCompanionFiles

      protected boolean hasCompanionFiles
      Whether this format supports multi-file datasets.
    • datasetDescription

      protected String datasetDescription
      Short description of the structure of the dataset.
    • normalizeData

      protected boolean normalizeData
      Whether or not to normalize float data.
    • filterMetadata

      protected boolean filterMetadata
      Whether or not to filter out invalid metadata.
    • saveOriginalMetadata

      protected boolean saveOriginalMetadata
      Whether or not to save proprietary metadata in the MetadataStore.
    • indexedAsRGB

      protected boolean indexedAsRGB
      Whether or not MetadataStore sets C = 3 for indexed color images.
    • group

      protected boolean group
      Whether or not to group multi-file formats.
    • fillColor

      protected Byte fillColor
      Fill value for undefined pixels.
    • domains

      protected String[] domains
      List of domains in which this format is used.
    • metadataStore

      protected MetadataStore metadataStore
      Current metadata store. Should never be accessed directly as the semantics of getMetadataStore() prevent "null" access.
    • factory

      private loci.common.services.ServiceFactory factory
    • service

      private OMEXMLService service
  • Constructor Details

    • FormatReader

      public FormatReader(String format, String suffix)
      Constructs a format reader with the given name and default suffix.
    • FormatReader

      public FormatReader(String format, String[] suffixes)
      Constructs a format reader with the given name and default suffixes.
  • Method Details

    • 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
      Throws:
      IOException
    • initFile

      protected void initFile(String id) throws FormatException, IOException
      Initializes the given file (parsing header information, etc.). Most subclasses should override this method to perform initialization operations such as parsing metadata.
      Throws:
      FormatException - if a parsing error occurs processing the file.
      IOException - if an I/O error occurs processing the file
    • getAvailableOptions

      protected ArrayList<String> getAvailableOptions()
      Returns the list of available metadata options.
    • isUsedFile

      protected boolean isUsedFile(String file)
      Returns true if the given file name is in the used files list.
    • addMeta

      protected void addMeta(String key, Object value, Hashtable<String,Object> meta)
      Adds an entry to the specified Hashtable.
    • addGlobalMeta

      protected void addGlobalMeta(String key, Object value)
      Adds an entry to the global metadata table.
    • addGlobalMeta

      protected void addGlobalMeta(String key, boolean value)
      Adds an entry to the global metadata table.
    • addGlobalMeta

      protected void addGlobalMeta(String key, byte value)
      Adds an entry to the global metadata table.
    • addGlobalMeta

      protected void addGlobalMeta(String key, short value)
      Adds an entry to the global metadata table.
    • addGlobalMeta

      protected void addGlobalMeta(String key, int value)
      Adds an entry to the global metadata table.
    • addGlobalMeta

      protected void addGlobalMeta(String key, long value)
      Adds an entry to the global metadata table.
    • addGlobalMeta

      protected void addGlobalMeta(String key, float value)
      Adds an entry to the global metadata table.
    • addGlobalMeta

      protected void addGlobalMeta(String key, double value)
      Adds an entry to the global metadata table.
    • addGlobalMeta

      protected void addGlobalMeta(String key, char value)
      Adds an entry to the global metadata table.
    • getGlobalMeta

      protected Object getGlobalMeta(String key)
      Gets a value from the global metadata table.
    • addMetaList

      protected void addMetaList(String key, Object value, Hashtable<String,Object> meta)
      Add the given key/value pair to the given hashtable. If the key already exists, a list will be stored in the hashtable and the value will be appended to the list.
      Parameters:
      key - the key to store in the hashtable
      value - the value to store in the hashtable or list
      meta - the hashtable in which to store the key/value
    • addGlobalMetaList

      protected void addGlobalMetaList(String key, Object value)
      Add the given key/value pair to the global metadata hashtable. If the key already exists, a list will be stored in the hashtable and the value will be appended to the list.
      Parameters:
      key - the key to store in the hashtable
      value - the value to store in the hashtable or list
    • addSeriesMetaList

      protected void addSeriesMetaList(String key, Object value)
      Add the given key/value pair to the current series metadata hashtable. If the key already exists, a list will be stored in the hashtable and the value will be appended to the list.
    • flattenHashtables

      protected void flattenHashtables()
      Call updateMetadataLists(Hashtable) on all metadata hashtables.
    • updateMetadataLists

      protected void updateMetadataLists(Hashtable<String,Object> meta)
      For the given metadata hashtable, replace any value that is a list with one key/value pair per list entry. The new keys will be the original key with the list index appended.
      Parameters:
      meta - the hashtable from which to remove lists
    • addSeriesMeta

      protected void addSeriesMeta(String key, Object value)
      Adds an entry to the metadata table for the current series.
    • addSeriesMeta

      protected void addSeriesMeta(String key, boolean value)
      Adds an entry to the metadata table for the current series.
    • addSeriesMeta

      protected void addSeriesMeta(String key, byte value)
      Adds an entry to the metadata table for the current series.
    • addSeriesMeta

      protected void addSeriesMeta(String key, short value)
      Adds an entry to the metadata table for the current series.
    • addSeriesMeta

      protected void addSeriesMeta(String key, int value)
      Adds an entry to the metadata table for the current series.
    • addSeriesMeta

      protected void addSeriesMeta(String key, long value)
      Adds an entry to the metadata table for the current series.
    • addSeriesMeta

      protected void addSeriesMeta(String key, float value)
      Adds an entry to the metadata table for the current series.
    • addSeriesMeta

      protected void addSeriesMeta(String key, double value)
      Adds an entry to the metadata table for the current series.
    • addSeriesMeta

      protected void addSeriesMeta(String key, char value)
      Adds an entry to the metadata table for the current series.
    • getSeriesMeta

      protected Object getSeriesMeta(String key)
      Gets an entry from the metadata table for the current series.
    • readPlane

      protected byte[] readPlane(loci.common.RandomAccessInputStream s, int x, int y, int w, int h, byte[] buf) throws IOException
      Reads a raw plane from disk.
      Throws:
      IOException
    • readPlane

      protected byte[] readPlane(loci.common.RandomAccessInputStream s, int x, int y, int w, int h, int scanlinePad, byte[] buf) throws IOException
      Reads a raw plane from disk.
      Throws:
      IOException
    • readPlane

      protected byte[] readPlane(loci.common.RandomAccessInputStream s, int x, int y, int w, int h, int scanlinePad, int imageWidth, int imageHeight, byte[] buf) throws IOException
      Throws:
      IOException
    • makeFilterMetadata

      protected MetadataStore makeFilterMetadata()
      Return a properly configured loci.formats.meta.FilterMetadata.
    • isThisType

      public boolean isThisType(String name, boolean open)
      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 isThisType(RandomAccessInputStream).
      Specified by:
      isThisType in interface IFormatReader
      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(byte[] block)
      Description copied from interface: IFormatReader
      Checks if the given block is a valid header for this file format.
      Specified by:
      isThisType in interface IFormatReader
      See Also:
    • 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
      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
    • getImageCount

      public int getImageCount()
      Description copied from interface: IFormatReader
      Determines the number of image planes in the current file.
      Specified by:
      getImageCount in interface IFormatReader
    • isRGB

      public boolean isRGB()
      Description copied from interface: IFormatReader
      Checks if the image planes in the file have more than one channel per IFormatReader.openBytes(int) call. This method returns true if and only if IFormatReader.getRGBChannelCount() returns a value greater than 1.
      Specified by:
      isRGB in interface IFormatReader
    • getSizeX

      public int getSizeX()
      Description copied from interface: IFormatReader
      Gets the size of the X dimension.
      Specified by:
      getSizeX in interface IFormatReader
    • getSizeY

      public int getSizeY()
      Description copied from interface: IFormatReader
      Gets the size of the Y dimension.
      Specified by:
      getSizeY in interface IFormatReader
    • getSizeZ

      public int getSizeZ()
      Description copied from interface: IFormatReader
      Gets the size of the Z dimension.
      Specified by:
      getSizeZ in interface IFormatReader
    • getSizeC

      public int getSizeC()
      Description copied from interface: IFormatReader
      Gets the size of the C dimension.
      Specified by:
      getSizeC in interface IFormatReader
    • getSizeT

      public int getSizeT()
      Description copied from interface: IFormatReader
      Gets the size of the T dimension.
      Specified by:
      getSizeT in interface IFormatReader
    • getPixelType

      public int getPixelType()
      Description copied from interface: IFormatReader
      Gets the pixel type.
      Specified by:
      getPixelType in interface IFormatReader
      Returns:
      the pixel type as an enumeration from FormatTools static pixel types such as FormatTools.INT8.
    • getBitsPerPixel

      public int getBitsPerPixel()
      Description copied from interface: IFormatReader
      Gets the number of valid bits per pixel. The number of valid bits per pixel is always less than or equal to the number of bits per pixel that correspond to IFormatReader.getPixelType().
      Specified by:
      getBitsPerPixel in interface IFormatReader
    • getEffectiveSizeC

      public int getEffectiveSizeC()
      Description copied from interface: IFormatReader
      Gets the effective size of the C dimension, guaranteeing that getEffectiveSizeC() * getSizeZ() * getSizeT() == getImageCount() regardless of the result of isRGB().
      Specified by:
      getEffectiveSizeC in interface IFormatReader
    • getRGBChannelCount

      public int getRGBChannelCount()
      Description copied from interface: IFormatReader
      Gets the number of channels returned with each call to openBytes. The most common case where this value is greater than 1 is for interleaved RGB data, such as a 24-bit color image plane. However, it is possible for this value to be greater than 1 for non-interleaved data, such as an RGB TIFF with Planar rather than Chunky configuration.
      Specified by:
      getRGBChannelCount in interface IFormatReader
    • isIndexed

      public boolean isIndexed()
      Description copied from interface: IFormatReader
      Gets whether the image planes are indexed color. This value has no impact on IFormatReader.getSizeC(), IFormatReader.getEffectiveSizeC() or IFormatReader.getRGBChannelCount().
      Specified by:
      isIndexed in interface IFormatReader
    • isFalseColor

      public boolean isFalseColor()
      Description copied from interface: IFormatReader
      Returns false if IFormatReader.isIndexed() is false, or if IFormatReader.isIndexed() is true and the lookup table represents "real" color data. Returns true if IFormatReader.isIndexed() is true and the lookup table is only present to aid in visualization.
      Specified by:
      isFalseColor in interface IFormatReader
    • get8BitLookupTable

      public byte[][] get8BitLookupTable() throws FormatException, IOException
      Description copied from interface: IFormatReader
      Gets the 8-bit color lookup table associated with the most recently opened image. If no image planes have been opened, or if IFormatReader.isIndexed() returns false, then this may return null. Also, if IFormatReader.getPixelType() returns anything other than FormatTools.INT8 or FormatTools.UINT8, this method will return null.
      Specified by:
      get8BitLookupTable in interface IFormatReader
      Throws:
      FormatException
      IOException
    • get16BitLookupTable

      public short[][] get16BitLookupTable() throws FormatException, IOException
      Description copied from interface: IFormatReader
      Gets the 16-bit color lookup table associated with the most recently opened image. If no image planes have been opened, or if IFormatReader.isIndexed() returns false, then this may return null. Also, if IFormatReader.getPixelType() returns anything other than FormatTools.INT16 or FormatTools.UINT16, this method will return null.
      Specified by:
      get16BitLookupTable in interface IFormatReader
      Throws:
      FormatException
      IOException
    • getModuloZ

      public Modulo getModuloZ()
      Specified by:
      getModuloZ in interface IFormatReader
    • getModuloC

      public Modulo getModuloC()
      Specified by:
      getModuloC in interface IFormatReader
    • getModuloT

      public Modulo getModuloT()
      Specified by:
      getModuloT in interface IFormatReader
    • getThumbSizeX

      public int getThumbSizeX()
      Description copied from interface: IFormatReader
      Get the size of the X dimension for the thumbnail.
      Specified by:
      getThumbSizeX in interface IFormatReader
    • getThumbSizeY

      public int getThumbSizeY()
      Description copied from interface: IFormatReader
      Get the size of the Y dimension for the thumbnail.
      Specified by:
      getThumbSizeY in interface IFormatReader
    • isLittleEndian

      public boolean isLittleEndian()
      Description copied from interface: IFormatReader
      Gets whether the data is in little-endian format.
      Specified by:
      isLittleEndian in interface IFormatReader
    • getDimensionOrder

      public String getDimensionOrder()
      Description copied from interface: IFormatReader
      Gets a five-character string representing the dimension order in which planes will be returned. Valid orders are:
      • XYCTZ
      • XYCZT
      • XYTCZ
      • XYTZC
      • XYZCT
      • XYZTC
      In cases where the channels are interleaved (e.g., CXYTZ), C will be the first dimension after X and Y (e.g., XYCTZ) and the IFormatReader.isInterleaved() method will return true.
      Specified by:
      getDimensionOrder in interface IFormatReader
    • isOrderCertain

      public boolean isOrderCertain()
      Description copied from interface: IFormatReader
      Gets whether the dimension order and sizes are known, or merely guesses.
      Specified by:
      isOrderCertain in interface IFormatReader
    • isThumbnailSeries

      public boolean isThumbnailSeries()
      Description copied from interface: IFormatReader
      Gets whether the current series is a lower resolution copy of a different series.
      Specified by:
      isThumbnailSeries in interface IFormatReader
    • isInterleaved

      public boolean isInterleaved()
      Description copied from interface: IFormatReader
      Gets whether or not the channels are interleaved. This method exists because X and Y must appear first in the dimension order. For interleaved data, IFormatReader.getDimensionOrder() returns XYCTZ or XYCZT, and this method returns true. Note that this flag returns whether or not the data returned by IFormatReader.openBytes(int) is interleaved. In most cases, this will match the interleaving in the original file, but for some formats (e.g. TIFF) channel re-ordering is done internally and the return value of this method will not match what is in the original file.
      Specified by:
      isInterleaved in interface IFormatReader
    • isInterleaved

      public boolean isInterleaved(int subC)
      Description copied from interface: IFormatReader
      Gets whether or not the given sub-channel is interleaved. This method exists because some data with multiple rasterized sub-dimensions within C have one sub-dimension interleaved, and the other not—e.g., SDTReader handles spectral-lifetime data with interleaved lifetime bins and non-interleaved spectral channels.
      Specified by:
      isInterleaved in interface IFormatReader
    • openBytes

      public byte[] openBytes(int no) throws FormatException, IOException
      Description copied from interface: IFormatReader
      Obtains the specified image plane from the current file as a byte array.
      Specified by:
      openBytes in interface IFormatReader
      Throws:
      FormatException
      IOException
      See Also:
    • openBytes

      public byte[] openBytes(int no, byte[] buf) throws FormatException, IOException
      Description copied from interface: IFormatReader
      Obtains the specified image plane from the current file into a pre-allocated byte array of (sizeX * sizeY * bytesPerPixel * RGB channel count).
      Specified by:
      openBytes in interface IFormatReader
      Parameters:
      no - the plane index within the current series.
      buf - a pre-allocated buffer.
      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.
    • openBytes

      public byte[] openBytes(int no, 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, whose upper-left corner is given by (x, y).
      Specified by:
      openBytes in interface IFormatReader
      Throws:
      FormatException
      IOException
    • openBytes

      public abstract 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
      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.
    • openPlane

      public Object openPlane(int no, int x, int y, int w, int h) throws FormatException, IOException
      Description copied from interface: IFormatReader
      Obtains the specified image plane (or sub-image thereof) in the reader's native data structure. For most readers this is a byte array; however, some readers call external APIs that work with other types such as BufferedImage. The openPlane method exists to maintain generality and efficiency while avoiding pollution of the API with AWT-specific logic.
      Specified by:
      openPlane in interface IFormatReader
      Throws:
      FormatException
      IOException
      See Also:
    • openThumbBytes

      public byte[] openThumbBytes(int no) throws FormatException, IOException
      Description copied from interface: IFormatReader
      Obtains a thumbnail for the specified image plane from the current file, as a byte array.
      Specified by:
      openThumbBytes in interface IFormatReader
      Throws:
      FormatException
      IOException
    • 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
      Throws:
      IOException
    • getSeriesCount

      public int getSeriesCount()
      Description copied from interface: IFormatReader
      Gets the number of series in this file.
      Specified by:
      getSeriesCount in interface IFormatReader
    • setSeries

      public void setSeries(int no)
      Description copied from interface: IFormatReader
      Activates the specified series. This also resets the resolution to 0.
      Specified by:
      setSeries in interface IFormatReader
    • getSeries

      public int getSeries()
      Description copied from interface: IFormatReader
      Gets the currently active series.
      Specified by:
      getSeries in interface IFormatReader
    • setGroupFiles

      public void setGroupFiles(boolean groupFiles)
      Description copied from interface: IFormatReader
      Specifies whether or not to force grouping in multi-file formats.
      Specified by:
      setGroupFiles in interface IFormatReader
      See Also:
    • isGroupFiles

      public boolean isGroupFiles()
      Description copied from interface: IFormatReader
      Returns true if we should group files in multi-file formats.
      Specified by:
      isGroupFiles in interface IFormatReader
      See Also:
    • fileGroupOption

      public int fileGroupOption(String id) throws FormatException, IOException
      Description copied from interface: IFormatReader
      Returns an indication of whether the files in a multi-file dataset can be handled individually. This method is only useful for formats and datasets which contain multiple files.
      Specified by:
      fileGroupOption in interface IFormatReader
      Parameters:
      id - a file in the multi-file dataset
      Returns:
      an int indicating that we cannot, must, or might group the files. A return value of FormatTools.MUST_GROUP indicates that the files cannot be handled separately; the reader will always detect and read all files in the dataset. FormatTools.CAN_GROUP indicates that the files may be handled separately, but file grouping must then be disabled via IFormatReader.setGroupFiles(boolean). FormatTools.CANNOT_GROUP indicates that the files must be handled separately; the reader will not attempt to read all files in the dataset (this is rare).
      Throws:
      FormatException
      IOException
      See Also:
    • setFillColor

      public void setFillColor(Byte color)
      Description copied from interface: IFormatReader
      Set the fill value for undefined pixels. This can be used to override the default fill value defined in a reader. The default implementation in IFormatReader is a no-op.
      Specified by:
      setFillColor in interface IFormatReader
      Parameters:
      color - value that will be used to fill pixel byte arrays
    • getFillColor

      public Byte getFillColor()
      Description copied from interface: IFormatReader
      Return the fill value for undefined pixels. The default implementation in IFormatReader always returns 0.
      Specified by:
      getFillColor in interface IFormatReader
      See Also:
    • isMetadataComplete

      public boolean isMetadataComplete()
      Description copied from interface: IFormatReader
      Returns true if this format's metadata is completely parsed.
      Specified by:
      isMetadataComplete in interface IFormatReader
    • setNormalized

      public void setNormalized(boolean normalize)
      Description copied from interface: IFormatReader
      Specifies whether or not to normalize float data.
      Specified by:
      setNormalized in interface IFormatReader
    • isNormalized

      public boolean isNormalized()
      Description copied from interface: IFormatReader
      Returns true if we should normalize float data.
      Specified by:
      isNormalized in interface IFormatReader
    • setOriginalMetadataPopulated

      public void setOriginalMetadataPopulated(boolean populate)
      Description copied from interface: IFormatReader
      Specifies whether or not to save proprietary metadata in the MetadataStore.
      Specified by:
      setOriginalMetadataPopulated in interface IFormatReader
    • isOriginalMetadataPopulated

      public boolean isOriginalMetadataPopulated()
      Description copied from interface: IFormatReader
      Returns true if we should save proprietary metadata in the MetadataStore.
      Specified by:
      isOriginalMetadataPopulated in interface IFormatReader
    • getUsedFiles

      public String[] getUsedFiles()
      Description copied from interface: IFormatReader
      Returns an array of filenames needed to open this dataset. The first element in the array is expected to be the path passed to IFormatHandler.setId(String). 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:
      getUsedFiles in interface IFormatReader
    • getUsedFiles

      public String[] getUsedFiles(boolean noPixels)
      Description copied from interface: IFormatReader
      Returns an array of filenames needed to open this dataset. 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:
      getUsedFiles in interface IFormatReader
    • getSeriesUsedFiles

      public String[] getSeriesUsedFiles()
      Description copied from interface: IFormatReader
      Returns an array of filenames needed to open the current series. The first element in the array is expected to be the path passed to IFormatHandler.setId(String). 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
    • 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
    • getAdvancedUsedFiles

      public FileInfo[] getAdvancedUsedFiles(boolean noPixels)
      Description copied from interface: IFormatReader
      Returns an array of FileInfo objects representing the files needed to open this dataset. If the 'noPixels' flag is set, then only files that do not contain pixel data will be returned.
      Specified by:
      getAdvancedUsedFiles in interface IFormatReader
    • getAdvancedSeriesUsedFiles

      public FileInfo[] getAdvancedSeriesUsedFiles(boolean noPixels)
      Description copied from interface: IFormatReader
      Returns an array of FileInfo objects representing the files needed to open the current series. If the 'noPixels' flag is set, then only files that do not contain pixel data will be returned.
      Specified by:
      getAdvancedSeriesUsedFiles in interface IFormatReader
    • getCurrentFile

      public String getCurrentFile()
      Description copied from interface: IFormatReader
      Returns the current file.
      Specified by:
      getCurrentFile in interface IFormatReader
    • getIndex

      public int getIndex(int z, int c, int t)
      Description copied from interface: IFormatReader
      Gets the rasterized index corresponding to the given Z, C and T coordinates (real sizes).
      Specified by:
      getIndex in interface IFormatReader
    • getIndex

      public int getIndex(int z, int c, int t, int moduloZ, int moduloC, int moduloT)
      Description copied from interface: IFormatReader
      Gets the rasterized index corresponding to the given Z, C, T, moduloZ, moduloC and moduloT coordinates (effective sizes). Note that the Z, C and T coordinates take the modulo dimension sizes into account. The effective size for each of these dimensions is limited to the total size of the dimension divided by the modulo size.
      Specified by:
      getIndex in interface IFormatReader
    • getZCTCoords

      public int[] getZCTCoords(int index)
      Description copied from interface: IFormatReader
      Gets the Z, C and T coordinates (real sizes) corresponding to the given rasterized index value.
      Specified by:
      getZCTCoords in interface IFormatReader
    • getZCTModuloCoords

      public int[] getZCTModuloCoords(int index)
      Description copied from interface: IFormatReader
      Gets the Z, C, T, moduloZ, moduloC and moduloT coordinates (effective sizes) corresponding to the given rasterized index value. Note that the Z, C and T coordinates are not the same as those returned by getZCTCoords(int) because the size of the modulo dimensions is taken into account. The effective size for each of these dimensions is limited to the total size of the dimension divided by the modulo size.
      Specified by:
      getZCTModuloCoords in interface IFormatReader
    • getMetadataValue

      public Object getMetadataValue(String field)
      Description copied from interface: IFormatReader
      Obtains the specified metadata field's value for the current file.
      Specified by:
      getMetadataValue in interface IFormatReader
      Parameters:
      field - the name associated with the metadata field
      Returns:
      the value, or null if the field doesn't exist
    • getSeriesMetadataValue

      public Object getSeriesMetadataValue(String field)
      Description copied from interface: IFormatReader
      Obtains the specified metadata field's value for the current series in the current file.
      Specified by:
      getSeriesMetadataValue in interface IFormatReader
      Parameters:
      field - the name associated with the metadata field
      Returns:
      the value, or null if the field doesn't exist
    • getGlobalMetadata

      public Hashtable<String,Object> getGlobalMetadata()
      Description copied from interface: IFormatReader
      Obtains the hashtable containing the metadata field/value pairs from the current file.
      Specified by:
      getGlobalMetadata in interface IFormatReader
      Returns:
      the hashtable containing all non-series-specific metadata from the file
    • getSeriesMetadata

      public Hashtable<String,Object> getSeriesMetadata()
      Description copied from interface: IFormatReader
      Obtains the hashtable containing metadata field/value pairs from the current series in the current file.
      Specified by:
      getSeriesMetadata in interface IFormatReader
    • getCoreMetadataList

      public List<CoreMetadata> getCoreMetadataList()
      Description copied from interface: IFormatReader
      Obtains the core metadata values for the current file.
      Specified by:
      getCoreMetadataList in interface IFormatReader
    • setMetadataFiltered

      public void setMetadataFiltered(boolean filter)
      Description copied from interface: IFormatReader
      Specifies whether ugly metadata (entries with unprintable characters, and extremely large entries) should be discarded from the metadata table.
      Specified by:
      setMetadataFiltered in interface IFormatReader
    • isMetadataFiltered

      public boolean isMetadataFiltered()
      Description copied from interface: IFormatReader
      Returns true if ugly metadata (entries with unprintable characters, and extremely large entries) are discarded from the metadata table.
      Specified by:
      isMetadataFiltered in interface IFormatReader
    • setMetadataStore

      public void setMetadataStore(MetadataStore store)
      Description copied from interface: IFormatReader
      Sets the default metadata store for this reader.
      Specified by:
      setMetadataStore in interface IFormatReader
      Parameters:
      store - a metadata store implementation.
    • getMetadataStore

      public MetadataStore getMetadataStore()
      Description copied from interface: IFormatReader
      Retrieves the current metadata store for this reader. You can be assured that this method will never return a null metadata store.
      Specified by:
      getMetadataStore in interface IFormatReader
      Returns:
      A metadata store implementation.
    • getMetadataStoreRoot

      public Object getMetadataStoreRoot()
      Description copied from interface: IFormatReader
      Retrieves the current metadata store's root object. It is guaranteed that all file parsing has been performed by the reader prior to retrieval. Requests for a full populated root object should be made using this method.
      Specified by:
      getMetadataStoreRoot in interface IFormatReader
      Returns:
      Current metadata store's root object fully populated.
    • getUnderlyingReaders

      public IFormatReader[] getUnderlyingReaders()
      Description copied from interface: IFormatReader
      Retrieves all underlying readers. Returns null if there are no underlying readers.
      Specified by:
      getUnderlyingReaders in interface IFormatReader
    • 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
      Throws:
      FormatException
      IOException
    • getRequiredDirectories

      public int getRequiredDirectories(String[] files) throws FormatException, IOException
      Description copied from interface: IFormatReader
      Returns the number of parent directories that are important when processing the given list of files. The number of directories is relative to the common parent. For example, given a list with these two files: /path/to/file/foo /path/to/file/that/is/related A return value of 0 indicates that "/path/to/file/" is irrelevant. A return value of 1 indicates that "/path/to/" is irrelevant. Return values less than 0 are invalid. All listed files are assumed to belong to datasets of the same format.
      Specified by:
      getRequiredDirectories in interface IFormatReader
      Throws:
      FormatException
      IOException
    • getDatasetStructureDescription

      public String getDatasetStructureDescription()
      Description copied from interface: IFormatReader
      Returns a short description of the dataset structure.
      Specified by:
      getDatasetStructureDescription in interface IFormatReader
    • hasCompanionFiles

      public boolean hasCompanionFiles()
      Description copied from interface: IFormatReader
      Returns true if this format supports multi-file datasets.
      Specified by:
      hasCompanionFiles in interface IFormatReader
    • getPossibleDomains

      public String[] getPossibleDomains(String id) throws FormatException, IOException
      Description copied from interface: IFormatReader
      Returns a list of scientific domains in which this format is used.
      Specified by:
      getPossibleDomains in interface IFormatReader
      Throws:
      FormatException
      IOException
    • getDomains

      public String[] getDomains()
      Description copied from interface: IFormatReader
      Returns the list of domains represented by the current file.
      Specified by:
      getDomains in interface IFormatReader
    • 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
    • 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
    • getTileRows

      public int getTileRows(int no)
      Description copied from interface: ICompressedTileReader
      Get the number of rows of tiles in the specified plane in the current series.
      Specified by:
      getTileRows in interface ICompressedTileReader
      Parameters:
      no - plane index
      Returns:
      tile row count
    • getTileColumns

      public int getTileColumns(int no)
      Description copied from interface: ICompressedTileReader
      Get the number of columns of tiles in the specified plane in the current series.
      Specified by:
      getTileColumns in interface ICompressedTileReader
      Parameters:
      no - plane index
      Returns:
      tile column count
    • seriesToCoreIndex

      public int seriesToCoreIndex(int series)
      Description copied from interface: IFormatReader
      Returns the first core index corresponding to the specified series.
      Specified by:
      seriesToCoreIndex in interface IFormatReader
    • coreIndexToSeries

      public int coreIndexToSeries(int index)
      Description copied from interface: IFormatReader
      Returns the series corresponding to the specified core index.
      Specified by:
      coreIndexToSeries in interface IFormatReader
    • getResolutionCount

      public int getResolutionCount()
      Description copied from interface: IPyramidHandler
      Return the number of resolutions for the current series. Resolutions are stored in descending order, so the largest resolution is first and the smallest resolution is last.
      Specified by:
      getResolutionCount in interface IPyramidHandler
    • setResolution

      public void setResolution(int no)
      Description copied from interface: IPyramidHandler
      Set the resolution level.
      Specified by:
      setResolution in interface IPyramidHandler
      See Also:
    • getResolution

      public int getResolution()
      Description copied from interface: IPyramidHandler
      Get the current resolution level.
      Specified by:
      getResolution in interface IPyramidHandler
      See Also:
    • hasFlattenedResolutions

      public boolean hasFlattenedResolutions()
      Description copied from interface: IFormatReader
      Return whether or not resolution flattening is enabled.
      Specified by:
      hasFlattenedResolutions in interface IFormatReader
    • setFlattenedResolutions

      public void setFlattenedResolutions(boolean flattened)
      Description copied from interface: IFormatReader
      Set whether or not to flatten resolutions into individual series.
      Specified by:
      setFlattenedResolutions in interface IFormatReader
    • getCoreIndex

      public int getCoreIndex()
      Description copied from interface: IFormatReader
      Return the index into CoreMetadata of the current resolution/series.
      Specified by:
      getCoreIndex in interface IFormatReader
    • setCoreIndex

      public void setCoreIndex(int no)
      Description copied from interface: IFormatReader
      Set the current resolution/series (ignores subresolutions). Equivalent to setSeries, but with flattened resolutions always set to false.
      Specified by:
      setCoreIndex in interface IFormatReader
    • isThisType

      public boolean isThisType(String name)
      Description copied from class: FormatHandler
      Checks if a file matches the type of this format handler. The default implementation checks filename suffixes against those known for this format.
      Specified by:
      isThisType in interface IFormatHandler
      Overrides:
      isThisType in class FormatHandler
    • setId

      public void setId(String id) throws FormatException, IOException
      Initialize a reader from the input file name. Call initFile(String id) to initialize the input file, read all of the metadata and set the reader up for reading planes. The performance of this method depends on the format and can be up to several minutes for large file sets.
      Specified by:
      setId in interface IFormatHandler
      Parameters:
      id - a String specifying the path to the file
      Throws:
      FormatException
      IOException
    • setupService

      private void setupService()
      Initialize the OMEXMLService needed by setId(String)
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • getCurrentCore

      protected CoreMetadata getCurrentCore()
      Get the CoreMetadata corresponding to the current series and resolution
      Returns:
      the CoreMetadata
    • getAcquisitionMode

      @Deprecated protected ome.xml.model.enums.AcquisitionMode getAcquisitionMode(String value) throws FormatException
      Retrieves an AcquisitionMode enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getArcType

      @Deprecated protected ome.xml.model.enums.ArcType getArcType(String value) throws FormatException
      Retrieves an ArcType enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getBinning

      @Deprecated protected ome.xml.model.enums.Binning getBinning(String value) throws FormatException
      Retrieves an Binning enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getCompression

      @Deprecated protected ome.xml.model.enums.Compression getCompression(String value) throws FormatException
      Retrieves an Compression enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getContrastMethod

      @Deprecated protected ome.xml.model.enums.ContrastMethod getContrastMethod(String value) throws FormatException
      Retrieves an ContrastMethod enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getCorrection

      @Deprecated protected ome.xml.model.enums.Correction getCorrection(String value) throws FormatException
      Retrieves an Correction enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getDetectorType

      @Deprecated protected ome.xml.model.enums.DetectorType getDetectorType(String value) throws FormatException
      Retrieves an DetectorType enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getDimensionOrder

      @Deprecated protected ome.xml.model.enums.DimensionOrder getDimensionOrder(String value) throws FormatException
      Retrieves an DimensionOrder enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getExperimentType

      @Deprecated protected ome.xml.model.enums.ExperimentType getExperimentType(String value) throws FormatException
      Retrieves an ExperimentType enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getFilamentType

      @Deprecated protected ome.xml.model.enums.FilamentType getFilamentType(String value) throws FormatException
      Retrieves an FilamentType enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getFillRule

      @Deprecated protected ome.xml.model.enums.FillRule getFillRule(String value) throws FormatException
      Retrieves an FillRule enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getFilterType

      @Deprecated protected ome.xml.model.enums.FilterType getFilterType(String value) throws FormatException
      Retrieves an FilterType enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getFontFamily

      @Deprecated protected ome.xml.model.enums.FontFamily getFontFamily(String value) throws FormatException
      Retrieves an FontFamily enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getFontStyle

      @Deprecated protected ome.xml.model.enums.FontStyle getFontStyle(String value) throws FormatException
      Retrieves an FontStyle enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getIlluminationType

      @Deprecated protected ome.xml.model.enums.IlluminationType getIlluminationType(String value) throws FormatException
      Retrieves an IlluminationType enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getImmersion

      @Deprecated protected ome.xml.model.enums.Immersion getImmersion(String value) throws FormatException
      Retrieves an Immersion enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getLaserMedium

      @Deprecated protected ome.xml.model.enums.LaserMedium getLaserMedium(String value) throws FormatException
      Retrieves an LaserMedium enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getLaserType

      @Deprecated protected ome.xml.model.enums.LaserType getLaserType(String value) throws FormatException
      Retrieves an LaserType enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getMarker

      @Deprecated protected ome.xml.model.enums.Marker getMarker(String value) throws FormatException
      Retrieves an Marker enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getMedium

      @Deprecated protected ome.xml.model.enums.Medium getMedium(String value) throws FormatException
      Retrieves an Medium enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getMicrobeamManipulationType

      @Deprecated protected ome.xml.model.enums.MicrobeamManipulationType getMicrobeamManipulationType(String value) throws FormatException
      Retrieves an MicrobeamManipulationType enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getMicroscopeType

      @Deprecated protected ome.xml.model.enums.MicroscopeType getMicroscopeType(String value) throws FormatException
      Retrieves an MicroscopeType enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getNamingConvention

      @Deprecated protected ome.xml.model.enums.NamingConvention getNamingConvention(String value) throws FormatException
      Retrieves an NamingConvention enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getPixelType

      @Deprecated protected ome.xml.model.enums.PixelType getPixelType(String value) throws FormatException
      Retrieves an PixelType enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getPulse

      @Deprecated protected ome.xml.model.enums.Pulse getPulse(String value) throws FormatException
      Retrieves an Pulse enumeration value for the given String.
      Throws:
      ome.xml.model.enums.EnumerationException - if an appropriate enumeration value is not found.
      FormatException
    • getRotationTransform

      protected ome.xml.model.AffineTransform getRotationTransform(double theta)
      Construct an AffineTransform corresponding to the given angle.
      Parameters:
      theta - the angle of rotation in radians
    • isOmero

      private boolean isOmero(String id)