public class PrairieMetadata
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
PrairieMetadata.Frame
A Prairie
<Frame> , beneath a <Sequence> . |
class |
PrairieMetadata.PFile
A Prairie
<File> beneath a <Frame> . |
class |
PrairieMetadata.Sequence
A Prairie
<Sequence> . |
static interface |
PrairieMetadata.Value
A value in a Prairie metadata dictionary.
|
static class |
PrairieMetadata.ValueItem
A leaf value with an actual
PrairieMetadata.ValueItem.value() as well as an optional
PrairieMetadata.ValueItem.description() . |
static class |
PrairieMetadata.ValueTable
A table of values.
|
Modifier and Type | Field and Description |
---|---|
private java.util.HashSet<java.lang.Integer> |
activeChannels
Set of active channel indices.
|
private PrairieMetadata.ValueTable |
config
Key/value pairs from CFG and/or ENV files.
|
private int |
cycleMax
Maximum cycle value.
|
private int |
cycleMin
Minimum cycle value.
|
private java.lang.String |
date
The date of the acquisition.
|
private PrairieMetadata.Sequence |
firstSequence
The first actual
<Sequence> element. |
private PrairieMetadata.ValueTable |
scanValues
Table of key/value pairs at the top level.
|
private java.util.HashMap<java.lang.Integer,PrairieMetadata.Sequence> |
sequences
<Sequence> elements, keyed on each sequence's cycle . |
private java.lang.Double |
waitTime
The wait time of the acquisition.
|
Constructor and Description |
---|
PrairieMetadata(org.w3c.dom.Document xml,
org.w3c.dom.Document cfg,
org.w3c.dom.Document env)
Creates a new Prairie metadata by parsing the given XML, CFG and/or ENV
documents.
|
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
attr(org.w3c.dom.Element el,
java.lang.String name)
Gets the attribute value with the given name, or null if not defined.
|
private boolean |
b(java.lang.String value)
Converts the given string to a
boolean . |
private void |
checkElement(org.w3c.dom.Element el,
java.lang.String name)
Checks that the given element has the specified name.
|
private java.lang.Double |
d(java.lang.String value)
Converts the given string to a
Double , or null if
incompatible. |
private org.w3c.dom.Element |
el(org.w3c.dom.NodeList nodes,
int index)
Gets the
index th element from the given list of nodes. |
int[] |
getActiveChannels()
Gets the list of active channel indices, in sorted order.
|
java.lang.Integer |
getBitDepth()
Gets the
bitDepth recorded in the configuration. |
PrairieMetadata.ValueTable |
getConfig()
Gets the map of configuration key/value pairs.
|
PrairieMetadata.Value |
getConfig(java.lang.String key)
Gets the
value of the given configuration key . |
int |
getCycleCount()
Gets the number of recorded cycles.
|
int |
getCycleMax()
Gets the maximum cycle value.
|
int |
getCycleMin()
Gets the minimum cycle value.
|
java.lang.String |
getDate()
Gets the date of the acquisition.
|
PrairieMetadata.PFile |
getFile(int cycle,
int index,
int channel)
Gets the
Frame at the given (cycle , index ,
channel ). |
private org.w3c.dom.Element |
getFirstChild(org.w3c.dom.Element el,
java.lang.String name)
Gets the first child element with the given name.
|
PrairieMetadata.Sequence |
getFirstSequence()
Gets the first
Sequence . |
PrairieMetadata.Frame |
getFrame(int cycle,
int index)
Gets the
Frame at the given (cycle and index ). |
java.lang.Double |
getLaserPower()
Gets the first
laserPower recorded in the configuration. |
PrairieMetadata.Sequence |
getSequence(int cycle)
Gets the
Sequence at the given cycle . |
java.util.ArrayList<PrairieMetadata.Sequence> |
getSequences()
Gets all
Sequences , ordered by cycle . |
PrairieMetadata.Value |
getValue(java.lang.String key)
Gets the
value of the given key , at the top-level
<PVScan> element. |
PrairieMetadata.ValueTable |
getValues()
Gets the table of
PVScan key/value pairs. |
java.lang.Double |
getWaitTime()
Gets the
waitTime recorded in the configuration. |
private java.lang.Integer |
i(java.lang.String value)
Converts the given string to an
Integer , or null if incompatible. |
boolean |
isInvertX()
Gets whether the stage position X coordinates are inverted (i.e.,
left-to-right).
|
boolean |
isInvertY()
Gets whether the stage position Y coordinates are inverted (i.e.,
bottom-to-top).
|
private void |
parseCFG(org.w3c.dom.Document doc)
Parses metadata from Prairie CFG file.
|
private void |
parseChannels()
Parses details of the activated channels into the
activeChannels
data structure from the "channel" entry of the configuration. |
private void |
parseENV(org.w3c.dom.Document doc)
Parses metadata from Prairie ENV file.
|
private void |
parseKeys(org.w3c.dom.Element el,
PrairieMetadata.ValueTable table)
Parses
<Key> elements beneath the given element, into the specified
table. |
private void |
parsePVStateShard(org.w3c.dom.Element el,
PrairieMetadata.ValueTable table)
Parses the
<PVStateShard> element beneath the given element, into
the specified table. |
private void |
parseXML(org.w3c.dom.Document doc)
Parses metadata from Prairie XML file.
|
private java.lang.String |
token(java.lang.String s,
java.lang.String regex,
int i)
Gets the
i th token of the given string, split according to the
specific regular expression. |
private java.lang.String |
value(PrairieMetadata.Value value)
Returns
value.value() , or null if value is null. |
private java.lang.String |
value(PrairieMetadata.Value value,
int index)
Returns
value.get(index).value() , or null if value or
value.get(index) is null. |
private java.lang.String |
value(PrairieMetadata.Value value,
java.lang.String key)
Returns
value.get(key).value() , or null if value or
value.get(key) is null. |
private <K extends java.lang.Comparable<? super K>,V> |
valuesByKey(java.util.Map<K,V> map)
Gets the values of the given map, sorted by key.
|
private final java.util.HashMap<java.lang.Integer,PrairieMetadata.Sequence> sequences
<Sequence>
elements, keyed on each sequence's cycle
.private final PrairieMetadata.ValueTable scanValues
private PrairieMetadata.Sequence firstSequence
<Sequence>
element.private int cycleMin
private int cycleMax
private java.lang.String date
private java.lang.Double waitTime
private final java.util.HashSet<java.lang.Integer> activeChannels
private final PrairieMetadata.ValueTable config
public PrairieMetadata(org.w3c.dom.Document xml, org.w3c.dom.Document cfg, org.w3c.dom.Document env)
xml
- The XML document to parse, or null if none available.cfg
- The CFG document to parse, or null if none available.env
- The ENV document to parse, or null if none available.public java.lang.Double getWaitTime()
waitTime
recorded in the configuration.public int[] getActiveChannels()
These indices correspond to the configuration's channel
keys
flagged as True
.
public boolean isInvertX()
public boolean isInvertY()
public java.lang.Integer getBitDepth()
bitDepth
recorded in the configuration.public java.lang.Double getLaserPower()
laserPower
recorded in the configuration.public PrairieMetadata.Value getConfig(java.lang.String key)
value
of the given configuration key
.public PrairieMetadata.ValueTable getConfig()
public java.lang.String getDate()
public int getCycleMin()
cycle
attribute
found, and hence will not necessarily equal 1
(though in practice
it usually does).public int getCycleMax()
cycle
attribute
found, and hence will not necessarily equal sequences#size()
(though in practice it usually does).public int getCycleCount()
getCycleMax()
- getCycleMin()
+ 1.public PrairieMetadata.Sequence getFirstSequence()
Sequence
.public PrairieMetadata.Sequence getSequence(int cycle)
Sequence
at the given cycle
.public java.util.ArrayList<PrairieMetadata.Sequence> getSequences()
Sequences
, ordered by cycle
.public PrairieMetadata.Frame getFrame(int cycle, int index)
Frame
at the given (cycle
and index
).public PrairieMetadata.PFile getFile(int cycle, int index, int channel)
Frame
at the given (cycle
, index
,
channel
).public PrairieMetadata.Value getValue(java.lang.String key)
value
of the given key
, at the top-level
<PVScan>
element.public PrairieMetadata.ValueTable getValues()
PVScan
key/value pairs.private void parseXML(org.w3c.dom.Document doc)
private void parseCFG(org.w3c.dom.Document doc)
private void parseENV(org.w3c.dom.Document doc)
private void parseKeys(org.w3c.dom.Element el, PrairieMetadata.ValueTable table)
<Key>
elements beneath the given element, into the specified
table. These <Key>
elements are only present in data from
PrairieView versions prior to 5.2.private void parsePVStateShard(org.w3c.dom.Element el, PrairieMetadata.ValueTable table)
<PVStateShard>
element beneath the given element, into
the specified table. These <PVStateShard>
elements are only present
in data from PrairieView versions 5.2 and later.private void parseChannels()
activeChannels
data structure from the "channel" entry of the configuration.private void checkElement(org.w3c.dom.Element el, java.lang.String name)
java.lang.IllegalArgumentException
- if the name does not match.private org.w3c.dom.Element getFirstChild(org.w3c.dom.Element el, java.lang.String name)
private org.w3c.dom.Element el(org.w3c.dom.NodeList nodes, int index)
index
th element from the given list of nodes.private java.lang.String attr(org.w3c.dom.Element el, java.lang.String name)
private java.lang.String value(PrairieMetadata.Value value)
value.value()
, or null if value
is null.private java.lang.String value(PrairieMetadata.Value value, java.lang.String key)
value.get(key).value()
, or null if value
or
value.get(key)
is null.private java.lang.String value(PrairieMetadata.Value value, int index)
value.get(index).value()
, or null if value
or
value.get(index)
is null.private boolean b(java.lang.String value)
boolean
.private java.lang.Double d(java.lang.String value)
Double
, or null
if
incompatible.private java.lang.Integer i(java.lang.String value)
Integer
, or null if incompatible.private java.lang.String token(java.lang.String s, java.lang.String regex, int i)
i
th token of the given string, split according to the
specific regular expression.private <K extends java.lang.Comparable<? super K>,V> java.util.ArrayList<V> valuesByKey(java.util.Map<K,V> map)
Copyright © 2018 Open Microscopy Environment