public class TiffParser extends Object
| Modifier and Type | Field and Description |
|---|---|
protected RandomAccessInputStream |
in
Input source from which to parse TIFF data.
|
| Constructor and Description |
|---|
TiffParser(RandomAccessInputStream in)
Constructs a new TIFF parser from the given input source.
|
TiffParser(String filename)
Constructs a new TIFF parser from the given file name.
|
| Modifier and Type | Method and Description |
|---|---|
Boolean |
checkHeader()
Checks the TIFF header.
|
void |
fillInIFD(IFD ifd)
Fill in IFD entries that are stored at an arbitrary offset.
|
CodecOptions |
getCodecOptions()
Retrieves the current set of codec options being used to decompress pixel
data.
|
String |
getComment()
Convenience method for obtaining a stream's first ImageDescription.
|
IFDList |
getExifIFDs()
Returns EXIF IFDs.
|
IFD |
getFirstIFD()
Gets the first IFD within the TIFF file, or null
if the input source is not a valid TIFF file.
|
TiffIFDEntry |
getFirstIFDEntry(int tag)
Retrieve a given entry from the first IFD in the stream.
|
long |
getFirstOffset()
Gets offset to the first IFD, or -1 if stream is not TIFF.
|
IFD |
getIFD(long offset)
Gets the IFD stored at the given offset.
|
long[] |
getIFDOffsets()
Gets the offsets to every IFD in the file.
|
IFDList |
getIFDs()
Returns all IFDs in the file.
|
Object |
getIFDValue(TiffIFDEntry entry)
Retrieve the value corresponding to the given TiffIFDEntry.
|
IFDList |
getNonThumbnailIFDs()
Returns non-thumbnail IFDs.
|
byte[] |
getSamples(IFD ifd,
byte[] buf) |
byte[] |
getSamples(IFD ifd,
byte[] buf,
int x,
int y,
long width,
long height) |
byte[] |
getSamples(IFD ifd,
byte[] buf,
int x,
int y,
long width,
long height,
int overlapX,
int overlapY) |
RandomAccessInputStream |
getStream()
Gets the stream from which TIFF data is being parsed.
|
IFDList |
getThumbnailIFDs()
Returns thumbnail IFDs.
|
byte[] |
getTile(IFD ifd,
byte[] buf,
int row,
int col) |
boolean |
isBigTiff()
Returns whether or not the current TIFF file contains BigTIFF data.
|
boolean |
isValidHeader()
Tests this stream to see if it represents a TIFF file.
|
void |
setAssumeEqualStrips(boolean equalStrips)
Sets whether or not to assume that strips are of equal size.
|
void |
setCodecOptions(CodecOptions codecOptions)
Sets the codec options to be used when decompressing pixel data.
|
void |
setDoCaching(boolean doCaching)
Sets whether or not IFD entries should be cached.
|
void |
setUse64BitOffsets(boolean use64Bit)
Sets whether or not 64-bit offsets are used for non-BigTIFF files.
|
void |
setYCbCrCorrection(boolean correctionAllowed)
Sets whether or not YCbCr color correction is allowed.
|
static void |
unpackBytes(byte[] samples,
int startIndex,
byte[] bytes,
IFD ifd)
Extracts pixel information from the given byte array according to the
bits per sample, photometric interpretation and color map IFD directory
entry values, and the specified byte ordering.
|
protected RandomAccessInputStream in
public TiffParser(String filename) throws IOException
IOExceptionpublic TiffParser(RandomAccessInputStream in)
public void setAssumeEqualStrips(boolean equalStrips)
equalStrips - Whether or not the strips are of equal size.public void setCodecOptions(CodecOptions codecOptions)
codecOptions - Codec options to use.public CodecOptions getCodecOptions()
public void setDoCaching(boolean doCaching)
public void setUse64BitOffsets(boolean use64Bit)
public void setYCbCrCorrection(boolean correctionAllowed)
public RandomAccessInputStream getStream()
public boolean isValidHeader()
public Boolean checkHeader() throws IOException
IOExceptionpublic boolean isBigTiff()
public IFDList getIFDs() throws IOException
IOExceptionpublic IFDList getThumbnailIFDs() throws IOException
IOExceptionpublic IFDList getNonThumbnailIFDs() throws IOException
IOExceptionpublic IFDList getExifIFDs() throws FormatException, IOException
FormatExceptionIOExceptionpublic long[] getIFDOffsets()
throws IOException
IOExceptionpublic IFD getFirstIFD() throws IOException
IOExceptionpublic TiffIFDEntry getFirstIFDEntry(int tag) throws IOException
tag - the tag of the entry to be retrieved.IOException - when there is an error accessing the stream.IllegalArgumentException - when the tag number is unknown.public long getFirstOffset()
throws IOException
IOExceptionpublic IFD getIFD(long offset) throws IOException
IOExceptionpublic void fillInIFD(IFD ifd) throws IOException
IOExceptionpublic Object getIFDValue(TiffIFDEntry entry) throws IOException
IOExceptionpublic String getComment() throws IOException
IOExceptionpublic byte[] getTile(IFD ifd, byte[] buf, int row, int col) throws FormatException, IOException
FormatExceptionIOExceptionpublic byte[] getSamples(IFD ifd, byte[] buf) throws FormatException, IOException
FormatExceptionIOExceptionpublic byte[] getSamples(IFD ifd, byte[] buf, int x, int y, long width, long height) throws FormatException, IOException
FormatExceptionIOExceptionpublic byte[] getSamples(IFD ifd, byte[] buf, int x, int y, long width, long height, int overlapX, int overlapY) throws FormatException, IOException
FormatExceptionIOExceptionpublic static void unpackBytes(byte[] samples,
int startIndex,
byte[] bytes,
IFD ifd)
throws FormatException
FormatExceptionCopyright © 2014 Open Microscopy Environment