Changeset 6054


Ignore:
Timestamp:
03/19/10 15:33:27 (10 years ago)
Author:
curtis
Message:

Better ImageJ metadata parsing:

  • Also populates TimeIncrement.
  • Still works when !isMetadataCollected().
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/bio-formats/src/loci/formats/in/TiffReader.java

    r6033 r6054  
    6363  private String companionFile; 
    6464  private String description; 
     65  private String calibrationUnit; 
     66  private Double physicalSizeZ; 
     67  private Double timeIncrement; 
     68  private Integer xOrigin, yOrigin; 
    6569 
    6670  // -- Constructor -- 
     
    8892      companionFile = null; 
    8993      description = null; 
     94      calibrationUnit = null; 
     95      physicalSizeZ = null; 
     96      timeIncrement = null; 
     97      xOrigin = null; 
     98      yOrigin = null; 
    9099    } 
    91100  } 
     
    103112 
    104113    description = null; 
     114    calibrationUnit = null; 
     115    physicalSizeZ = null; 
     116    timeIncrement = null; 
     117    xOrigin = null; 
     118    yOrigin = null; 
    105119 
    106120    // check for reusable proprietary tags (65000-65535), 
     
    215229      else if (token.startsWith("slices=")) z = parseInt(value); 
    216230      else if (token.startsWith("frames=")) t = parseInt(value); 
    217       else if (token.startsWith("spacing=")) put("Spacing", value); 
    218       else if (token.startsWith("unit=")) put("Unit", value); 
     231      else if (token.startsWith("unit=")) { 
     232        calibrationUnit = value; 
     233        put("Unit", calibrationUnit); 
     234      } 
     235      else if (token.startsWith("finterval=")) { 
     236        timeIncrement = parseDouble(value); 
     237        put("Frame Interval", timeIncrement); 
     238      } 
     239      else if (token.startsWith("spacing=")) { 
     240        physicalSizeZ = parseDouble(value); 
     241        put("Spacing", physicalSizeZ); 
     242      } 
     243      else if (token.startsWith("xorigin=")) { 
     244        xOrigin = parseInt(value); 
     245        put("X Origin", xOrigin); 
     246      } 
     247      else if (token.startsWith("yorigin=")) { 
     248        yOrigin = parseInt(value); 
     249        put("Y Origin", yOrigin); 
     250      } 
    219251    } 
    220252    if (z * c * t == c && isRGB()) { 
     
    292324    // TODO: Perhaps we should only populate the physical Z size if the unit is 
    293325    //       a known, physical quantity such as "micron" rather than "pixel". 
    294     //String unit = getGlobalMeta("Unit"); 
    295     Object spacing = getGlobalMeta("Spacing"); 
    296     double zDepth = 0; 
    297     if (spacing != null) { 
    298       zDepth = parseDouble(spacing.toString()); 
     326    //       e.g.: if (calibrationUnit.equals("micron")) 
     327    if (physicalSizeZ != null) { 
     328      double zDepth = physicalSizeZ.doubleValue(); 
    299329      if (zDepth < 0) zDepth = -zDepth; 
    300     } 
    301     if (zDepth != 0) store.setDimensionsPhysicalSizeZ(new Double(zDepth), 0, 0); 
     330      store.setDimensionsPhysicalSizeZ(zDepth, 0, 0); 
     331    } 
     332    if (timeIncrement != null) { 
     333      store.setDimensionsTimeIncrement(timeIncrement, 0, 0); 
     334    } 
    302335  } 
    303336 
Note: See TracChangeset for help on using the changeset viewer.