From 4aa1f7580db03aa95ee6428091e17445609abf5c Mon Sep 17 00:00:00 2001 From: Melissa Linkert Date: Mon, 9 Nov 2009 15:06:10 +0000 Subject: [PATCH] Place timestamps in original metadata hashtable and populate PlaneTiming.DeltaT. --- .../src/loci/formats/in/FluoviewReader.java | 149 +++++++++++------- .../common/src/loci/common/DateTools.java | 42 ++++- 2 files changed, 132 insertions(+), 59 deletions(-) diff --git a/components/bio-formats/src/loci/formats/in/FluoviewReader.java b/components/bio-formats/src/loci/formats/in/FluoviewReader.java index a06d013dc6e..8783f97ddf6 100644 --- a/components/bio-formats/src/loci/formats/in/FluoviewReader.java +++ b/components/bio-formats/src/loci/formats/in/FluoviewReader.java @@ -26,6 +26,7 @@ import java.io.IOException; import java.util.StringTokenizer; +import loci.common.DateTools; import loci.common.RandomAccessInputStream; import loci.formats.CoreMetadata; import loci.formats.FormatException; @@ -59,12 +60,18 @@ public class FluoviewReader extends BaseTiffReader { private static final int MMHEADER = 34361; private static final int MMSTAMP = 34362; + /** Date format */ + private static final String DATE_FORMAT = "MM/dd/yyyy HH:mm:ss.SSS"; + // -- Fields -- /** Pixel dimensions for this file. */ private double voxelX = 1, voxelY = 1, voxelZ = 1, voxelC = 1, voxelT = 1; private String dimensionOrder; + private String date = null; + private int timeIndex = -1; + private long[][] stamps = null; // hardware settings private String[] gains, voltages, offsets, channelNames, lensNA; @@ -147,6 +154,9 @@ public void close(boolean fileOnly) throws IOException { gains = voltages = offsets = channelNames = lensNA = null; mag = detManu = objManu = comment = null; gamma = null; + date = null; + timeIndex = -1; + stamps = null; } } @@ -229,7 +239,7 @@ protected void initStandardMetadata() throws FormatException, IOException { // now we need to read the MMSTAMP data to determine dimension order - double[][] stamps = new double[8][ifds.size()]; + stamps = new long[8][ifds.size()]; for (int i=0; i start) { - String parms = comment.substring(start + 24, end).trim(); - - // this is an INI-style comment, with one key/value pair per line - - StringTokenizer st = new StringTokenizer(parms, "\n"); - while (st.hasMoreTokens()) { - String token = st.nextToken(); - int eq = token.indexOf("="); - if (eq != -1) { - String key = token.substring(0, eq); - String value = token.substring(eq + 1); - addGlobalMeta(key, value); - if (key.startsWith("Gain Ch")) { - for (int i=0; i= 0 && date != null) { + long ms = DateTools.getTime(date, DateTools.ISO8601_FORMAT); + int nChars = String.valueOf(getImageCount()).length(); + for (int i=0; i start) { comment = comment.substring(start + 14, end).trim(); start = comment.indexOf("=") + 1; @@ -412,14 +439,26 @@ protected void initMetadataStore() throws FormatException { super.initMetadataStore(); MetadataStore store = new FilterMetadata(getMetadataStore(), isMetadataFiltered()); + MetadataTools.populatePixels(store, this, true); store.setImageDescription(comment, 0); + if (date != null) { + store.setImageCreationDate(date, 0); + } // link Instrument and Image String instrumentID = MetadataTools.createLSID("Instrument", 0); store.setInstrumentID(instrumentID, 0); store.setImageInstrumentRef(instrumentID, 0); + // populate timing data + if (timeIndex >= 0) { + for (int i=0; i