Package loci.formats.in
Class PrairieReader
java.lang.Object
loci.formats.FormatHandler
loci.formats.FormatReader
loci.formats.in.PrairieReader
- All Implemented Interfaces:
Closeable,AutoCloseable,ICompressedTileReader,IFormatHandler,IFormatReader,IMetadataConfigurable,IPyramidHandler
PrairieReader is the file format reader for
Prairie Technologies' TIFF variant.
- Author:
- Curtis Rueden, Melissa Linkert, Michael Fox
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String[]private StringThe associated XML files.private int[]List of active channels.private static final Stringstatic final String[]private StringThe associated XML files.private boolean[]Whether a series usesFrames as time points rather than focal planes (i.e., sizeZ and sizeT values inverted).private PrairieMetadataFormat-specific metadata.static final String[]private static final intprivate static final intprivate static final intprivate ArrayList<PrairieMetadata.Sequence> List of Prairie metadataSequences, ordered by cycle.private booleanFlag indicating that the reader is operating in a mode where grouping of files is disallowed.private TiffReaderHelper reader for opening images.static final String[]private StringThe associated XML files.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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate byte[]blank(byte[] buf) Blanks out and returns the given buffer.voidclose(boolean fileOnly) Closes the currently open file.private intcomputeSizeT(int sequenceCount) Scans the parsed metadata to determine the number of actual time points versus the number of actual stage positions.private static booleanequal(ome.units.quantity.Length xPos, ome.units.quantity.Length xInitial) Determines whether the twoLengthvalues are equal.intReturns an indication of whether the files in a multi-file dataset can be handled individually.private loci.common.LocationFinds the first file with one of the given suffixes.private voidprivate intframeIndex(PrairieMetadata.Sequence sequence, int z, int t, int s) Gets the frame index associated with the given (Z, T) position of the specified series.intReturns the optimal sub-image height for use with openBytes.intReturns the optimal sub-image width for use with openBytes.private StringgetPath(PrairieMetadata.PFile file) Gets the absolute path to the filename of the givenPrairieMetadata.PFile.String[]getSeriesUsedFiles(boolean noPixels) Returns an array of filenames needed to open the current series.protected voidInitializes the given file (parsing header information, etc.).private booleanGets whether to populate only the minimum required metadata.booleanisSingleFile(String id) Returns true if the named file is expected to be the only file in the dataset.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.private DocumentparseDOM(loci.common.Location file) Parses aDocumentfrom the data in the given file.private voidThis step parses the Prairie metadata files into the Prairie-specific metadata structure,meta.private ome.xml.model.primitives.PositiveFloatConverts the givendoubleto aPositiveFloat, ornullif incompatible.private voidThis step populates theCoreMetadataby extracting relevant values from the parsedmetastructure.private voidThis step populates the OMEMetadataStoreby extracting relevant values from the parsedmetastructure.private voidThis steps populates the original metadata table (the tables returned byFormatReader.getGlobalMetadata()andFormatReader.getSeriesMetadata()).private booleanpositionsMatch(int sizeT, int sizeP) Verifies that stage coordinates match for all (P, Z) across time.private PrairieMetadata.Sequencesequence(int s) Gets the first sequence associated with the given series.private PrairieMetadata.Sequencesequence(int t, int s) Gets the sequence associated with the given series and time point.private PrairieMetadata.Sequencesequence(int t, int p, int sizeP) Gets the sequence associated with the given time point and stage position.private voidwarnFile(PrairieMetadata.Sequence sequence, int index, int channel) Emits a warning about a missing<File>.private voidwarnFilename(PrairieMetadata.Sequence sequence, int index, int channel) Emits a warning about a<File>'s missingfilename.private voidwarnFrame(PrairieMetadata.Sequence sequence, int index) Emits a warning about a missing<Frame>.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, flattenHashtables, get16BitLookupTable, get8BitLookupTable, 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, isFalseColor, isGroupFiles, isIndexed, isInterleaved, isInterleaved, isLittleEndian, isMetadataComplete, isMetadataFiltered, isNormalized, isOrderCertain, isOriginalMetadataPopulated, isRGB, isThisType, isThisType, isThumbnailSeries, isUsedFile, makeFilterMetadata, openBytes, openBytes, openBytes, openPlane, openThumbBytes, readPlane, readPlane, readPlane, reopenFile, seriesToCoreIndex, setCoreIndex, setFillColor, setFlattenedResolutions, setGroupFiles, setId, setMetadataFiltered, setMetadataStore, setNormalized, setOriginalMetadataPopulated, setResolution, setSeries, 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
-
CFG_SUFFIX
-
ENV_SUFFIX
-
XML_SUFFIX
-
PRAIRIE_SUFFIXES
-
PRAIRIE_TAG_1
private static final int PRAIRIE_TAG_1- See Also:
-
PRAIRIE_TAG_2
private static final int PRAIRIE_TAG_2- See Also:
-
PRAIRIE_TAG_3
private static final int PRAIRIE_TAG_3- See Also:
-
DATE_FORMAT
- See Also:
-
tiff
Helper reader for opening images. -
xmlFile
The associated XML files. -
cfgFile
The associated XML files. -
envFile
The associated XML files. -
meta
Format-specific metadata. -
sequences
List of Prairie metadataSequences, ordered by cycle. -
channels
private int[] channelsList of active channels. -
framesAreTime
private boolean[] framesAreTimeWhether a series usesFrames as time points rather than focal planes (i.e., sizeZ and sizeT values inverted).This situation occurs when the series's first
Sequenceis labeled as a "TSeries" (i.e.,PrairieMetadata.Sequence.isTimeSeries()returns true), but there is only oneSequence.The array length equals the number of series; i.e., it is a parallel array to
FormatReader.core. -
singleTiffMode
private boolean singleTiffModeFlag indicating that the reader is operating in a mode where grouping of files is disallowed. In the case of Prairie, this happens if a TIFF file is passed toFormatReader.setId(java.lang.String)whileFormatReader.isGroupFiles()isfalse.
-
-
Constructor Details
-
PrairieReader
public PrairieReader()Constructs a new Prairie TIFF reader.
-
-
Method Details
-
isSingleFile
Description copied from interface:IFormatReaderReturns true if the named file is expected to be the only file in the dataset. For single-file formats, always returns true.- Specified by:
isSingleFilein interfaceIFormatReader- Overrides:
isSingleFilein classFormatReader- Throws:
FormatExceptionIOException
-
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
-
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:
-
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
-
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
-
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
-
initFile
Description copied from class:FormatReaderInitializes the given file (parsing header information, etc.). Most subclasses should override this method to perform initialization operations such as parsing metadata.- Overrides:
initFilein classFormatReader- Throws:
FormatException- if a parsing error occurs processing the file.IOException- if an I/O error occurs processing the file
-
findMetadataFiles
private void findMetadataFiles() -
parsePrairieMetadata
This step parses the Prairie metadata files into the Prairie-specific metadata structure,meta.- Throws:
FormatExceptionIOException
-
populateCoreMetadata
This step populates theCoreMetadataby extracting relevant values from the parsedmetastructure.- Throws:
FormatExceptionIOException
-
populateOriginalMetadata
private void populateOriginalMetadata()This steps populates the original metadata table (the tables returned byFormatReader.getGlobalMetadata()andFormatReader.getSeriesMetadata()). -
populateOMEMetadata
This step populates the OMEMetadataStoreby extracting relevant values from the parsedmetastructure.- Throws:
FormatException
-
isMinimumMetadata
private boolean isMinimumMetadata()Gets whether to populate only the minimum required metadata. -
parseDOM
private Document parseDOM(loci.common.Location file) throws ParserConfigurationException, SAXException, IOException Parses aDocumentfrom the data in the given file. -
warnFrame
Emits a warning about a missing<Frame>. -
warnFile
Emits a warning about a missing<File>. -
warnFilename
Emits a warning about a<File>'s missingfilename. -
getPath
Gets the absolute path to the filename of the givenPrairieMetadata.PFile. -
blank
private byte[] blank(byte[] buf) Blanks out and returns the given buffer. -
pf
Converts the givendoubleto aPositiveFloat, ornullif incompatible. -
find
Finds the first file with one of the given suffixes. -
computeSizeT
private int computeSizeT(int sequenceCount) Scans the parsed metadata to determine the number of actual time points versus the number of actual stage positions. The Prairie file format makes no distinction between the two, referring to both as "Sequences", so we must compare XYZ stage positions to differentiate them. -
positionsMatch
private boolean positionsMatch(int sizeT, int sizeP) Verifies that stage coordinates match for all (P, Z) across time. -
sequence
Gets the first sequence associated with the given series.- Parameters:
s- The series (i.e., stage position).- Returns:
- The first associated
Sequence.
-
sequence
Gets the sequence associated with the given series and time point.- Parameters:
t- The time point.s- The series (i.e., stage position).- Returns:
- The associated
Sequence.
-
sequence
Gets the sequence associated with the given time point and stage position.- Parameters:
t- The time point.p- The stage position.sizeP- The number of stage positions.- Returns:
- The associated
Sequence.
-
frameIndex
Gets the frame index associated with the given (Z, T) position of the specified series.- Parameters:
sequence- The sequence from which to extract the frame.z- The focal plane.t- The time point.s- The series (i.e., stage position).- Returns:
- The frame index which can be passed to
PrairieMetadata.Sequence.getFrame(int).
-
equal
private static boolean equal(ome.units.quantity.Length xPos, ome.units.quantity.Length xInitial) Determines whether the twoLengthvalues are equal.
-