Tabnine Logo
PrairieMetadata
Code IndexAdd Tabnine to your IDE (free)

How to use
PrairieMetadata
in
loci.formats.in

Best Java code snippets using loci.formats.in.PrairieMetadata (Showing top 20 results out of 315)

origin: ome/formats-gpl

/** Gets the {@code Frame} at the given ({@code cycle} and {@code index}). */
public Frame getFrame(final int cycle, final int index) {
 final Sequence sequence = getSequence(cycle);
 if (sequence == null) return null;
 return sequence.getFrame(index);
}
origin: openmicroscopy/bioformats

/**
 * Parses metadata from Prairie CFG file. This file is only present for
 * Prairie datasets recorded prior to version 5.2.
 */
private void parseCFG(final Document doc) {
 checkElement(doc.getDocumentElement(), "PVConfig");
 final NodeList waitNodes = doc.getElementsByTagName("PVTSeriesElementWait");
 if (waitNodes.getLength() > 0) {
  final Element waitElement = el(waitNodes, 0);
  waitTime = d(attr(waitElement, "waitTime"));
 }
 parseKeys(doc.getDocumentElement(), config);
}
origin: ome/formats-gpl

/**
 * Gets whether the stage position Y coordinates are inverted (i.e.,
 * bottom-to-top).
 */
public boolean isInvertY() {
 return b(value(getConfig("xYStageYPositionIncreasesBottomToTop")));
}
origin: openmicroscopy/bioformats

/** Gets the first {@code laserPower} recorded in the configuration. */
public Double getLaserPower() {
 return d(value(getConfig("laserPower"), 0));
}
origin: openmicroscopy/bioformats

/** Gets the {@code bitDepth} recorded in the configuration. */
public Integer getBitDepth() {
 return i(value(getConfig("bitDepth")));
}
origin: openmicroscopy/bioformats

@Test
public void testParseOldXML() throws ParserConfigurationException,
 SAXException, IOException
{
 final Document xml = XMLTools.parseDOM(OLD_XML);
 final PrairieMetadata meta = new PrairieMetadata(xml, null, null);
 final Value positionCurrent =
  meta.getSequence(1).getFrame(1).getValue("positionCurrent");
 final Value xAxis = positionCurrent.get("XAxis");
 assertEquals("0.95", xAxis.value());
 final Value yAxis = positionCurrent.get("YAxis");
 assertEquals("-4.45", yAxis.value());
 final ValueTable zAxis = (ValueTable) positionCurrent.get("ZAxis");
 assertEquals("-9", zAxis.get(0).value());
 assertEquals("62.45", zAxis.get(1).value());
}
origin: ome/formats-gpl

/** Parses metadata from Prairie XML file. */
private void parseXML(final Document doc) {
 final Element pvScan = doc.getDocumentElement();
 checkElement(pvScan, "PVScan");
 // parse <PVStateShard> key/value block
 parsePVStateShard(pvScan, scanValues);
 // parse acquisition date
 date = attr(pvScan, "date");
 // iterate over all Sequence elements
 final NodeList sequenceNodes = doc.getElementsByTagName("Sequence");
 for (int s = 0; s < sequenceNodes.getLength(); s++) {
  final Element sequenceElement = el(sequenceNodes, s);
  if (sequenceElement == null) continue;
  final Sequence sequence = new Sequence(sequenceElement);
  if (firstSequence == null) firstSequence = sequence;
  final int cycle = sequence.getCycle();
  if (cycle < cycleMin) cycleMin = cycle;
  if (cycle > cycleMax) cycleMax = cycle;
  sequences.put(cycle, sequence);
 }
}
origin: openmicroscopy/bioformats

/**
 * This step parses the Prairie metadata files into the Prairie-specific
 * metadata structure, {@link #meta}.
 */
private void parsePrairieMetadata() throws FormatException, IOException {
 LOGGER.info("Parsing Prairie metadata");
 final Document xml, cfg, env;
 try {
  xml = parseDOM(xmlFile);
  cfg = parseDOM(cfgFile);
  env = parseDOM(envFile);
 }
 catch (ParserConfigurationException exc) {
  throw new FormatException(exc);
 }
 catch (SAXException exc) {
  throw new FormatException(exc);
 }
 meta = new PrairieMetadata(xml, cfg, env);
 sequences = meta.getSequences();
 channels = meta.getActiveChannels();
 if (channels == null || channels.length == 0) {
  throw new FormatException("No active channels found");
 }
}
origin: ome/formats-gpl

/**
 * This steps populates the original metadata table (the tables returned by
 * {@link #getGlobalMetadata()} and {@link #getSeriesMetadata()}).
 */
