Changeset 4254


Ignore:
Timestamp:
07/25/08 11:24:23 (12 years ago)
Author:
melissa
Message:

Added timestamp support to Metamorph TIFF, courtesy of Thomas Caswell.

Location:
trunk/loci/formats
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/auto/meta-support.txt

    r4251 r4254  
    283283Dimensions.PhysicalSizeY = Yes 
    284284Experimenter = Yes 
     285Plane = Yes since r4254 
     286PlaneTiming = Yes since r4254 
    285287 
    286288[MicromanagerReader] 
  • trunk/loci/formats/doc/meta/MetamorphTiffReader.txt

    r4199 r4254  
    1010 
    1111Of the 151 fields documented below: 
    12   * The file format itself supports 19 of them (12%). 
    13   * Of those, Bio-Formats fully or partially converts 19 (100%). 
     12  * The file format itself supports 24 of them (15%). 
     13  * Of those, Bio-Formats fully or partially converts 24 (100%). 
    1414 
    1515== Supported fields == 
     
    3535  * [http://cvs.openmicroscopy.org.uk/svn/specification/Documentation/Generated/OME-2008-02/ome.xsd.html#element_Pixels Pixels]: SizeY - since r3700 
    3636  * [http://cvs.openmicroscopy.org.uk/svn/specification/Documentation/Generated/OME-2008-02/ome.xsd.html#element_Pixels Pixels]: SizeZ - since r3700 
    37 === Total supported: 19 === 
     37  * [http://cvs.openmicroscopy.org.uk/svn/specification/Documentation/Generated/OME-2008-02/ome.xsd.html#element_Plane Plane]: TheC - since r4254 
     38  * [http://cvs.openmicroscopy.org.uk/svn/specification/Documentation/Generated/OME-2008-02/ome.xsd.html#element_Plane Plane]: TheT - since r4254 
     39  * [http://cvs.openmicroscopy.org.uk/svn/specification/Documentation/Generated/OME-2008-02/ome.xsd.html#element_Plane Plane]: TheZ - since r4254 
     40  * [http://cvs.openmicroscopy.org.uk/svn/specification/Documentation/Generated/OME-2008-02/ome.xsd.html#element_PlaneTiming PlaneTiming]: DeltaT - since r4254 
     41  * [http://cvs.openmicroscopy.org.uk/svn/specification/Documentation/Generated/OME-2008-02/ome.xsd.html#element_PlaneTiming PlaneTiming]: ExposureTime - since r4254 
     42=== Total supported: 24 === 
    3843 
    3944== Unknown or missing fields == 
     
    115120  * [http://cvs.openmicroscopy.org.uk/svn/specification/Documentation/Generated/OME-2008-02/ome.xsd.html#element_Objective Objective]: SerialNumber 
    116121  * [http://cvs.openmicroscopy.org.uk/svn/specification/Documentation/Generated/OME-2008-02/ome.xsd.html#element_Objective Objective]: WorkingDistance 
    117   * [http://cvs.openmicroscopy.org.uk/svn/specification/Documentation/Generated/OME-2008-02/ome.xsd.html#element_Plane Plane]: TheC 
    118   * [http://cvs.openmicroscopy.org.uk/svn/specification/Documentation/Generated/OME-2008-02/ome.xsd.html#element_Plane Plane]: TheT 
    119   * [http://cvs.openmicroscopy.org.uk/svn/specification/Documentation/Generated/OME-2008-02/ome.xsd.html#element_Plane Plane]: TheZ 
    120   * [http://cvs.openmicroscopy.org.uk/svn/specification/Documentation/Generated/OME-2008-02/ome.xsd.html#element_PlaneTiming PlaneTiming]: DeltaT 
    121   * [http://cvs.openmicroscopy.org.uk/svn/specification/Documentation/Generated/OME-2008-02/ome.xsd.html#element_PlaneTiming PlaneTiming]: ExposureTime 
    122122  * [http://cvs.openmicroscopy.org.uk/svn/specification/Documentation/Generated/OME-2008-02/ome.xsd.html#element_Plate Plate]: Description 
    123123  * [http://cvs.openmicroscopy.org.uk/svn/specification/Documentation/Generated/OME-2008-02/ome.xsd.html#element_Plate Plate]: ExternalIdentifier 
     
    173173  * [http://cvs.openmicroscopy.org.uk/svn/specification/Documentation/Generated/OME-2008-02/ome.xsd.html#element_WellSample WellSample]: PosY 
    174174  * [http://cvs.openmicroscopy.org.uk/svn/specification/Documentation/Generated/OME-2008-02/ome.xsd.html#element_WellSample WellSample]: Timepoint 
    175 === Total unknown or missing: 132 === 
     175=== Total unknown or missing: 127 === 
  • trunk/loci/formats/in/MetamorphTiffReader.java

    r4227 r4254  
    4242 * 
    4343 * @author Melissa Linkert linkert at wisc.edu 
    44  * @author Thomas Caswell tac42 at cornell.edu 
     44 * @author Thomas Caswell tcaswell at uchicago.edu 
    4545 */ 
    4646public class MetamorphTiffReader extends BaseTiffReader { 
     
    5454  private float temperature; 
    5555  private String date, imageName; 
     56  private Vector timestamps; 
    5657 
    5758  // -- Constructor -- 
     
    9596    super.initFile(id); 
    9697 
     98    timestamps = new Vector(); 
     99 
    97100    String[] comments = new String[ifds.length]; 
    98101    zPositions = new float[ifds.length]; 
     
    109112    } 
    110113 
    111     core.sizeC[0] = core.sizeZ[0] = 0; 
     114    core.sizeC[0] = 0; 
    112115 
    113116    // calculate axis sizes 
    114117 
    115     Vector uniqueZ = new Vector(); 
    116118    Vector uniqueC = new Vector(); 
    117119    for (int i=0; i<zPositions.length; i++) { 
    118       Float z = new Float(zPositions[i]); 
    119120      Integer c = new Integer(wavelengths[i]); 
    120       if (!uniqueZ.contains(z)) { 
    121         uniqueZ.add(z); 
    122         core.sizeZ[0]++; 
    123       } 
    124121      if (!uniqueC.contains(c)) { 
    125122        uniqueC.add(c); 
     
    128125    } 
    129126 
    130     core.sizeT[0] = ifds.length / (getSizeZ() * getSizeC()); 
     127    core.sizeT[0] = timestamps.size(); 
     128    if (core.sizeT[0] == 0) core.sizeT[0] = 1; 
     129    core.sizeZ[0] = ifds.length / (getSizeT() * getSizeC()); 
    131130 
    132131    MetadataStore store = 
     
    135134    store.setImageDescription("", 0); 
    136135 
    137     SimpleDateFormat parse = new SimpleDateFormat("yyyyMMdd HH:mm:ss.SS"); 
     136    SimpleDateFormat parse = new SimpleDateFormat("yyyyMMdd HH:mm:ss.SSS"); 
    138137    Date d = parse.parse(date, new ParsePosition(0)); 
    139138    SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); 
     139    SimpleDateFormat tsfmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS"); 
     140 
     141    Date td; 
     142    for (int i=0; i<timestamps.size(); i++) { 
     143      td = parse.parse((String) timestamps.get(i), new ParsePosition(0)); 
     144      addMeta("timestamp " + i, tsfmt.format(td)); 
     145    } 
     146 
     147    long startDate = 0; 
     148    if (timestamps.size() > 0) { 
     149      startDate = 
     150        parse.parse((String) timestamps.get(0), new ParsePosition(0)).getTime(); 
     151    } 
     152 
     153    for (int i=0; i<getImageCount(); i++) { 
     154      int[] coords = getZCTCoords(i); 
     155      store.setPlaneTheZ(new Integer(coords[0]), 0, 0, i); 
     156      store.setPlaneTheC(new Integer(coords[1]), 0, 0, i); 
     157      store.setPlaneTheT(new Integer(coords[2]), 0, 0, i); 
     158      if (coords[2] < timestamps.size()) { 
     159        String stamp = (String) timestamps.get(coords[2]); 
     160        long ms = parse.parse(stamp, new ParsePosition(0)).getTime(); 
     161        store.setPlaneTimingDeltaT(new Float(ms - startDate), 0, 0, i); 
     162        store.setPlaneTimingExposureTime(new Float(0), 0, 0, i); 
     163      } 
     164    } 
    140165 
    141166    store.setImageCreationDate(fmt.format(d), 0); 
     
    208233          wavelengths[wavePointer++] = Integer.parseInt(value); 
    209234        } 
    210         else if (id.equals("acquisition-time-local")) date = value; 
     235        else if (id.equals("acquisition-time-local")) { 
     236          date = value; 
     237          timestamps.add(date); 
     238        } 
    211239        else if (id.equals("image-name")) imageName = value; 
    212240      } 
Note: See TracChangeset for help on using the changeset viewer.