Module io.scif

Interface FormatService

    • Method Detail

      • getSuffixes

        String[] getSuffixes()
        Returns a complete list of all suffixes supported within this context.
      • addFormat

        <M extends Metadata> boolean addFormat​(Format format)
        Makes the provided Format available for image IO operations in this context.

        No effect if the format is already known.

        Parameters:
        format - a new Format to support in this context.
        Returns:
        True if the Format was added successfully.
      • addComponents

        void addComponents​(Format format)
        Creates mappings between this Format and its components.
      • removeComponents

        void removeComponents​(Format format)
        Removes any mappings involving this Format's components.
      • removeFormat

        boolean removeFormat​(Format format)
        Removes the provided Format from this context, if it was previously available.
        Parameters:
        format - the Format to stop supporting in this context.
        Returns:
        True if a format was successfully removed.
      • getFormatFromClass

        <F extends Format> F getFormatFromClass​(Class<F> formatClass)
        Lookup method for the Format map. Use this method when you want a concrete type reference instead of trying to construct a new Format.

        NB: because SezPoz is used for automatic detection of Formats in SCIFIO, all concrete Format implementations have a zero-parameter constructor. If you manually invoke that constructor and then try to link your Format to an existing context, e.g. via the addFormat(Format) method, it will fail if the Format was already discovered. The same principle is true if the context-based constructor is invoked.

        Parameters:
        formatClass - the class of the desired Format
        Returns:
        A reference to concrete class of the queried Format, or null if the Format was not found.
      • getFormatFromComponent

        Format getFormatFromComponent​(Class<?> componentClass)
        Returns the Format compatible with this component class, or null if no matching Format can be found.
      • getFormatFromReader

        <R extends Reader> Format getFormatFromReader​(Class<R> readerClass)
        Format lookup method using the Reader component
        Parameters:
        readerClass - the class of the Reader component for the desired Format
        Returns:
        A reference to the queried Format, or null if the Format was not found.
      • getFormatFromWriter

        <W extends Writer> Format getFormatFromWriter​(Class<W> writerClass)
        Format lookup method using the Writer component.
        Parameters:
        writerClass - the class of the Writer component for the desired Format
        Returns:
        A reference to the queried Format, or null if the Format was not found.
      • getWriterForLocation

        Writer getWriterForLocation​(org.scijava.io.location.Location fileId)
                             throws FormatException
        Writer lookup method using the suffix or other methods to locate a fitting writer. This bypasses the Checker logic, and thus does not guarantee the associated Format can read image sources of the provided type.
        Throws:
        FormatException - if now writer could be found
      • getFormatFromChecker

        <C extends Checker> Format getFormatFromChecker​(Class<C> checkerClass)
        Format lookup method using the Checker component.
        Parameters:
        checkerClass - the class of the Checker component for the desired Format
        Returns:
        A reference to the queried Format, or null if the Format was not found.
      • getFormatFromParser

        <P extends Parser> Format getFormatFromParser​(Class<P> parserClass)
        Format lookup method using the Parser component.
        Parameters:
        parserClass - the class of the Parser component for the desired Format
        Returns:
        A reference to the queried Format, or null if the Format was not found.
      • getFormatFromMetadata

        <M extends Metadata> Format getFormatFromMetadata​(Class<M> metadataClass)
        Format lookup method using the Metadata component.
        Parameters:
        metadataClass - the class of the Metadata component for the desired Format
        Returns:
        A reference to the queried Format, or null if the Format was not found.
      • getFormat

        Format getFormat​(org.scijava.io.location.Location id)
                  throws FormatException
        Returns the first Format known to be compatible with the source provided. Formats are checked in ascending order of their priority. The source is read if necessary to determine compatibility.
        Parameters:
        id - the source
        Returns:
        A Format compatible with the provided source
        Throws:
        FormatException - if no compatible format was found, or if something goes wrong checking the source
      • getFormat

        Format getFormat​(org.scijava.io.location.Location id,
                         SCIFIOConfig config)
                  throws FormatException
        Returns the first Format known to be compatible with the source provided. Formats are checked in ascending order of their priority.
        Parameters:
        id - the source
        config - Configuration for this method execution.
        Returns:
        A Format compatible with the provided source
        Throws:
        FormatException - if no compatible format was found, or if something goes wrong checking the source
      • getFormatList

        List<Format> getFormatList​(org.scijava.io.location.Location id)
                            throws FormatException
        Returns a list of all formats that are compatible with the source provided, ordered by their priority. The source is read if necessary to determine compatibility.
        Parameters:
        id - the source
        Returns:
        A list of Formats compatible with the provided source, which will be an empty list if no compatible formats are found.
        Throws:
        FormatException - if something goes wrong checking the source.
      • getFormatList

        List<Format> getFormatList​(org.scijava.io.location.Location id,
                                   SCIFIOConfig config,
                                   boolean greedy)
                            throws FormatException
        Returns a list of all formats that are compatible with the source provided, ordered by their priority.
        Parameters:
        id - the source
        config - Configuration for this method execution.
        greedy - if true, the search will terminate after finding the first compatible format
        Returns:
        A list of Formats compatible with the provided source, which will be an empty list if no compatible formats are found.
        Throws:
        FormatException - if something goes wrong checking the source.
      • getAllFormats

        Set<Format> getAllFormats()
        Returns a list of all Formats within this context.
      • getOutputFormats

        Collection<Format> getOutputFormats()
        Returns:
        A list of all Formats that have Writer implementations.