private void populateOriginalMetadata() {
 final boolean minimumMetadata = isMinimumMetadata();
 if (minimumMetadata) return;
 // populate global metadata
 addGlobalMeta("cycleCount", meta.getCycleCount());
 addGlobalMeta("date", meta.getDate());
 addGlobalMeta("waitTime", meta.getWaitTime());
 addGlobalMeta("sequenceCount", sequences.size());
 final ValueTable config = meta.getConfig();
 for (final String key : config.keySet()) {
  addGlobalMeta(key, config.get(key).toString());
 }
 addGlobalMeta("meta", meta);
 // populate series metadata
 final int seriesCount = getSeriesCount();
 for (int s = 0; s < seriesCount; s++) {
  setSeries(s);
  final Sequence sequence = sequence(s);
  addSeriesMeta("cycle", sequence.getCycle());
  addSeriesMeta("indexCount", sequence.getIndexCount());
  addSeriesMeta("type", sequence.getType());
 }
 setSeries(0);
}
origin: ome/formats-gpl

/**
 * Parses details of the activated channels into the {@link #activeChannels}
 * data structure from the "channel" entry of the configuration.
 */
private void parseChannels() {
 final Value channels = config.get("channel");
 if (!(channels instanceof ValueTable)) return;
 final ValueTable channelsTable = (ValueTable) channels;
 for (final String key : channelsTable.keySet()) {
  final Value value = channelsTable.get(key);
  // verify that the channel is active
  if (!b(value(value))) continue; // channel not active
  // parse the channel index (converting to a 1-based index!)
  final int channelIndex = i(key) + 1;
  // add the channel index to the active channels list
  activeChannels.add(channelIndex);
 }
}
origin: openmicroscopy/bioformats

