loci.formats.in
Class BaseTiffReader

java.lang.Object
  extended by loci.formats.FormatHandler
      extended by loci.formats.FormatReader
          extended by loci.formats.in.BaseTiffReader
All Implemented Interfaces:
loci.formats.IFormatHandler, loci.formats.IFormatReader, loci.formats.StatusReporter
Direct Known Subclasses:
FlexReader, FluoviewReader, GelReader, ImarisTiffReader, ImprovisionTiffReader, IPWReader, MetamorphReader, NikonReader, OMETiffReader, SEQReader, TCSReader, TiffReader, ZeissLSMReader

public abstract class BaseTiffReader
extends loci.formats.FormatReader

BaseTiffReader is the superclass for file format readers compatible with or derived from the TIFF 6.0 file format.

Source code:
Trac, SVN

Author:
Curtis Rueden ctrueden at wisc.edu, Melissa Linkert linkert at wisc.edu

Field Summary
protected  Hashtable[] ifds
          List of IFDs for the current TIFF.
 
Fields inherited from class loci.formats.FormatReader
collectMetadata, core, filterMetadata, group, in, metadata, metadataStore, normalizeData, saveOriginalMetadata, series, THUMBNAIL_DIMENSION
 
Fields inherited from class loci.formats.FormatHandler
currentId, debug, debugLevel, format, statusListeners, suffixes
 
Fields inherited from interface loci.formats.IFormatReader
CAN_GROUP, CANNOT_GROUP, MUST_GROUP
 
Constructor Summary
BaseTiffReader(String name, String suffix)
          Constructs a new BaseTiffReader.
BaseTiffReader(String name, String[] suffixes)
          Constructs a new BaseTiffReader.
 
Method Summary
 short[][] get16BitLookupTable()
           
 byte[][] get8BitLookupTable()
           
protected  String getImageCreationDate()
          Retrieves the image creation date.
protected  String getImageDescription()
          Retrieves the image description.
protected  String getImageName()
          Retrieves the image name from the TIFF.
 Object getMetadataValue(String field)
           
 int[] getTiffDimensions()
          Gets the dimensions of the given (possibly multi-page) TIFF file.
protected  void initFile(String id)
           
protected  void initMetadata()
          Populates the metadata hashtable and metadata store.
protected  void initMetadataStore()
          Populates the metadata store using the data parsed in initStandardMetadata() along with some further parsing done in the method itself.
protected  void initStandardMetadata()
          Parses standard metadata.
 boolean isThisType(byte[] block)
           
 byte[] openBytes(int no, byte[] buf)
           
protected  void put(String key, boolean value)
           
protected  void put(String key, byte value)
           
protected  void put(String key, char value)
           
protected  void put(String key, double value)
           
protected  void put(String key, float value)
           
protected  void put(String key, Hashtable ifd, int tag)
           
protected  void put(String key, int value)
           
protected  void put(String key, long value)
           
protected  void put(String key, Object value)
           
protected  void put(String key, short value)
           
protected  void putInt(String key, Hashtable ifd, int tag)
           
protected  byte[] swapIfRequired(byte[] byteArray)
          Examines a byte array to see if it needs to be byte swapped and modifies the byte array directly.
 
Methods inherited from class loci.formats.FormatReader
addMeta, checkBytes, close, close, fileGroupOption, getChannelDimLengths, getChannelDimLengths, getChannelDimTypes, getChannelDimTypes, getCoreMetadata, getCoreMetadata, getCurrentFile, getDimensionOrder, getDimensionOrder, getEffectiveSizeC, getEffectiveSizeC, getImageCount, getImageCount, getIndex, getIndex, getMeta, getMetadata, getMetadata, getMetadataStore, getMetadataStore, getMetadataStoreRoot, getMetadataStoreRoot, getMetadataValue, getPixelType, getPixelType, getRGBChannelCount, getRGBChannelCount, getSeries, getSeries, getSeriesCount, getSeriesCount, getSizeC, getSizeC, getSizeT, getSizeT, getSizeX, getSizeX, getSizeY, getSizeY, getSizeZ, getSizeZ, getThumbSizeX, getThumbSizeX, getThumbSizeY, getThumbSizeY, getUsedFiles, getUsedFiles, getZCTCoords, getZCTCoords, isFalseColor, isGroupFiles, isIndexed, isInterleaved, isInterleaved, isInterleaved, isInterleaved, isLittleEndian, isLittleEndian, isMetadataCollected, isMetadataComplete, isMetadataFiltered, isNormalized, isOrderCertain, isOrderCertain, isOriginalMetadataPopulated, isRGB, isRGB, isUsedFile, openBytes, openBytes, openBytes, openImage, openImage, openThumbBytes, openThumbBytes, openThumbImage, openThumbImage, setGroupFiles, setId, setMetadataCollected, setMetadataFiltered, setMetadataStore, setNormalized, setOriginalMetadataPopulated, setSeries, setSeries
 
