public class PrairieReader extends FormatReader
Modifier and Type | Field and Description |
---|---|
static java.lang.String[] |
CFG_SUFFIX |
private loci.common.Location |
cfgFile
The associated XML files.
|
private int[] |
channels
List of active channels.
|
private static java.lang.String |
DATE_FORMAT |
static java.lang.String[] |
ENV_SUFFIX |
private loci.common.Location |
envFile
The associated XML files.
|
private boolean[] |
framesAreTime
Whether a series uses
Frame s as time points rather than focal
planes (i.e., sizeZ and sizeT values inverted). |
private PrairieMetadata |
meta
Format-specific metadata.
|
static java.lang.String[] |
PRAIRIE_SUFFIXES |
private static int |
PRAIRIE_TAG_1 |
private static int |
PRAIRIE_TAG_2 |
private static int |
PRAIRIE_TAG_3 |
private java.util.ArrayList<PrairieMetadata.Sequence> |
sequences
List of Prairie metadata
Sequence s, ordered by cycle. |
private boolean |
singleTiffMode
Flag indicating that the reader is operating in a mode where grouping of
files is disallowed.
|
private TiffReader |
tiff
Helper reader for opening images.
|
static java.lang.String[] |
XML_SUFFIX |
private loci.common.Location |
xmlFile
The associated XML files.
|
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 |
---|
PrairieReader()
Constructs a new Prairie TIFF reader.
|
Modifier and Type | Method and Description |
---|---|
private byte[] |
blank(byte[] buf)
Blanks out and returns the given buffer.
|
void |
close(boolean fileOnly)
Closes the currently open file.
|
private int |
computeSizeT(int sequenceCount)
Scans the parsed metadata to determine the number of actual time points
versus the number of actual stage positions.
|
private static boolean |
equal(ome.units.quantity.Length xPos,
ome.units.quantity.Length xInitial)
Determines whether the two
Length values are equal. |
int |
fileGroupOption(java.lang.String id)
Returns an indication of whether the files in a multi-file dataset can
be handled individually.
|
private loci.common.Location |
find(java.lang.String[] suffix)
Finds the first file with one of the given suffixes.
|
private void |
findMetadataFiles() |
private int |
frameIndex(PrairieMetadata.Sequence sequence,
int z,
int t,
int s)
Gets the frame index associated with the given (Z, T) position of the
specified series.
|
int |
getOptimalTileHeight()
Returns the optimal sub-image height for use with openBytes.
|
int |
getOptimalTileWidth()
Returns the optimal sub-image width for use with openBytes.
|
private java.lang.String |
getPath(PrairieMetadata.PFile file)
Gets the absolute path to the filename of the given
PrairieMetadata.PFile . |
java.lang.String[] |
getSeriesUsedFiles(boolean noPixels)
Returns an array of filenames needed to open the current series.
|
protected void |
initFile(java.lang.String id)
Initializes the given file (parsing header information, etc.).
|
private boolean |
isMinimumMetadata()
Gets whether to populate only the minimum required metadata.
|
boolean |
isSingleFile(java.lang.String id)
Returns true if the named file is expected to be the only
file in the dataset.
|
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.
|
private org.w3c.dom.Document |
parseDOM(loci.common.Location file)
Parses a
Document from the data in the given file. |
private void |
parsePrairieMetadata()
This step parses the Prairie metadata files into the Prairie-specific
metadata structure,
meta . |
private ome.xml.model.primitives.PositiveFloat |
pf(java.lang.Double value,
java.lang.String name)
Converts the given
double to a PositiveFloat , or
null if incompatible. |
private void |
populateCoreMetadata()
This step populates the
CoreMetadata by extracting relevant values
from the parsed meta structure. |
private void |
populateOMEMetadata()
This step populates the OME
MetadataStore by extracting relevant
values from the parsed meta structure. |
private void |
populateOriginalMetadata()
This steps populates the original metadata table (the tables returned by
FormatReader.getGlobalMetadata() and FormatReader.getSeriesMetadata() ). |
private boolean |
positionsMatch(int sizeT,
int sizeP)
Verifies that stage coordinates match for all (P, Z) across time.
|
private PrairieMetadata.Sequence |
sequence(int s)
Gets the first sequence associated with the given series.
|
private PrairieMetadata.Sequence |
sequence(int t,
int s)
Gets the sequence associated with the given series and time point.
|
private PrairieMetadata.Sequence |
sequence(int t,
int p,
int sizeP)
Gets the sequence associated with the given time point and stage position.
|
private void |
warnFile(PrairieMetadata.Sequence sequence,
int index,
int channel)
Emits a warning about a missing
<File> . |
private void |
warnFilename(PrairieMetadata.Sequence sequence,
int index,
int channel)
Emits a warning about a
<File> 's missing filename . |
private void |
warnFrame(PrairieMetadata.Sequence sequence,
int index)
Emits a warning about a missing
<Frame> . |
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, 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, isFalseColor, isGroupFiles, isIndexed, isInterleaved, isInterleaved, isLittleEndian, isMetadataComplete, isMetadataFiltered, isNormalized, isOrderCertain, isOriginalMetadataPopulated, isRGB, isThisType, isThisType, isThumbnailSeries, isUsedFile, makeFilterMetadata, openBytes, openBytes, openBytes, openPlane, openThumbBytes, readPlane, readPlane, reopenFile, seriesToCoreIndex, setCoreIndex, setFlattenedResolutions, setGroupFiles, setId, setMetadataFiltered, setMetadataStore, setNormalized, setOriginalMetadataPopulated, setResolution, setSeries, updateMetadataLists
checkSuffix, checkSuffix, getFormat, getMetadataOptions, getNativeDataType, getSuffixes, getSupportedMetadataLevels, setMetadataOptions
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFormat, getNativeDataType, getSuffixes
getMetadataOptions, getSupportedMetadataLevels, setMetadataOptions
public static final java.lang.String[] CFG_SUFFIX
public static final java.lang.String[] ENV_SUFFIX
public static final java.lang.String[] XML_SUFFIX
public static final java.lang.String[] PRAIRIE_SUFFIXES
private static final int PRAIRIE_TAG_1
private static final int PRAIRIE_TAG_2
private static final int PRAIRIE_TAG_3
private static final java.lang.String DATE_FORMAT
private TiffReader tiff
private loci.common.Location xmlFile
private loci.common.Location cfgFile
private loci.common.Location envFile
private PrairieMetadata meta
private java.util.ArrayList<PrairieMetadata.Sequence> sequences
Sequence
s, ordered by cycle.private int[] channels
private boolean[] framesAreTime
Frame
s as time points rather than focal
planes (i.e., sizeZ and sizeT values inverted).
This situation occurs when the series's first Sequence
is labeled
as a "TSeries" (i.e., PrairieMetadata.Sequence.isTimeSeries()
returns true), but
there is only one Sequence
.
The array length equals the number of series; i.e., it is a parallel array
to FormatReader.core
.
private boolean singleTiffMode
FormatReader.setId(java.lang.String)
while FormatReader.isGroupFiles()
is false
.public boolean isSingleFile(java.lang.String id) throws FormatException, java.io.IOException
IFormatReader
isSingleFile
in interface IFormatReader
isSingleFile
in class FormatReader
FormatException
java.io.IOException
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 int fileGroupOption(java.lang.String id) throws FormatException, java.io.IOException
IFormatReader
fileGroupOption
in interface IFormatReader
fileGroupOption
in class FormatReader
id
- a file in the multi-file datasetFormatTools.MUST_GROUP
indicates that the
files cannot be handled separately; the reader will always detect and
read all files in the dataset. FormatTools.CAN_GROUP
indicates
that the files may be handled separately, but file grouping must then
be disabled via IFormatReader.setGroupFiles(boolean)
.
FormatTools.CANNOT_GROUP
indicates that the files must be handled
separately; the reader will not attempt to read all files in the dataset
(this is rare).FormatException
java.io.IOException
FormatTools.MUST_GROUP
,
FormatTools.CAN_GROUP
,
FormatTools.CANNOT_GROUP
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 int getOptimalTileWidth()
IFormatReader
getOptimalTileWidth
in interface IFormatReader
getOptimalTileWidth
in class FormatReader
public int getOptimalTileHeight()
IFormatReader
getOptimalTileHeight
in interface IFormatReader
getOptimalTileHeight
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 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-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
protected void initFile(java.lang.String id) throws FormatException, java.io.IOException
FormatReader
initFile
in class FormatReader
FormatException
- if a parsing error occurs processing the file.java.io.IOException
- if an I/O error occurs processing the fileprivate void findMetadataFiles()
private void parsePrairieMetadata() throws FormatException, java.io.IOException
meta
.FormatException
java.io.IOException
private void populateCoreMetadata() throws FormatException, java.io.IOException
CoreMetadata
by extracting relevant values
from the parsed meta
structure.FormatException
java.io.IOException
private void populateOriginalMetadata()
FormatReader.getGlobalMetadata()
and FormatReader.getSeriesMetadata()
).private void populateOMEMetadata() throws FormatException
MetadataStore
by extracting relevant
values from the parsed meta
structure.FormatException
private boolean isMinimumMetadata()
private org.w3c.dom.Document parseDOM(loci.common.Location file) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException, java.io.IOException
Document
from the data in the given file.javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException
private void warnFrame(PrairieMetadata.Sequence sequence, int index)
<Frame>
.private void warnFile(PrairieMetadata.Sequence sequence, int index, int channel)
<File>
.private void warnFilename(PrairieMetadata.Sequence sequence, int index, int channel)
<File>
's missing filename
.private java.lang.String getPath(PrairieMetadata.PFile file)
PrairieMetadata.PFile
.private byte[] blank(byte[] buf)
private ome.xml.model.primitives.PositiveFloat pf(java.lang.Double value, java.lang.String name)
double
to a PositiveFloat
, or
null
if incompatible.private loci.common.Location find(java.lang.String[] suffix)
private int computeSizeT(int sequenceCount)
private boolean positionsMatch(int sizeT, int sizeP)
private PrairieMetadata.Sequence sequence(int s)
s
- The series (i.e., stage position).Sequence
.private PrairieMetadata.Sequence sequence(int t, int s)
t
- The time point.s
- The series (i.e., stage position).Sequence
.private PrairieMetadata.Sequence sequence(int t, int p, int sizeP)
t
- The time point.p
- The stage position.sizeP
- The number of stage positions.Sequence
.private int frameIndex(PrairieMetadata.Sequence sequence, int z, int t, int s)
sequence
- The sequence from which to extract the frame.z
- The focal plane.t
- The time point.s
- The series (i.e., stage position).PrairieMetadata.Sequence.getFrame(int)
.private static boolean equal(ome.units.quantity.Length xPos, ome.units.quantity.Length xInitial)
Length
values are equal.Copyright © 2020 Open Microscopy Environment