final Element pvStateShard = getFirstChild(el, "PVStateShard");
if (pvStateShard == null) return;
 final Element keyElement = el(svNodes, k);
 if (keyElement == null) continue;
 final String key = attr(keyElement, "key");
 final String value = attr(keyElement, "value");
 if (value != null) {
  table.put(key, new ValueItem(value, attr(keyElement, "description")));
  continue;
  final Element ivElement = el(ivNodes, i);
  if (ivElement == null) continue;
  final String index = attr(ivElement, "index");
  if (index == null) continue; // invalid <IndexedValue> element
  final String iValue = attr(ivElement, "value");
  final String iDescription = attr(ivElement, "description");
  subTable.put(index, new ValueItem(iValue, iDescription));
  keyElement.getElementsByTagName("SubindexedValues");
 for (int i = 0; i < sivNodes.getLength(); i++) {
  final Element sivElement = el(sivNodes, i);
  if (sivElement == null) continue;
  final String index = attr(sivElement, "index");
  if (index == null) continue; // invalid <SubindexedValues> element
  final ValueTable subSubTable = new ValueTable();
   sivElement.getElementsByTagName("SubindexedValue");
origin: openmicroscopy/bioformats

/**
 * Parses metadata from Prairie ENV file. This file is only present for
 * Prairie datasets recorded with version 5.2 or later.
 */
private void parseENV(final Document doc) {
 checkElement(doc.getDocumentElement(), "Environment");
 parsePVStateShard(doc.getDocumentElement(), config);
}
origin: openmicroscopy/bioformats

final NodeList keyNodes = el.getElementsByTagName("Key");
for (int k = 0; k < keyNodes.getLength(); k++) {
 final Element keyElement = el(keyNodes, k);
 if (keyElement == null) continue;
 final String key = attr(keyElement, "key");
 final String value = attr(keyElement, "value");
 final int underscore = key.indexOf('_');
 if (underscore < 0) {
origin: openmicroscopy/bioformats

/** Gets the first child element with the given name. */
private Element getFirstChild(final Element el, final String name) {
 // NB: Unfortunately, the Element interface has no API method to obtain
 // _only_ direct children with a given name; the getElementsByTagName
 // method returns _all_ descendant elements with the given name.
 final NodeList nodeList = el.getChildNodes();
 for (int i = 0; i < nodeList.getLength(); i++) {
  final Element child = el(nodeList, i);
  if (child == null) continue;
  if (name.equals(child.getNodeName())) return child;
 }
 return null;
}
origin: openmicroscopy/bioformats

final int seriesCount = sequenceCount / sizeT;
final Integer bitDepth = meta.getBitDepth();
int bpp = bitDepth == null ? -1 : bitDepth;
origin: openmicroscopy/bioformats

 @Test
 public void testParseNewXML() throws ParserConfigurationException,
  SAXException, IOException
 {
  final Document xml = XMLTools.parseDOM(NEW_XML);
  final PrairieMetadata meta = new PrairieMetadata(xml, null, null);

  final ValueTable positionCurrent = (ValueTable)
   meta.getSequence(1).getFrame(1).getValue("positionCurrent");

  final ValueTable xAxis = (ValueTable) positionCurrent.get("XAxis");
  assertEquals("-621.412879412341", xAxis.value());

  final ValueTable yAxis = (ValueTable) positionCurrent.get("YAxis");
  assertEquals("255.652372573538", yAxis.value());

  final ValueTable zAxis = (ValueTable) positionCurrent.get("ZAxis");
  assertEquals("28.15", zAxis.get(0).value());
  assertEquals("111.23", zAxis.get(1).value());
 }
}
origin: openmicroscopy/bioformats

/** Parses metadata from Prairie XML file. */
private void parseXML(final Document doc) {
 final Element pvScan = doc.getDocumentElement();
 checkElement(pvScan, "PVScan");
 // parse <PVStateShard> key/value block
 parsePVStateShard(pvScan, scanValues);
 // parse acquisition date
 date = attr(pvScan, "date");
 // iterate over all Sequence elements
 final NodeList sequenceNodes = doc.getElementsByTagName("Sequence");
 for (int s = 0; s < sequenceNodes.getLength(); s++) {
  final Element sequenceElement = el(sequenceNodes, s);
  if (sequenceElement == null) continue;
  final Sequence sequence = new Sequence(sequenceElement);
  if (firstSequence == null) firstSequence = sequence;
  final int cycle = sequence.getCycle();
  if (cycle < cycleMin) cycleMin = cycle;
  if (cycle > cycleMax) cycleMax = cycle;
  sequences.put(cycle, sequence);
 }
}
origin: ome/formats-gpl

/**
 * This step parses the Prairie metadata files into the Prairie-specific
 * metadata structure, {@link #meta}.
 */
private void parsePrairieMetadata() throws FormatException, IOException {
 LOGGER.info("Parsing Prairie metadata");
 final Document xml, cfg, env;
 try {
  xml = parseDOM(xmlFile);
  cfg = parseDOM(cfgFile);
  env = parseDOM(envFile);
 }
 catch (ParserConfigurationException exc) {
  throw new FormatException(exc);
 }
 catch (SAXException exc) {
  throw new FormatException(exc);
 }
 meta = new PrairieMetadata(xml, cfg, env);
 sequences = meta.getSequences();
 channels = meta.getActiveChannels();
 if (channels == null || channels.length == 0) {
  throw new FormatException("No active channels found");
 }
}
origin: openmicroscopy/bioformats

/**
 * This steps populates the original metadata table (the tables returned by
 * {@link #getGlobalMetadata()} and {@link #getSeriesMetadata()}).
 */
private void populateOriginalMetadata() {
 final boolean minimumMetadata = isMinimumMetadata();
 if (minimumMetadata) return;
 // populate global metadata
 addGlobalMeta("cycleCount", meta.getCycleCount());
 addGlobalMeta("date", meta.getDate());
 addGlobalMeta("waitTime", meta.getWaitTime());
 addGlobalMeta("sequenceCount", sequences.size());
 final ValueTable config = meta.getConfig();
 for (final String key : config.keySet()) {
  addGlobalMeta(key, config.get(key).toString());
 }
 addGlobalMeta("meta", meta);
 // populate series metadata
 final int seriesCount = getSeriesCount();
 for (int s = 0; s < seriesCount; s++) {
  setSeries(s);
  final Sequence sequence = sequence(s);
  addSeriesMeta("cycle", sequence.getCycle());
  addSeriesMeta("indexCount", sequence.getIndexCount());
  addSeriesMeta("type", sequence.getType());
 }
 setSeries(0);
}
origin: ome/formats-gpl

/** Gets the first {@code laserPower} recorded in the configuration. */
public Double getLaserPower() {
 return d(value(getConfig("laserPower"), 0));
}
loci.formats.inPrairieMetadata

Javadoc

Metadata structure for Prairie Technologies' TIFF-based format.

Most used methods

  • <init>
    Creates a new Prairie metadata by parsing the given XML, CFG and/or ENV documents.
  • getSequence
    Gets the Sequence at the given cycle.
  • attr
    Gets the attribute value with the given name, or null if not defined.
  • b
    Converts the given string to a boolean.
  • checkElement
    Checks that the given element has the specified name.
  • d
    Converts the given string to a Double, or null if incompatible.
  • el
    Gets the indexth element from the given list of nodes.
  • getActiveChannels
    Gets the list of active channel indices, in sorted order. These indices correspond to the configurat
  • getBitDepth
    Gets the bitDepth recorded in the configuration.
  • getConfig
    Gets the value of the given configuration key.
  • getCycleCount
    Gets the number of recorded cycles. This value is equal to #getCycleMax() - #getCycleMin() + 1.
  • getDate
    Gets the date of the acquisition.
  • getCycleCount,
  • getDate,
  • getFirstChild,
  • getFrame,
  • getLaserPower,
  • getSequences,
  • getValue,
  • getWaitTime,
  • i,
  • isInvertX

Popular in Java

  • Start an intent from android
  • scheduleAtFixedRate (Timer)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • scheduleAtFixedRate (ScheduledExecutorService)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Option (scala)
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now