Package loci.formats.in
Class MinimalTiffReader
java.lang.Object
loci.formats.FormatHandler
loci.formats.FormatReader
loci.formats.SubResolutionFormatReader
loci.formats.in.MinimalTiffReader
- All Implemented Interfaces:
Closeable,AutoCloseable,ICompressedTileReader,IFormatHandler,IFormatReader,IMetadataConfigurable,IPyramidHandler
- Direct Known Subclasses:
BaseTiffReader
MinimalTiffReader is the superclass for file format readers compatible with
or derived from the TIFF 6.0 file format.
- Author:
- Melissa Linkert melissa at glencoesoftware.com
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanWhether or not IFDs with different dimensions can be split into separate series.protected booleanprotected IFDListList of IFDs for the current TIFF.private JPEG2000CodecOptionsCodec options to use when decoding JPEG 2000 data.protected intprivate static final org.slf4j.LoggerLogger for this class.protected booleanMerge SubIFDs into the main IFD list.protected booleanprivate IntegerNumber of JPEG 2000 resolution levels.protected booleanList of sub-resolution IFDs for each IFD in the current TIFF with the same order asifds.protected IFDListList of thumbnail IFDs for the current TIFF.protected TiffParserprotected booleanFields inherited from class loci.formats.SubResolutionFormatReader
coreFields inherited from class loci.formats.FormatReader
coreIndex, datasetDescription, domains, fillColor, filterMetadata, flattenedResolutions, group, hasCompanionFiles, in, indexedAsRGB, metadata, metadataStore, normalizeData, resolution, saveOriginalMetadata, series, suffixNecessary, suffixSufficient, THUMBNAIL_DIMENSIONFields inherited from class loci.formats.FormatHandler
COMPRESSION_SUFFIXES, currentId, format, metadataOptions, suffixesFields inherited from interface loci.formats.IFormatReader
CAN_GROUP, CANNOT_GROUP, MUST_GROUP -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new MinimalTiffReader.MinimalTiffReader(String name, String suffix) Constructs a new MinimalTiffReader.MinimalTiffReader(String name, String[] suffixes) Constructs a new MinimalTiffReader. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose(boolean fileOnly) Closes the currently open file.protected byte[]short[][]Gets the 16-bit color lookup table associated with the most recently opened image.byte[][]Gets the 8-bit color lookup table associated with the most recently opened image.protected longgetCompressedByteCount(IFD ifd, int x, int y) getIFDs()Gets the list of IFDs associated with the current TIFF's image planes.intReturns the optimal sub-image height for use with openBytes.intReturns the optimal sub-image width for use with openBytes.Gets the list of IFDs associated with the current TIFF's thumbnails.intGet the size of the X dimension for the thumbnail.intGet the size of the Y dimension for the thumbnail.protected intgetTileIndex(IFD ifd, int x, int y) Get the index of the tile corresponding to given IFD (plane) and tile XY indexes.protected voidInitializes the given file (parsing header information, etc.).protected voidReinitialize the underlying TiffParser.booleanisThisType(loci.common.RandomAccessInputStream stream) Checks if the given stream is a valid stream for this file format.byte[]openBytes(int no, byte[] buf, int x, int y, int w, int h) Obtains a sub-image of the specified image plane into a pre-allocated byte array.byte[]openThumbBytes(int no) Obtains a thumbnail for the specified image plane from the current file, as a byte array.voidReopen any files that were closed, and which are expected to be open while the reader is open.protected voidsetResolutionLevel(IFD ifd) Sets the resolution level when we have JPEG 2000 compressed data.Methods inherited from class loci.formats.SubResolutionFormatReader
coreIndexToSeries, flattenHashtables, getCoreIndex, getCoreMetadataList, getCurrentCore, getResolution, getResolutionCount, getSeries, getSeriesCount, seriesToCoreIndex, setCoreIndex, setResolution, setSeriesMethods inherited from class loci.formats.FormatReader
addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMetaList, addMeta, addMetaList, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMetaList, close, fileGroupOption, getAcquisitionMode, getAdvancedSeriesUsedFiles, getAdvancedUsedFiles, getArcType, getAvailableOptions, getBinning, getBitsPerPixel, getCompression, getContrastMethod, getCorrection, getCurrentFile, getDatasetStructureDescription, getDetectorType, getDimensionOrder, getDimensionOrder, getDomains, getEffectiveSizeC, getExperimentType, getFilamentType, getFillColor, getFillRule, getFilterType, getFontFamily, getFontStyle, getGlobalMeta, getGlobalMetadata, getIlluminationType, getImageCount, getImmersion, getIndex, getIndex, getLaserMedium, getLaserType, getMarker, getMedium, getMetadataStore, getMetadataStoreRoot, getMetadataValue, getMicrobeamManipulationType, getMicroscopeType, getModuloC, getModuloT, getModuloZ, getNamingConvention, getPixelType, getPixelType, getPossibleDomains, getPulse, getRequiredDirectories, getRGBChannelCount, getRotationTransform, getSeriesMeta, getSeriesMetadata, getSeriesMetadataValue, getSeriesUsedFiles, getSeriesUsedFiles, getSizeC, getSizeT, getSizeX, getSizeY, getSizeZ, getTileColumns, getTileRows, getUnderlyingReaders, getUsedFiles, getUsedFiles, getZCTCoords, getZCTModuloCoords, hasCompanionFiles, hasFlattenedResolutions, isFalseColor, isGroupFiles, isIndexed, isInterleaved, isInterleaved, isLittleEndian, isMetadataComplete, isMetadataFiltered, isNormalized, isOrderCertain, isOriginalMetadataPopulated, isRGB, isSingleFile, isThisType, isThisType, isThisType, isThumbnailSeries, isUsedFile, makeFilterMetadata, openBytes, openBytes, openBytes, openPlane, readPlane, readPlane, readPlane, setFillColor, setFlattenedResolutions, setGroupFiles, setId, setMetadataFiltered, setMetadataStore, setNormalized, setOriginalMetadataPopulated, updateMetadataListsMethods inherited from class loci.formats.FormatHandler
checkSuffix, checkSuffix, getFormat, getMetadataOptions, getNativeDataType, getSuffixes, getSupportedMetadataLevels, setMetadataOptionsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface loci.formats.ICompressedTileReader
getTileCodec, getTileCodecOptions, openCompressedBytes, openCompressedBytesMethods inherited from interface loci.formats.IFormatHandler
getFormat, getNativeDataType, getSuffixesMethods inherited from interface loci.formats.IMetadataConfigurable
getMetadataOptions, getSupportedMetadataLevels, setMetadataOptions
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGERLogger for this class. -
ifds
List of IFDs for the current TIFF. -
thumbnailIFDs
List of thumbnail IFDs for the current TIFF. -
subResolutionIFDs
List of sub-resolution IFDs for each IFD in the current TIFF with the same order asifds. -
tiffParser
-
equalStrips
protected boolean equalStrips -
use64Bit
protected boolean use64Bit -
lastPlane
protected int lastPlane -
noSubresolutions
protected boolean noSubresolutions -
seriesToIFD
protected boolean seriesToIFD -
mergeSubIFDs
protected transient boolean mergeSubIFDsMerge SubIFDs into the main IFD list. -
canSeparateSeries
protected transient boolean canSeparateSeriesWhether or not IFDs with different dimensions can be split into separate series. -
resolutionLevels
Number of JPEG 2000 resolution levels. -
j2kCodecOptions
Codec options to use when decoding JPEG 2000 data.
-
-
Constructor Details
-
MinimalTiffReader
public MinimalTiffReader()Constructs a new MinimalTiffReader. -
MinimalTiffReader
Constructs a new MinimalTiffReader. -
MinimalTiffReader
Constructs a new MinimalTiffReader.
-
-
Method Details
-
getIFDs
Gets the list of IFDs associated with the current TIFF's image planes. -
getThumbnailIFDs
Gets the list of IFDs associated with the current TIFF's thumbnails. -
isThisType
Description copied from interface:IFormatReaderChecks if the given stream is a valid stream for this file format. The number of bytes read is format-dependent.- Specified by:
isThisTypein interfaceIFormatReader- Overrides:
isThisTypein classFormatReader- Parameters:
stream- A RandomAccessInputStream representing the file to check. The first byte in the stream is assumed to be the first byte in the file.- Returns:
- true if the file represented by the stream can be read by this reader; false otherwise.
- Throws:
IOException
-
get8BitLookupTable
Description copied from interface:IFormatReaderGets the 8-bit color lookup table associated with the most recently opened image. If no image planes have been opened, or ifIFormatReader.isIndexed()returns false, then this may return null. Also, ifIFormatReader.getPixelType()returns anything other thanFormatTools.INT8orFormatTools.UINT8, this method will return null.- Specified by:
get8BitLookupTablein interfaceIFormatReader- Overrides:
get8BitLookupTablein classFormatReader- Throws:
FormatExceptionIOException
-
get16BitLookupTable
Description copied from interface:IFormatReaderGets the 16-bit color lookup table associated with the most recently opened image. If no image planes have been opened, or ifIFormatReader.isIndexed()returns false, then this may return null. Also, ifIFormatReader.getPixelType()returns anything other thanFormatTools.INT16orFormatTools.UINT16, this method will return null.- Specified by:
get16BitLookupTablein interfaceIFormatReader- Overrides:
get16BitLookupTablein classFormatReader- Throws:
FormatExceptionIOException
-
getThumbSizeX
public int getThumbSizeX()Description copied from interface:IFormatReaderGet the size of the X dimension for the thumbnail.- Specified by:
getThumbSizeXin interfaceIFormatReader- Overrides:
getThumbSizeXin classFormatReader
-
getThumbSizeY
public int getThumbSizeY()Description copied from interface:IFormatReaderGet the size of the Y dimension for the thumbnail.- Specified by:
getThumbSizeYin interfaceIFormatReader- Overrides:
getThumbSizeYin classFormatReader
-
openThumbBytes
Description copied from interface:IFormatReaderObtains a thumbnail for the specified image plane from the current file, as a byte array.- Specified by:
openThumbBytesin interfaceIFormatReader- Overrides:
openThumbBytesin classFormatReader- Throws:
FormatExceptionIOException
-
openBytes
public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, IOException Description copied from interface:IFormatReaderObtains a sub-image of the specified image plane into a pre-allocated byte array.- Specified by:
openBytesin interfaceIFormatReader- Specified by:
openBytesin classFormatReader- Parameters:
no- the plane index within the current series.buf- a pre-allocated buffer.x- X coordinate of the upper-left corner of the sub-imagey- Y coordinate of the upper-left corner of the sub-imagew- width of the sub-imageh- height of the sub-image- Returns:
- the pre-allocated buffer
buffor convenience. - Throws:
FormatException- if there was a problem parsing the metadata of the file.IOException- if there was a problem reading the file.- See Also:
-
reopenFile
Description copied from interface:IFormatReaderReopen any files that were closed, and which are expected to be open while the reader is open. This assumes thatIFormatHandler.setId(java.lang.String)has been called, but close(false) has not been called.- Specified by:
reopenFilein interfaceIFormatReader- Overrides:
reopenFilein classFormatReader- Throws:
IOException
-
close
Description copied from interface:IFormatReaderCloses the currently open file. If the flag is set, this is all that happens; if unset, it is equivalent to callingCloseable.close().- Specified by:
closein interfaceIFormatReader- Overrides:
closein classSubResolutionFormatReader- Throws:
IOException
-
getOptimalTileWidth
public int getOptimalTileWidth()Description copied from interface:IFormatReaderReturns the optimal sub-image width for use with openBytes.- Specified by:
getOptimalTileWidthin interfaceIFormatReader- Overrides:
getOptimalTileWidthin classFormatReader
-
getOptimalTileHeight
public int getOptimalTileHeight()Description copied from interface:IFormatReaderReturns the optimal sub-image height for use with openBytes.- Specified by:
getOptimalTileHeightin interfaceIFormatReader- Overrides:
getOptimalTileHeightin classFormatReader
-
initFile
Description copied from class:SubResolutionFormatReaderInitializes the given file (parsing header information, etc.). Most subclasses should override this method to perform initialization operations such as parsing metadata.- Overrides:
initFilein classSubResolutionFormatReader- Throws:
FormatException- if a parsing error occurs processing the file.IOException- if an I/O error occurs processing the file
-
setResolutionLevel
Sets the resolution level when we have JPEG 2000 compressed data.- Parameters:
ifd- The active IFD that is being used in our currentopenBytes()calling context. It will be the sub-resolution IFD if currentSeries > 0.
-
initTiffParser
protected void initTiffParser()Reinitialize the underlying TiffParser. -
getTileIndex
Get the index of the tile corresponding to given IFD (plane) and tile XY indexes.- Parameters:
ifd- IFD for the requested tile's planex- tile X indexy- tile Y index- Returns:
- corresponding tile index
- Throws:
FormatException
-
getCompressedByteCount
- Throws:
FormatExceptionIOException
-
copyTile
- Throws:
FormatExceptionIOException
-