public class PrairieReader extends FormatReader
Modifier and Type | Field and Description |
---|---|
static String[] |
CFG_SUFFIX |
private Location |
cfgFile
The associated XML files.
|
private int[] |
channels
List of active channels.
|
private static String |
DATE_FORMAT |
static String[] |
ENV_SUFFIX |
private 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 String[] |
PRAIRIE_SUFFIXES |
private static int |
PRAIRIE_TAG_1 |
private static int |
PRAIRIE_TAG_2 |
private static int |
PRAIRIE_TAG_3 |
private 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 String[] |
XML_SUFFIX |
private 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(Length xPos,
Length xInitial)
Determines whether the two
Length values are equal. |
int |
fileGroupOption(String id)
Returns an int indicating that we cannot, must, or might group the files
in a given dataset.
|
private Location |
find(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 String |
getPath(PrairieMetadata.PFile file)
Gets the absolute path to the filename of the given
PrairieMetadata.PFile . |
String[] |
getSeriesUsedFiles(boolean noPixels)
Returns an array of filenames needed to open the current series.
|
protected void |
initFile(String id)
Initializes the given file (parsing header information, etc.).
|
private boolean |
isMinimumMetadata()
Gets whether to populate only the minimum required metadata.
|
boolean |
isSingleFile(String id)
Returns true if this is a single-file format.
|
boolean |
isThisType(RandomAccessInputStream stream)
Checks if the given stream is a valid stream for this file format.
|
boolean |
isThisType(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 Document |
parseDOM(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 PositiveFloat |
pf(Double value,
String name)
|
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, getBinning, getBitsPerPixel, getCompression, getContrastMethod, getCoreIndex, getCoreMetadataList, getCorrection, 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
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 String[] CFG_SUFFIX
public static final String[] ENV_SUFFIX
public static final String[] XML_SUFFIX
public static final 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 String DATE_FORMAT
private TiffReader tiff
private Location xmlFile
private Location cfgFile
private Location envFile
private PrairieMetadata meta
private 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(String id) throws FormatException, IOException
IFormatReader
isSingleFile
in interface IFormatReader
isSingleFile
in class FormatReader
FormatException
IOException
public boolean isThisType(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(RandomAccessInputStream stream) throws IOException
IFormatReader
isThisType
in interface IFormatReader
isThisType
in class FormatReader
IOException
public int fileGroupOption(String id) throws FormatException, IOException
IFormatReader
fileGroupOption
in interface IFormatReader
fileGroupOption
in class FormatReader
FormatException
IOException
public String[] getSeriesUsedFiles(boolean noPixels)
IFormatReader
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, 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.IOException
- if there was a problem reading the file.public void close(boolean fileOnly) throws IOException
IFormatReader
Closeable.close()
.close
in interface IFormatReader
close
in class FormatReader
IOException
protected void initFile(String id) throws FormatException, IOException
FormatReader
initFile
in class FormatReader
FormatException
- if a parsing error occurs processing the file.IOException
- if an I/O error occurs processing the fileprivate void findMetadataFiles()
private void parsePrairieMetadata() throws FormatException, IOException
meta
.FormatException
IOException
private void populateCoreMetadata() throws FormatException, IOException
CoreMetadata
by extracting relevant values
from the parsed meta
structure.FormatException
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 Document parseDOM(Location file) throws ParserConfigurationException, SAXException, IOException
Document
from the data in the given file.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 String getPath(PrairieMetadata.PFile file)
PrairieMetadata.PFile
.private byte[] blank(byte[] buf)
private PositiveFloat pf(Double value, String name)
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)
.Copyright © 2016 Open Microscopy Environment