Package loci.formats.in
Class NDPIReader
- All Implemented Interfaces:
Closeable,AutoCloseable,ICompressedTileReader,IFormatHandler,IFormatReader,IMetadataConfigurable,IPyramidHandler
NDPIReader is the file format reader for Hamamatsu .ndpi files.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate intprivate intprivate Stringprivate static final intprivate static final intprivate static final intprivate Doubleprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate Stringprivate JPEGTurboServiceprivate intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intFields inherited from class loci.formats.in.BaseTiffReader
DATE_FORMATS, LOGGERFields inherited from class loci.formats.in.MinimalTiffReader
canSeparateSeries, equalStrips, ifds, lastPlane, mergeSubIFDs, noSubresolutions, seriesToIFD, subResolutionIFDs, thumbnailIFDs, tiffParser, use64BitFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose(boolean fileOnly) Closes the currently open file.intReturns an indication of whether the files in a multi-file dataset can be handled individually.private intgetBitsPerSample(int mode) Get the number of bits per sample associated with the given capture mode.private StringgetCaptureMode(int mode) Get the description of the given capture mode.private intgetIFDIndex(int seriesIndex, int zIndex) private long[]getMarkers(IFD ifd) Get the array of restart markers (offsets) for the given IFD.intReturns the optimal sub-image height for use with openBytes.intReturns the optimal sub-image width for use with openBytes.protected intgetTileCodec(int no) Retrieve a codec that can be used to decompress compressed tiles.getTileCodecOptions(int no, int x, int y) Retrieve codec options that can be used to decompressed the specified tile.intgetTileColumns(int no) Get the number of columns of tiles in the specified plane in the current series.intgetTileRows(int no) Get the number of rows of tiles in the specified plane in the current series.protected voidInitializes the given file (parsing header information, etc.).protected voidPopulates the metadata store using the data parsed inBaseTiffReader.initStandardMetadata()along with some further parsing done in the method itself.protected voidParses standard metadata.booleanisThisType(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.byte[]openCompressedBytes(int no, byte[] buf, int x, int y) Retrieve the specified tile without performing any decompression.byte[]openCompressedBytes(int no, int x, int y) Retrieve the specified tile without performing any decompression.byte[]openThumbBytes(int no) Obtains a thumbnail for the specified image plane from the current file, as a byte array.private voidresetStream(IFD ifd) private booleanuseTiffParser(IFD ifd) Methods inherited from class loci.formats.in.BaseTiffReader
getExifTagName, getImageCreationDate, initMetadata, put, put, put, put, put, put, put, put, put, put, putDouble, putInt, putStringMethods inherited from class loci.formats.in.MinimalTiffReader
copyTile, get16BitLookupTable, get8BitLookupTable, getCompressedByteCount, getIFDs, getThumbnailIFDs, getThumbSizeX, getThumbSizeY, getTileIndex, initTiffParser, isThisType, reopenFile, setResolutionLevelMethods 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, 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, getUnderlyingReaders, getUsedFiles, getUsedFiles, getZCTCoords, getZCTModuloCoords, hasCompanionFiles, hasFlattenedResolutions, isFalseColor, isGroupFiles, isIndexed, isInterleaved, isInterleaved, isLittleEndian, isMetadataComplete, isMetadataFiltered, isNormalized, isOrderCertain, isOriginalMetadataPopulated, isRGB, isSingleFile, 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.IFormatHandler
getFormat, getNativeDataType, getSuffixesMethods inherited from interface loci.formats.IMetadataConfigurable
getMetadataOptions, getSupportedMetadataLevels, setMetadataOptions
-
Field Details
-
MAX_SIZE
private static final int MAX_SIZE- See Also:
-
OFFSET_HIGH_BYTES
private static final int OFFSET_HIGH_BYTES- See Also:
-
BYTE_COUNT_HIGH_BYTES
private static final int BYTE_COUNT_HIGH_BYTES- See Also:
-
VERSION
private static final int VERSION- See Also:
-
SOURCE_LENS
private static final int SOURCE_LENS- See Also:
-
X_POSITION
private static final int X_POSITION- See Also:
-
Y_POSITION
private static final int Y_POSITION- See Also:
-
Z_POSITION
private static final int Z_POSITION- See Also:
-
TISSUE_INDEX
private static final int TISSUE_INDEX- See Also:
-
MARKER_TAG
private static final int MARKER_TAG- See Also:
-
REFERENCE
private static final int REFERENCE- See Also:
-
MARKER_TAG_HIGH_BYTES
private static final int MARKER_TAG_HIGH_BYTES- See Also:
-
FILTER_SET_NAME
private static final int FILTER_SET_NAME- See Also:
-
EXPOSURE_RATIO
private static final int EXPOSURE_RATIO- See Also:
-
RED_MULTIPLIER
private static final int RED_MULTIPLIER- See Also:
-
GREEN_MULTIPLIER
private static final int GREEN_MULTIPLIER- See Also:
-
BLUE_MULTIPLIER
private static final int BLUE_MULTIPLIER- See Also:
-
THUMB_TAG_2
private static final int THUMB_TAG_2- See Also:
-
FOCUS_POINT_REGIONS
private static final int FOCUS_POINT_REGIONS- See Also:
-
CAPTURE_MODE
private static final int CAPTURE_MODE- See Also:
-
SERIAL_NUMBER
private static final int SERIAL_NUMBER- See Also:
-
JPEG_QUALITY
private static final int JPEG_QUALITY- See Also:
-
REFOCUS_INTERVAL
private static final int REFOCUS_INTERVAL- See Also:
-
FOCUS_OFFSET
private static final int FOCUS_OFFSET- See Also:
-
FIRMWARE_VERSION
private static final int FIRMWARE_VERSION- See Also:
-
METADATA_TAG
private static final int METADATA_TAG- See Also:
-
LABEL_OBSCURED
private static final int LABEL_OBSCURED- See Also:
-
WAVELENGTH
private static final int WAVELENGTH- See Also:
-
LAMP_AGE
private static final int LAMP_AGE- See Also:
-
EXPOSURE_TIME
private static final int EXPOSURE_TIME- See Also:
-
FOCUS_TIME
private static final int FOCUS_TIME- See Also:
-
SCAN_TIME
private static final int SCAN_TIME- See Also:
-
WRITE_TIME
private static final int WRITE_TIME- See Also:
-
FULLY_AUTO_FOCUS
private static final int FULLY_AUTO_FOCUS- See Also:
-
DEFAULT_GAMMA
private static final int DEFAULT_GAMMA- See Also:
-
initializedSeries
private int initializedSeries -
initializedPlane
private int initializedPlane -
sizeZ
private int sizeZ -
pyramidHeight
private int pyramidHeight -
service
-
magnification
-
serialNumber
-
instrumentModel
-
-
Constructor Details
-
NDPIReader
public NDPIReader()Constructs a new NDPI reader.
-
-
Method Details
-
getTileRows
public int getTileRows(int no) Description copied from interface:ICompressedTileReaderGet the number of rows of tiles in the specified plane in the current series.- Specified by:
getTileRowsin interfaceICompressedTileReader- Overrides:
getTileRowsin classFormatReader- Parameters:
no- plane index- Returns:
- tile row count
-
getTileColumns
public int getTileColumns(int no) Description copied from interface:ICompressedTileReaderGet the number of columns of tiles in the specified plane in the current series.- Specified by:
getTileColumnsin interfaceICompressedTileReader- Overrides:
getTileColumnsin classFormatReader- Parameters:
no- plane index- Returns:
- tile column count
-
openCompressedBytes
Description copied from interface:ICompressedTileReaderRetrieve the specified tile without performing any decompression.- Parameters:
no- plane indexx- tile X index (indexed from 0, @see getTileColumns(int))y- tile Y index (indexed from 0, @see getTileRows(int))- Returns:
- compressed tile bytes
- Throws:
FormatExceptionIOException
-
openCompressedBytes
public byte[] openCompressedBytes(int no, byte[] buf, int x, int y) throws FormatException, IOException Description copied from interface:ICompressedTileReaderRetrieve the specified tile without performing any decompression.- Parameters:
no- plane indexbuf- pre-allocated buffer in which to store compressed bytesx- tile X index (indexed from 0, @see getTileColumns(int))y- tile Y index (indexed from 0, @see getTileRows(int))- Returns:
- compressed tile bytes
- Throws:
FormatExceptionIOException
-
getTileCodec
Description copied from interface:ICompressedTileReaderRetrieve a codec that can be used to decompress compressed tiles.- Parameters:
no- plane index- Returns:
- codec that can be used for compressed tiles in the specified plane
- Throws:
FormatExceptionIOException- See Also:
-
getTileCodecOptions
Description copied from interface:ICompressedTileReaderRetrieve codec options that can be used to decompressed the specified tile.- Parameters:
no- plane indexx- tile X index (indexed from 0, @see getTileColumns(int))y- tile Y index (indexed from 0, @see getTileRows(int))- Returns:
- codec options
- Throws:
FormatExceptionIOException- See Also:
-
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.
-
fileGroupOption
Description copied from interface:IFormatReaderReturns an indication of whether the files in a multi-file dataset can be handled individually. This method is only useful for formats and datasets which contain multiple files.- Specified by:
fileGroupOptionin interfaceIFormatReader- Overrides:
fileGroupOptionin classFormatReader- Parameters:
id- a file in the multi-file dataset- Returns:
- an int indicating that we cannot, must, or might group the files.
A return value of
FormatTools.MUST_GROUPindicates that the files cannot be handled separately; the reader will always detect and read all files in the dataset.FormatTools.CAN_GROUPindicates that the files may be handled separately, but file grouping must then be disabled viaIFormatReader.setGroupFiles(boolean).FormatTools.CANNOT_GROUPindicates that the files must be handled separately; the reader will not attempt to read all files in the dataset (this is rare). - Throws:
FormatExceptionIOException- See Also:
-
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- Overrides:
openBytesin classMinimalTiffReader- 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:
-
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 classMinimalTiffReader- Throws:
FormatExceptionIOException
-
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 classMinimalTiffReader- 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 classMinimalTiffReader
-
getOptimalTileHeight
public int getOptimalTileHeight()Description copied from interface:IFormatReaderReturns the optimal sub-image height for use with openBytes.- Specified by:
getOptimalTileHeightin interfaceIFormatReader- Overrides:
getOptimalTileHeightin classMinimalTiffReader
-
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 classBaseTiffReader- Throws:
FormatException- if a parsing error occurs processing the file.IOException- if an I/O error occurs processing the file
-
initStandardMetadata
Description copied from class:BaseTiffReaderParses 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.- Overrides:
initStandardMetadatain classBaseTiffReader- Throws:
FormatExceptionIOException
-
initMetadataStore
Description copied from class:BaseTiffReaderPopulates the metadata store using the data parsed inBaseTiffReader.initStandardMetadata()along with some further parsing done in the method itself. All calls to the activeMetadataStoreshould 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.- Overrides:
initMetadataStorein classBaseTiffReader- Throws:
FormatException
-
getPyramidHeight
protected int getPyramidHeight() -
getIFDIndex
private int getIFDIndex(int seriesIndex, int zIndex) -
useTiffParser
- Returns:
- true if tiles can be read using TiffParser logic, or false if the JPEGTurboService needs to be used
- Throws:
FormatException
-
getCaptureMode
Get the description of the given capture mode. -
getBitsPerSample
private int getBitsPerSample(int mode) Get the number of bits per sample associated with the given capture mode. -
getMarkers
Get the array of restart markers (offsets) for the given IFD. Reads both the marker tag and marker high bytes tag (if present) to build the array of 64-bit offsets.- Throws:
FormatException
-
resetStream
- Throws:
IOExceptionFormatException
-