Methods inherited from class loci.formats.FormatHandler
addStatusListener, debug, getFormat, getStatusListeners, getSuffixes, isThisType, isThisType, removeStatusListener, setDebug, setDebugLevel, setId, status, status, status, trace, trace
 
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, getSuffixes, isThisType, isThisType, setId
 
Methods inherited from interface loci.formats.StatusReporter
addStatusListener, getStatusListeners, removeStatusListener
 

Field Detail

ifds

protected Hashtable[] ifds
List of IFDs for the current TIFF.

Constructor Detail

BaseTiffReader

public BaseTiffReader(String name,
                      String suffix)
Constructs a new BaseTiffReader.


BaseTiffReader

public BaseTiffReader(String name,
                      String[] suffixes)
Constructs a new BaseTiffReader.

Method Detail

getTiffDimensions

public int[] getTiffDimensions()
                        throws loci.formats.FormatException,
                               IOException
Gets the dimensions of the given (possibly multi-page) TIFF file.

Throws:
loci.formats.FormatException
IOException

isThisType

public boolean isThisType(byte[] block)

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

getMetadataValue

public Object getMetadataValue(String field)
Specified by:
getMetadataValue in interface loci.formats.IFormatReader
Overrides:
getMetadataValue in class loci.formats.FormatReader

openBytes

public byte[] openBytes(int no,
                        byte[] buf)
                 throws loci.formats.FormatException,
                        IOException
Throws:
loci.formats.FormatException
IOException

initMetadata

protected void initMetadata()
                     throws loci.formats.FormatException,
                            IOException
Populates the metadata hashtable and metadata store.

Throws:
loci.formats.FormatException
IOException

initStandardMetadata

protected void initStandardMetadata()
                             throws loci.formats.FormatException,
                                    IOException
Parses standard metadata. NOTE: Absolutely no calls to the metadata store should be made in this method or methods that override this method. Data will be overwritten if you do so.

Throws:
loci.formats.FormatException
IOException

initMetadataStore

protected void initMetadataStore()
Populates the metadata store using the data parsed in initStandardMetadata() along with some further parsing done in the method itself. All calls to the active MetadataStore should be made in this method and only in this method. This is especially important for sub-classes that override the getters for pixel set array size, etc.


getImageName

protected String getImageName()
Retrieves the image name from the TIFF.

Returns:
the image name.

getImageCreationDate

protected String getImageCreationDate()
Retrieves the image creation date.

Returns:
the image creation date.

getImageDescription

protected String getImageDescription()
Retrieves the image description.

Returns:
the image description.

swapIfRequired

protected byte[] swapIfRequired(byte[] byteArray)
                         throws loci.formats.FormatException,
                                IOException
Examines a byte array to see if it needs to be byte swapped and modifies the byte array directly.

Parameters:
byteArray - The byte array to check and modify if required.
Returns:
the byteArray either swapped or not for convenience.
Throws:
IOException - if there is an error read from the file.
loci.formats.FormatException - if there is an error during metadata parsing.

put

protected void put(String key,
                   Object value)

put

protected void put(String key,
                   int value)

put

protected void put(String key,
                   boolean value)

put

protected void put(String key,
                   byte value)

put

protected void put(String key,
                   char value)

put

protected void put(String key,
                   double value)

put

protected void put(String key,
                   float value)

put

protected void put(String key,
                   long value)

put

protected void put(String key,
                   short value)

put

protected void put(String key,
                   Hashtable ifd,
                   int tag)

putInt

protected void putInt(String key,
                      Hashtable ifd,
                      int tag)

initFile

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