Class PrairieMetadata

java.lang.Object
loci.formats.in.PrairieMetadata

public class PrairieMetadata extends Object
Metadata structure for Prairie Technologies' TIFF-based format.
Author:
Curtis Rueden, Michael Fox
  • Field Details

    • sequences

      private final HashMap<Integer,PrairieMetadata.Sequence> sequences
      <Sequence> elements, keyed on each sequence's cycle.
    • scanValues

      private final PrairieMetadata.ValueTable scanValues
      Table of key/value pairs at the top level.
    • firstSequence

      private PrairieMetadata.Sequence firstSequence
      The first actual <Sequence> element.
    • cycleMin

      private int cycleMin
      Minimum cycle value.
    • cycleMax

      private int cycleMax
      Maximum cycle value.
    • date

      private String date
      The date of the acquisition.
    • waitTime

      private Double waitTime
      The wait time of the acquisition.
    • activeChannels

      private final HashSet<Integer> activeChannels
      Set of active channel indices.
    • config

      private final PrairieMetadata.ValueTable config
      Key/value pairs from CFG and/or ENV files.
  • Constructor Details

    • PrairieMetadata

      public PrairieMetadata(Document xml, Document cfg, Document env)
      Creates a new Prairie metadata by parsing the given XML, CFG and/or ENV documents.
      Parameters:
      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.
  • Method Details

    • getWaitTime

      public Double getWaitTime()
      Gets the waitTime recorded in the configuration.
    • getActiveChannels

      public int[] getActiveChannels()
      Gets the list of active channel indices, in sorted order.

      These indices correspond to the configuration's channel keys flagged as True.

    • isInvertX

      public boolean isInvertX()
      Gets whether the stage position X coordinates are inverted (i.e., left-to-right).
    • isInvertY

      public boolean isInvertY()
      Gets whether the stage position Y coordinates are inverted (i.e., bottom-to-top).
    • getBitDepth

      public Integer getBitDepth()
      Gets the bitDepth recorded in the configuration.
    • getLaserPower

      public Double getLaserPower()
      Gets the first laserPower recorded in the configuration.
    • getConfig

      public PrairieMetadata.Value getConfig(String key)
      Gets the value of the given configuration key.
    • getConfig

      public PrairieMetadata.ValueTable getConfig()
      Gets the map of configuration key/value pairs.
    • getDate

      public String getDate()
      Gets the date of the acquisition.
    • getCycleMin

      public int getCycleMin()
      Gets the minimum cycle value. Matches the smallest cycle attribute found, and hence will not necessarily equal 1 (though in practice it usually does).
    • getCycleMax

      public int getCycleMax()
      Gets the maximum cycle value. Matches the largest cycle attribute found, and hence will not necessarily equal sequences#size() (though in practice it usually does).
    • getCycleCount

      public int getCycleCount()
      Gets the number of recorded cycles. This value is equal to getCycleMax() - getCycleMin() + 1.
    • getFirstSequence

      public PrairieMetadata.Sequence getFirstSequence()
      Gets the first Sequence.
    • getSequence

      public PrairieMetadata.Sequence getSequence(int cycle)
      Gets the Sequence at the given cycle.
    • getSequences

      public ArrayList<PrairieMetadata.Sequence> getSequences()
      Gets all Sequences, ordered by cycle.
    • getFrame

      public PrairieMetadata.Frame getFrame(int cycle, int index)
      Gets the Frame at the given (cycle and index).
    • getFile

      public PrairieMetadata.PFile getFile(int cycle, int index, int channel)
      Gets the Frame at the given (cycle, index, channel).
    • getValue

      public PrairieMetadata.Value getValue(String key)
      Gets the value of the given key, at the top-level <PVScan> element.
    • getValues

      public PrairieMetadata.ValueTable getValues()
      Gets the table of PVScan key/value pairs.
    • parseXML

      private void parseXML(Document doc)
      Parses metadata from Prairie XML file.
    • parseCFG

      private void parseCFG(Document doc)
      Parses metadata from Prairie CFG file. This file is only present for Prairie datasets recorded prior to version 5.2.
    • parseENV

      private void parseENV(Document doc)
      Parses metadata from Prairie ENV file. This file is only present for Prairie datasets recorded with version 5.2 or later.
    • parseKeys

      private void parseKeys(Element el, PrairieMetadata.ValueTable table)
      Parses <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.
    • parsePVStateShard

      private void parsePVStateShard(Element el, PrairieMetadata.ValueTable table)
      Parses the <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.
    • parseChannels

      private void parseChannels()
      Parses details of the activated channels into the activeChannels data structure from the "channel" entry of the configuration.
    • checkElement

      private void checkElement(Element el, String name)
      Checks that the given element has the specified name.
      Throws:
      IllegalArgumentException - if the name does not match.
    • getFirstChild

      private Element getFirstChild(Element el, String name)
      Gets the first child element with the given name.
    • el

      private Element el(NodeList nodes, int index)
      Gets the indexth element from the given list of nodes.
    • attr

      private String attr(Element el, String name)
      Gets the attribute value with the given name, or null if not defined.
    • value

      private String value(PrairieMetadata.Value value)
      Returns value.value(), or null if value is null.
    • value

      private String value(PrairieMetadata.Value value, String key)
      Returns value.get(key).value(), or null if value or value.get(key) is null.
    • value

      private String value(PrairieMetadata.Value value, int index)
      Returns value.get(index).value(), or null if value or value.get(index) is null.
    • b

      private boolean b(String value)
      Converts the given string to a boolean.
    • d

      private Double d(String value)
      Converts the given string to a Double, or null if incompatible.
    • i

      private Integer i(String value)
      Converts the given string to an Integer, or null if incompatible.
    • token

      private String token(String s, String regex, int i)
      Gets the ith token of the given string, split according to the specific regular expression.
    • valuesByKey

      private <K extends Comparable<? super K>, V> ArrayList<V> valuesByKey(Map<K,V> map)
      Gets the values of the given map, sorted by key.