loci.formats
Class LeicaReader

java.lang.Object
  extended byloci.formats.FormatHandler
      extended byloci.formats.FormatReader
          extended byloci.formats.LeicaReader

public class LeicaReader
extends FormatReader

LeicaReader is the file format reader for Leica files.


Field Summary
protected  String[] files
          Array of image file names.
protected  Hashtable[] headerIFDs
          Array of IFD-like structures containing metadata.
protected  RandomAccessFile in
          Current file.
protected  boolean littleEndian
          Flag indicating whether current file is little endian.
protected  int numImages
          Number of images in the dataset.
protected  TiffReader tiff
          Helper reader.
 
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
LeicaReader()
          Constructs a new Leica reader.
 
Method Summary
 void close()
          Closes any open files.
 int getImageCount(String id)
          Determines the number of images in the given Leica file.
protected  void initFile(String id)
          Initializes the given Leica file.
protected  void initMetadata()
          Populates the metadata hashtable and OME root node.
 boolean isThisType(byte[] block)
          Checks if the given block is a valid header for a Leica file.
 boolean isThisType(String name)
          Checks if the given string is a valid filename for a Leica file.
static void main(String[] args)
           
 BufferedImage open(String id, int no)
          Obtains the specified image from the given Leica file.
protected  String stripString(String toStrip)
          The Leica format is stupid and stores each String as a character array of twice the required size, with a space at every other position.
 
Methods inherited from class loci.formats.FormatReader
createFilters, getMetadata, getMetadataValue, getOMENode, open, testRead
 
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

in

protected RandomAccessFile in
Current file.


littleEndian

protected boolean littleEndian
Flag indicating whether current file is little endian.


headerIFDs

protected Hashtable[] headerIFDs
Array of IFD-like structures containing metadata.


tiff

protected TiffReader tiff
Helper reader.


numImages

protected int numImages
Number of images in the dataset.


files

protected String[] files
Array of image file names.

Constructor Detail

LeicaReader

public LeicaReader()
Constructs a new Leica reader.

Method Detail

isThisType

public boolean isThisType(byte[] block)
Checks if the given block is a valid header for a Leica file.

Specified by:
isThisType in class FormatReader

isThisType

public boolean isThisType(String name)
Checks if the given string is a valid filename for a Leica file.

Overrides:
isThisType in class FormatHandler

getImageCount

public int getImageCount(String id)
                  throws FormatException,
                         IOException
Determines the number of images in the given Leica 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 Leica 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

initFile

protected void initFile(String id)
                 throws FormatException,
                        IOException
Initializes the given Leica file.

Overrides:
initFile in class FormatReader
Throws:
FormatException
IOException

initMetadata

protected void initMetadata()
Populates the metadata hashtable and OME root node.


stripString

protected String stripString(String toStrip)
The Leica format is stupid and stores each String as a character array of twice the required size, with a space at every other position. This method removes the blank spaces from a string.


main

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