## loci.formats
Class ImageReader

    java.lang.Object
      loci.formats.FormatHandler
          loci.formats.FormatReader
              loci.formats.ImageReader

public class ImageReader
extends FormatReader

ImageReader is master file format reader for all supported formats.

Field Summary
`protected int` `index` Current form index.
`protected static Class[]` `readerClasses` List of reader classes.
`protected FormatReader[]` `readers` List of supported file format readers.

Fields inherited from class loci.formats.FormatReader
`DEBUG, DEBUG_LEVEL, metadata, ome`

Fields inherited from class loci.formats.FormatHandler
`chooser, currentId, filters, format, suffixes`

Constructor Summary
`ImageReader()` Constructs a new ImageReader.

Method Summary
`void` `close()` Closes any open files.
`protected void` `createFilters()` Creates JFileChooser file filters for this file format.
`String` `getFormat(String id)` Gets a string describing the file format for the given file.
`int` `getImageCount(String id)` Determines the number of images in the given image file.
`Hashtable` `getMetadata(String id)` Obtains the hashtable containing the metadata field/value pairs from the given file.
`Object` `getMetadataValue(String id, String field)` Obtains the specified metadata field's value for the given file.
`Object` `getOMENode(String id)` Obtains a loci.ome.xml.OMENode object representing the file's metadata as an OME-XML DOM structure.
`FormatReader` `getReader(Class c)` Gets the file format reader instance matching the given class.
`FormatReader` `getReader(String id)` Gets the reader used to open the given file.
`protected void` `initFile(String id)` Initializes the given image file.
`boolean` `isThisType(byte[] block)` Checks if the given block is a valid header for an image file.
`boolean` `isThisType(String name)` Checks if the given string is a valid filename for any supported format.
`static void` `main(String[] args)`
`BufferedImage[]` `open(String id)` Opens an existing file from the given filename.
`BufferedImage` `open(String id, int no)` Obtains the specified image from the given image file.
`boolean` `testRead(String[] args)` A utility method for test reading a file from the command line, and displaying the results in a simple display.

Methods inherited from class loci.formats.FormatHandler
`getFileChooser, getFileFilters, getFormat, getSuffixes`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### readerClasses

    protected static Class[] readerClasses

  List of reader classes.

### readers

    protected FormatReader[] readers

  List of supported file format readers.

### index

    protected int index

  Current form index.

Constructor Detail

### ImageReader

    public ImageReader()

  Constructs a new ImageReader.

Method Detail

### getFormat

    public String getFormat(String id)
                     throws FormatException,
                            IOException

  Gets a string describing the file format for the given file.

  Throws:
    `FormatException`
    `IOException`

### getReader

    public FormatReader getReader(String id)
                           throws FormatException,
                                  IOException

  Gets the reader used to open the given file.

  Throws:
    `FormatException`
    `IOException`

### getReader

    public FormatReader getReader(Class c)

  Gets the file format reader instance matching the given class.

### isThisType

    public boolean isThisType(byte[] block)

  Checks if the given block is a valid header for an image file.

  Specified by:
    `isThisType` in class `FormatReader`

### getImageCount

    public int getImageCount(String id)
                      throws FormatException,
                             IOException

  Determines the number of images in the given image file.

  Specified by:
    `getImageCount` in class `FormatReader`
  Throws:
    `FormatException`
    `IOException`

### open

    public BufferedImage open(String id,
                              int no)
                       throws FormatException,
                              IOException

  Obtains the specified image from the given image file.

  Specified by:
    `open` in class `FormatReader`
  Throws:
    `FormatException`
    `IOException`

### close

    public void close()
               throws FormatException,
                      IOException

  Closes any open files.

  Specified by:
    `close` in class `FormatReader`
  Throws:
    `FormatException`
    `IOException`

### open

    public BufferedImage[] open(String id)
                         throws FormatException,
                                IOException

  Opens an existing file from the given filename.

  Overrides:
    `open` in class `FormatReader`
  Returns:
    Java Images containing pixel data
  Throws:
    `FormatException`
    `IOException`

### getOMENode

    public Object getOMENode(String id)
                      throws FormatException,
                             IOException

  Obtains a loci.ome.xml.OMENode object representing the file's metadata as an OME-XML DOM structure.

  Overrides:
    `getOMENode` in class `FormatReader`
  Returns:
    null if the loci.ome.xml package is not present.
  Throws:
    `FormatException`
    `IOException`

### getMetadataValue

    public Object getMetadataValue(String id,
                                   String field)
                            throws FormatException,
                                   IOException

  Obtains the specified metadata field's value for the given file.

  Overrides:
    `getMetadataValue` in class `FormatReader`
  Parameters:
    `field` - the name associated with the metadata field
  Returns:
    the value, or null if the field doesn't exist
  Throws:
    `FormatException`
    `IOException`

### getMetadata

    public Hashtable getMetadata(String id)
                          throws FormatException,
                                 IOException

  Obtains the hashtable containing the metadata field/value pairs from the given file.

  Overrides:
    `getMetadata` in class `FormatReader`
  Parameters:
    `id` - the filename
  Returns:
    the hashtable containing all metadata from the file
  Throws:
    `FormatException`
    `IOException`

### testRead

    public boolean testRead(String[] args)
                     throws FormatException,
                            IOException

  A utility method for test reading a file from the command line, and displaying the results in a simple display.

  Overrides:
    `testRead` in class `FormatReader`
  Throws:
    `FormatException`
    `IOException`

### createFilters

    protected void createFilters()

  Creates JFileChooser file filters for this file format.

  Overrides:
    `createFilters` in class `FormatReader`

### isThisType

    public boolean isThisType(String name)

  Checks if the given string is a valid filename for any supported format.

  Overrides:
    `isThisType` in class `FormatHandler`

### initFile

    protected void initFile(String id)
                     throws FormatException,
                            IOException

  Initializes the given image file.

  Overrides:
    `initFile` in class `FormatReader`
  Throws:
    `FormatException`
    `IOException`

### main

    public static void main(String[] args)
                     throws FormatException,
                            IOException

  Throws:
    `FormatException`
    `IOException`