Changeset 6062


Ignore:
Timestamp:
03/23/10 13:02:31 (10 years ago)
Author:
melissa
Message:

Improved parsing for version 2 Andor TIFF files and fixed how IFDs with SubfileType == 2 are classified.

Location:
trunk/components/bio-formats/src/loci/formats
Files:
2 edited

Legend:

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

    r6055 r6062  
    2525 
    2626import java.io.IOException; 
    27 import java.util.StringTokenizer; 
    2827 
    2928import loci.common.DateTools; 
     
    187186 
    188187    put("Header Flag", ras.readShort()); 
    189     put("Image Type", ras.readChar()); 
     188    put("Image Type", ras.read()); 
    190189 
    191190    put("Image name", ras.readString(257)); 
     
    350349      // this is an INI-style comment, with one key/value pair per line 
    351350 
    352       StringTokenizer st = new StringTokenizer(comment, "\n"); 
    353       while (st.hasMoreTokens()) { 
    354         String token = st.nextToken(); 
     351      String[] lines = comment.split("\n"); 
     352      for (String token : lines) { 
     353        token = token.trim(); 
    355354        int eq = token.indexOf("="); 
    356355        if (eq != -1) { 
     
    408407            date += " " + value; 
    409408          } 
     409        } 
     410        else if (token.startsWith("Z") && token.indexOf(" um ") != -1) { 
     411          // looking for "Z - x um in y planes" 
     412          String z = token.substring(token.indexOf("-") + 1); 
     413          z = z.replaceAll("\\p{Alpha}", "").trim(); 
     414          int firstSpace = z.indexOf(" "); 
     415          double size = Double.parseDouble(z.substring(0, firstSpace)); 
     416          double nPlanes = Double.parseDouble(z.substring(firstSpace).trim()); 
     417          voxelZ = size / nPlanes; 
    410418        } 
    411419      } 
  • trunk/components/bio-formats/src/loci/formats/tiff/TiffParser.java

    r6060 r6062  
    179179      Number subfile = (Number) ifds.get(i).getIFDValue(IFD.NEW_SUBFILE_TYPE); 
    180180      int subfileType = subfile == null ? 0 : subfile.intValue(); 
    181       if (subfileType == 0) { 
     181      if (subfileType != 1) { 
    182182        ifds.remove(i--); 
    183183      } 
     
    192192      Number subfile = (Number) ifds.get(i).getIFDValue(IFD.NEW_SUBFILE_TYPE); 
    193193      int subfileType = subfile == null ? 0 : subfile.intValue(); 
    194       if (subfileType != 0 && ifds.size() > 1) { 
     194      if (subfileType == 1 && ifds.size() > 1) { 
    195195        ifds.remove(i--); 
    196196      } 
Note: See TracChangeset for help on using the changeset viewer.