Package loci.formats
Class DelegateReader
java.lang.Object
loci.formats.FormatHandler
loci.formats.FormatReader
loci.formats.DelegateReader
- All Implemented Interfaces:
Closeable,AutoCloseable,ICompressedTileReader,IFormatHandler,IFormatReader,IMetadataConfigurable,IPyramidHandler
- Direct Known Subclasses:
JPEGReader,TiffDelegateReader
DelegateReader is a file format reader that selects which reader to use
for a format if there are two readers which handle the same format.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IFormatReaderLegacy reader.protected booleanFlag indicating that the legacy reader was successfully initialized.protected IFormatReaderNative reader.protected booleanFlag indicating that the native reader was successfully initialized.protected booleanFlag indicating whether to use legacy reader by default.Fields inherited from class loci.formats.FormatReader
core, 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, LOGGER, metadataOptions, suffixesFields inherited from interface loci.formats.IFormatReader
CAN_GROUP, CANNOT_GROUP, MUST_GROUP -
Constructor Summary
ConstructorsConstructorDescriptionDelegateReader(String format, String suffix) Constructs a new delegate reader.DelegateReader(String format, String[] suffixes) Constructs a new delegate reader. -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanvoidclose(boolean fileOnly) Closes the currently open file.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.intReturns the optimal sub-image height for use with openBytes.intReturns the optimal sub-image width for use with openBytes.String[]getSeriesUsedFiles(boolean noPixels) Returns an array of filenames needed to open the current series.booleanisLegacy()Gets whether to use the legacy reader by default.booleanisThisType(String name, boolean open) Checks if a file matches the type of this format reader.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.voidReopen any files that were closed, and which are expected to be open while the reader is open.voidsetCoreIndex(int no) Set the current resolution/series (ignores subresolutions).voidsetFlattenedResolutions(boolean flattened) Set whether or not to flatten resolutions into individual series.voidsetGroupFiles(boolean group) Specifies whether or not to force grouping in multi-file formats.voidInitialize a reader from the input file name.voidsetLegacy(boolean legacy) Sets whether to use the legacy reader by default.voidsetMetadataFiltered(boolean filter) Specifies whether ugly metadata (entries with unprintable characters, and extremely large entries) should be discarded from the metadata table.voidsetMetadataOptions(MetadataOptions options) voidsetMetadataStore(MetadataStore store) Sets the default metadata store for this reader.voidsetNormalized(boolean normalize) Specifies whether or not to normalize float data.voidsetOriginalMetadataPopulated(boolean populate) Specifies whether or not to save proprietary metadata in the MetadataStore.voidsetResolution(int resolution) Set the resolution level.voidsetSeries(int no) Activates the specified series.Methods 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, coreIndexToSeries, fileGroupOption, flattenHashtables, getAcquisitionMode, getAdvancedSeriesUsedFiles, getAdvancedUsedFiles, getArcType, getAvailableOptions, getBinning, getBitsPerPixel, getCompression, getContrastMethod, getCoreIndex, getCoreMetadataList, getCorrection, getCurrentCore, 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, getResolution, getResolutionCount, getRGBChannelCount, getRotationTransform, getSeries, getSeriesCount, getSeriesMeta, getSeriesMetadata, getSeriesMetadataValue, getSeriesUsedFiles, getSizeC, getSizeT, getSizeX, getSizeY, getSizeZ, getThumbSizeX, getThumbSizeY, getTileColumns, getTileRows, getUnderlyingReaders, getUsedFiles, getUsedFiles, getZCTCoords, getZCTModuloCoords, hasCompanionFiles, hasFlattenedResolutions, initFile, isFalseColor, isGroupFiles, isIndexed, isInterleaved, isInterleaved, isLittleEndian, isMetadataComplete, isMetadataFiltered, isNormalized, isOrderCertain, isOriginalMetadataPopulated, isRGB, isSingleFile, isThisType, isThisType, isThumbnailSeries, isUsedFile, makeFilterMetadata, openBytes, openBytes, openBytes, openPlane, openThumbBytes, readPlane, readPlane, readPlane, seriesToCoreIndex, setFillColor, updateMetadataListsMethods inherited from class loci.formats.FormatHandler
checkSuffix, checkSuffix, getFormat, getNativeDataType, getSuffixesMethods 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, getSuffixes
-
Field Details
-
useLegacy
protected boolean useLegacyFlag indicating whether to use legacy reader by default. -
nativeReader
Native reader. -
legacyReader
Legacy reader. -
nativeReaderInitialized
protected boolean nativeReaderInitializedFlag indicating that the native reader was successfully initialized. -
legacyReaderInitialized
protected boolean legacyReaderInitializedFlag indicating that the legacy reader was successfully initialized.
-
-
Constructor Details
-
DelegateReader
Constructs a new delegate reader. -
DelegateReader
Constructs a new delegate reader.
-
-
Method Details
-
setLegacy
public void setLegacy(boolean legacy) Sets whether to use the legacy reader by default. -
isLegacy
public boolean isLegacy()Gets whether to use the legacy reader by default. -
getSupportedMetadataLevels
- Specified by:
getSupportedMetadataLevelsin interfaceIMetadataConfigurable- Overrides:
getSupportedMetadataLevelsin classFormatHandler
-
getMetadataOptions
- Specified by:
getMetadataOptionsin interfaceIMetadataConfigurable- Overrides:
getMetadataOptionsin classFormatHandler
-
setMetadataOptions
- Specified by:
setMetadataOptionsin interfaceIMetadataConfigurable- Overrides:
setMetadataOptionsin classFormatHandler
-
isThisType
Description copied from class:FormatReaderChecks if a file matches the type of this format reader. Checks filename suffixes against those known for this format. If the suffix check is inconclusive and the open parameter is true, the file is opened and tested withFormatReader.isThisType(RandomAccessInputStream).- Specified by:
isThisTypein interfaceIFormatReader- Overrides:
isThisTypein classFormatReader- Parameters:
open- If true, and the file extension is insufficient to determine the file type, the (existing) file is opened for further analysis.
-
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
-
setSeries
public void setSeries(int no) Description copied from interface:IFormatReaderActivates the specified series. This also resets the resolution to 0.- Specified by:
setSeriesin interfaceIFormatReader- Overrides:
setSeriesin classFormatReader
-
setCoreIndex
public void setCoreIndex(int no) Description copied from interface:IFormatReaderSet the current resolution/series (ignores subresolutions). Equivalent to setSeries, but with flattened resolutions always set to false.- Specified by:
setCoreIndexin interfaceIFormatReader- Overrides:
setCoreIndexin classFormatReader
-
setResolution
public void setResolution(int resolution) Description copied from interface:IPyramidHandlerSet the resolution level.- Specified by:
setResolutionin interfaceIPyramidHandler- Overrides:
setResolutionin classFormatReader- See Also:
-
setNormalized
public void setNormalized(boolean normalize) Description copied from interface:IFormatReaderSpecifies whether or not to normalize float data.- Specified by:
setNormalizedin interfaceIFormatReader- Overrides:
setNormalizedin classFormatReader
-
setOriginalMetadataPopulated
public void setOriginalMetadataPopulated(boolean populate) Description copied from interface:IFormatReaderSpecifies whether or not to save proprietary metadata in the MetadataStore.- Specified by:
setOriginalMetadataPopulatedin interfaceIFormatReader- Overrides:
setOriginalMetadataPopulatedin classFormatReader
-
setGroupFiles
public void setGroupFiles(boolean group) Description copied from interface:IFormatReaderSpecifies whether or not to force grouping in multi-file formats.- Specified by:
setGroupFilesin interfaceIFormatReader- Overrides:
setGroupFilesin classFormatReader- See Also:
-
setFlattenedResolutions
public void setFlattenedResolutions(boolean flattened) Description copied from interface:IFormatReaderSet whether or not to flatten resolutions into individual series.- Specified by:
setFlattenedResolutionsin interfaceIFormatReader- Overrides:
setFlattenedResolutionsin classFormatReader
-
setMetadataFiltered
public void setMetadataFiltered(boolean filter) Description copied from interface:IFormatReaderSpecifies whether ugly metadata (entries with unprintable characters, and extremely large entries) should be discarded from the metadata table.- Specified by:
setMetadataFilteredin interfaceIFormatReader- Overrides:
setMetadataFilteredin classFormatReader
-
setMetadataStore
Description copied from interface:IFormatReaderSets the default metadata store for this reader.- Specified by:
setMetadataStorein interfaceIFormatReader- Overrides:
setMetadataStorein classFormatReader- Parameters:
store- a metadata store implementation.
-
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
-
getSeriesUsedFiles
Description copied from interface:IFormatReaderReturns an array of filenames needed to open the current series. If the 'noPixels' flag is set, then only files that do not contain pixel data will be returned. The first element in the array is expected to be the path passed toIFormatHandler.setId(String), if appropriate based upon 'noPixels'. The remaining elements are expected to be in a consistent order; if a directory listing is necessary to build the list then it should be sorted first.- Specified by:
getSeriesUsedFilesin interfaceIFormatReader- Overrides:
getSeriesUsedFilesin classFormatReader
-
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.
-
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 classFormatReader- 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
-
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
-
setId
Description copied from class:FormatReaderInitialize a reader from the input file name. CallFormatReader.initFile(String id)to initialize the input file, read all of the metadata and set the reader up for reading planes. The performance of this method depends on the format and can be up to several minutes for large file sets.- Specified by:
setIdin interfaceIFormatHandler- Overrides:
setIdin classFormatReader- Parameters:
id- aStringspecifying the path to the file- Throws:
FormatExceptionIOException
-
callLegacyReader
private boolean callLegacyReader()
-