public abstract class DelegateReader extends FormatReader
Modifier and Type | Field and Description |
---|---|
protected IFormatReader |
legacyReader
Legacy reader.
|
protected boolean |
legacyReaderInitialized
Flag indicating that the legacy reader was successfully initialized.
|
protected IFormatReader |
nativeReader
Native reader.
|
protected boolean |
nativeReaderInitialized
Flag indicating that the native reader was successfully initialized.
|
protected boolean |
useLegacy
Flag indicating whether to use legacy reader by default.
|
core, coreIndex, datasetDescription, domains, filterMetadata, flattenedResolutions, group, hasCompanionFiles, in, indexedAsRGB, metadata, metadataStore, normalizeData, resolution, saveOriginalMetadata, series, suffixNecessary, suffixSufficient, THUMBNAIL_DIMENSION
COMPRESSION_SUFFIXES, currentId, format, LOGGER, metadataOptions, suffixes
CAN_GROUP, CANNOT_GROUP, MUST_GROUP
Constructor and Description |
---|
DelegateReader(java.lang.String format,
java.lang.String suffix)
Constructs a new delegate reader.
|
DelegateReader(java.lang.String format,
java.lang.String[] suffixes)
Constructs a new delegate reader.
|
Modifier and Type | Method and Description |
---|---|
private boolean |
callLegacyReader() |
void |
close(boolean fileOnly)
Closes the currently open file.
|
short[][] |
get16BitLookupTable()
Gets the 16-bit color lookup table associated with
the most recently opened image.
|
byte[][] |
get8BitLookupTable()
Gets the 8-bit color lookup table associated with
the most recently opened image.
|
MetadataOptions |
getMetadataOptions() |
int |
getOptimalTileHeight()
Returns the optimal sub-image height for use with openBytes.
|
int |
getOptimalTileWidth()
Returns the optimal sub-image width for use with openBytes.
|
java.lang.String[] |
getSeriesUsedFiles(boolean noPixels)
Returns an array of filenames needed to open the current series.
|
java.util.Set<MetadataLevel> |
getSupportedMetadataLevels() |
boolean |
isLegacy()
Gets whether to use the legacy reader by default.
|
boolean |
isThisType(loci.common.RandomAccessInputStream stream)
Checks if the given stream is a valid stream for this file format.
|
boolean |
isThisType(java.lang.String name,
boolean open)
Checks if a file matches the type of this format reader.
|
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.
|
void |
reopenFile()
Reopen any files that were closed, and which are expected to be open
while the reader is open.
|
void |
setCoreIndex(int no)
Set the current resolution/series (ignores subresolutions).
|
void |
setFlattenedResolutions(boolean flattened)
Set whether or not to flatten resolutions into individual series.
|
void |
setGroupFiles(boolean group)
Specifies whether or not to force grouping in multi-file formats.
|
void |
setId(java.lang.String id)
Initialize a reader from the input file name.
|
void |
setLegacy(boolean legacy)
Sets whether to use the legacy reader by default.
|
void |
setMetadataFiltered(boolean filter)
Specifies whether ugly metadata (entries with unprintable characters,
and extremely large entries) should be discarded from the metadata table.
|
void |
setMetadataOptions(MetadataOptions options) |
void |
setMetadataStore(MetadataStore store)
Sets the default metadata store for this reader.
|
void |
setNormalized(boolean normalize)
Specifies whether or not to normalize float data.
|
void |
setOriginalMetadataPopulated(boolean populate)
Specifies whether or not to save proprietary metadata
in the MetadataStore.
|
void |
setResolution(int resolution)
Set the resolution level.
|
void |
setSeries(int no)
Activates the specified series.
|
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, getBinning, getBitsPerPixel, getCompression, getContrastMethod, getCoreIndex, getCoreMetadataList, getCorrection, getCurrentCore, getCurrentFile, getDatasetStructureDescription, getDetectorType, getDimensionOrder, getDimensionOrder, getDomains, getEffectiveSizeC, getExperimentType, getFilamentType, 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, 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, seriesToCoreIndex, updateMetadataLists
checkSuffix, checkSuffix, getFormat, getNativeDataType, getSuffixes
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFormat, getNativeDataType, getSuffixes
protected boolean useLegacy
protected IFormatReader nativeReader
protected IFormatReader legacyReader
protected boolean nativeReaderInitialized
protected boolean legacyReaderInitialized
public DelegateReader(java.lang.String format, java.lang.String suffix)
public DelegateReader(java.lang.String format, java.lang.String[] suffixes)
public void setLegacy(boolean legacy)
public boolean isLegacy()
public java.util.Set<MetadataLevel> getSupportedMetadataLevels()
getSupportedMetadataLevels
in interface IMetadataConfigurable
getSupportedMetadataLevels
in class FormatHandler
public MetadataOptions getMetadataOptions()
getMetadataOptions
in interface IMetadataConfigurable
getMetadataOptions
in class FormatHandler
public void setMetadataOptions(MetadataOptions options)
setMetadataOptions
in interface IMetadataConfigurable
setMetadataOptions
in class FormatHandler
public boolean isThisType(java.lang.String name, boolean open)
FormatReader
FormatReader.isThisType(RandomAccessInputStream)
.isThisType
in interface IFormatReader
isThisType
in class FormatReader
open
- If true, and the file extension is insufficient to determine
the file type, the (existing) file is opened for further analysis.public boolean isThisType(loci.common.RandomAccessInputStream stream) throws java.io.IOException
IFormatReader
isThisType
in interface IFormatReader
isThisType
in class FormatReader
stream
- A RandomAccessInputStream representing the file to check.
The first byte in the stream is assumed to be the first byte
in the file.java.io.IOException
public void setSeries(int no)
IFormatReader
setSeries
in interface IFormatReader
setSeries
in class FormatReader
public void setCoreIndex(int no)
IFormatReader
setCoreIndex
in interface IFormatReader
setCoreIndex
in class FormatReader
public void setResolution(int resolution)
IPyramidHandler
setResolution
in interface IPyramidHandler
setResolution
in class FormatReader
IPyramidHandler.getResolutionCount()
public void setNormalized(boolean normalize)
IFormatReader
setNormalized
in interface IFormatReader
setNormalized
in class FormatReader
public void setOriginalMetadataPopulated(boolean populate)
IFormatReader
setOriginalMetadataPopulated
in interface IFormatReader
setOriginalMetadataPopulated
in class FormatReader
public void setGroupFiles(boolean group)
IFormatReader
setGroupFiles
in interface IFormatReader
setGroupFiles
in class FormatReader
IFormatReader.fileGroupOption(String)
,
IFormatReader.isGroupFiles()
public void setFlattenedResolutions(boolean flattened)
IFormatReader
setFlattenedResolutions
in interface IFormatReader
setFlattenedResolutions
in class FormatReader
public void setMetadataFiltered(boolean filter)
IFormatReader
setMetadataFiltered
in interface IFormatReader
setMetadataFiltered
in class FormatReader
public void setMetadataStore(MetadataStore store)
IFormatReader
setMetadataStore
in interface IFormatReader
setMetadataStore
in class FormatReader
store
- a metadata store implementation.public byte[][] get8BitLookupTable() throws FormatException, java.io.IOException
IFormatReader
IFormatReader.isIndexed()
returns
false, then this may return null. Also, if IFormatReader.getPixelType()
returns
anything other than FormatTools.INT8
or FormatTools.UINT8
,
this method will return null.get8BitLookupTable
in interface IFormatReader
get8BitLookupTable
in class FormatReader
FormatException
java.io.IOException
public short[][] get16BitLookupTable() throws FormatException, java.io.IOException
IFormatReader
IFormatReader.isIndexed()
returns
false, then this may return null. Also, if IFormatReader.getPixelType()
returns
anything other than FormatTools.INT16
or FormatTools.UINT16
, this method will return null.get16BitLookupTable
in interface IFormatReader
get16BitLookupTable
in class FormatReader
FormatException
java.io.IOException
public java.lang.String[] getSeriesUsedFiles(boolean noPixels)
IFormatReader
IFormatHandler.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.getSeriesUsedFiles
in interface IFormatReader
getSeriesUsedFiles
in class FormatReader
public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, java.io.IOException
IFormatReader
openBytes
in interface IFormatReader
openBytes
in class FormatReader
no
- the image index within the file.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-imagebuf
for convenience.FormatException
- if there was a problem parsing the metadata of the
file.java.io.IOException
- if there was a problem reading the file.public void close(boolean fileOnly) throws java.io.IOException
IFormatReader
Closeable.close()
.close
in interface IFormatReader
close
in class FormatReader
java.io.IOException
public int getOptimalTileWidth()
IFormatReader
getOptimalTileWidth
in interface IFormatReader
getOptimalTileWidth
in class FormatReader
public int getOptimalTileHeight()
IFormatReader
getOptimalTileHeight
in interface IFormatReader
getOptimalTileHeight
in class FormatReader
public void reopenFile() throws java.io.IOException
IFormatReader
IFormatHandler.setId(java.lang.String)
has been
called, but close(false) has not been called.reopenFile
in interface IFormatReader
reopenFile
in class FormatReader
java.io.IOException
public void setId(java.lang.String id) throws FormatException, java.io.IOException
FormatReader
FormatReader.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.setId
in interface IFormatHandler
setId
in class FormatReader
id
- a String
specifying the path to the fileFormatException
java.io.IOException
private boolean callLegacyReader()
Copyright © 2019 Open Microscopy Environment