Changeset 5720


Ignore:
Timestamp:
11/25/09 16:12:07 (10 years ago)
Author:
melissa
Message:
  • Added a bunch of status messages to FlexReader.
  • Tweaked IFD.getIFDTextValue to correctly create a String from an array of shorts.
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/4.1/components/bio-formats/src/loci/formats/in/FlexReader.java

    r5677 r5720  
    262262  private void initResFile(String id) throws FormatException, IOException { 
    263263    debug("initResFile(" + id + ")"); 
     264    status("Initializing .res file"); 
    264265    Location thisFile = new Location(id).getAbsoluteFile(); 
    265266    Location parent = thisFile.getParentFile(); 
    266267    debug("  Looking for an .mea file in " + parent.getAbsolutePath()); 
     268    status("Looking for corresponding .mea file"); 
    267269    String[] list = parent.list(); 
    268270    for (String file : list) { 
     
    283285  private void initMeaFile(String id) throws FormatException, IOException { 
    284286    debug("initMeaFile(" + id + ")"); 
     287    status("Initializing .mea file"); 
    285288    Location file = new Location(id).getAbsoluteFile(); 
    286289    if (!measurementFiles.contains(file.getAbsolutePath())) { 
     
    290293    // parse the .mea file to get a list of .flex files 
    291294    MeaHandler handler = new MeaHandler(); 
     295    status("Reading contents of .mea file"); 
    292296    String xml = DataTools.readFile(id); 
     297    status("Parsing XML from .mea file"); 
    293298    XMLTools.parseXML(xml, handler); 
    294299 
     
    296301    if (flex.size() == 0) { 
    297302      debug("Could not build .flex list from .mea."); 
     303      status("Building list of valid .flex files"); 
    298304      String[] files = findFiles(file); 
    299305      if (files != null) { 
     
    308314    } 
    309315    else { 
     316      status("Looking for corresponding .res file"); 
    310317      String[] files = findFiles(file, new String[] {RES_SUFFIX}); 
    311318      if (files != null) { 
     
    327334  private void initFlexFile(String id) throws FormatException, IOException { 
    328335    debug("initFlexFile(" + id + ")"); 
     336    status("Initializing .flex file"); 
    329337    boolean doGrouping = true; 
    330338 
    331339    Location currentFile = new Location(id).getAbsoluteFile(); 
    332340 
     341    status("Storing well indices"); 
    333342    try { 
    334343      String name = currentFile.getName(); 
     
    342351    } 
    343352 
     353    status("Looking for other .flex files"); 
    344354    if (!isGroupFiles()) doGrouping = false; 
    345355 
     
    363373      new FilterMetadata(getMetadataStore(), isMetadataFiltered()); 
    364374 
     375    status("Making sure that all .flex files are valid"); 
    365376    Vector<String> flex = new Vector<String>(); 
    366377    if (doGrouping) { 
     
    393404 
    394405  private void populateMetadataStore(MetadataStore store) { 
     406    status("Populating MetadataStore"); 
    395407    MetadataTools.populatePixels(store, this, true); 
    396408    String instrumentID = MetadataTools.createLSID("Instrument", 0); 
     
    522534    throws FormatException, IOException 
    523535  { 
     536    status("Parsing .flex file (well " + (wellRow + 'A') + (wellCol + 1) + ")"); 
    524537    debug("Parsing .flex file associated with well row " + wellRow + 
    525538      ", column " + wellCol); 
     
    555568    DefaultHandler handler = 
    556569      new FlexHandler(n, f, store, firstFile, currentWell); 
     570    status("Parsing XML in .flex file"); 
    557571    XMLTools.parseXML(xml.getBytes(), handler); 
    558572 
     
    560574 
    561575    int totalPlanes = getSeriesCount() * getImageCount(); 
     576 
     577    status("Populating pixel scaling factors"); 
    562578 
    563579    // verify factor count 
     
    611627    throws FormatException 
    612628  { 
     629    status("Populating core metadata"); 
    613630    debug("Populating core metadata for well row " + wellRow + ", column " + 
    614631      wellCol); 
     
    720737    debug("findFiles(" + baseFile.getAbsolutePath() + ")"); 
    721738 
     739    status("Looking for files that are in the same dataset as " + 
     740      baseFile.getAbsolutePath()); 
    722741    Vector<String> fileList = new Vector<String>(); 
    723742 
     
    866885    throws FormatException, IOException 
    867886  { 
     887    status("Grouping together files in the same dataset"); 
    868888    HashMap<String, String> v = new HashMap<String, String>(); 
    869889    for (String file : fileList) { 
     
    907927        wellNumber[currentWell][1] = col; 
    908928        s = new RandomAccessInputStream(flexFiles[row][col]); 
     929        status("Parsing IFDs for well " + (row + 'A') + (col + 1)); 
    909930        TiffParser tp = new TiffParser(s); 
    910931        ifds[row][col] = tp.getIFDs(); 
  • trunk/components/bio-formats/src/loci/formats/in/FlexReader.java

    r5683 r5720  
    260260  private void initResFile(String id) throws FormatException, IOException { 
    261261    debug("initResFile(" + id + ")"); 
     262    status("Initializing .res file"); 
    262263    Location thisFile = new Location(id).getAbsoluteFile(); 
    263264    Location parent = thisFile.getParentFile(); 
    264265    debug("  Looking for an .mea file in " + parent.getAbsolutePath()); 
     266    status("Looking for corresponding .mea file"); 
    265267    String[] list = parent.list(); 
    266268    for (String file : list) { 
     
    281283  private void initMeaFile(String id) throws FormatException, IOException { 
    282284    debug("initMeaFile(" + id + ")"); 
     285    status("Initializing .mea file"); 
    283286    Location file = new Location(id).getAbsoluteFile(); 
    284287    if (!measurementFiles.contains(file.getAbsolutePath())) { 
     
    288291    // parse the .mea file to get a list of .flex files 
    289292    MeaHandler handler = new MeaHandler(); 
     293    status("Reading contents of .mea file"); 
    290294    String xml = DataTools.readFile(id); 
     295    status("Parsing XML from .mea file"); 
    291296    XMLTools.parseXML(xml, handler); 
    292297 
     
    294299    if (flex.size() == 0) { 
    295300      debug("Could not build .flex list from .mea."); 
     301      status("Building list of valid .flex files"); 
    296302      String[] files = findFiles(file); 
    297303      if (files != null) { 
     
    306312    } 
    307313    else { 
     314      status("Looking for corresponding .res file"); 
    308315      String[] files = findFiles(file, new String[] {RES_SUFFIX}); 
    309316      if (files != null) { 
     
    325332  private void initFlexFile(String id) throws FormatException, IOException { 
    326333    debug("initFlexFile(" + id + ")"); 
     334    status("Initializing .flex file"); 
    327335    boolean doGrouping = true; 
    328336 
    329337    Location currentFile = new Location(id).getAbsoluteFile(); 
    330338 
     339    status("Storing well indices"); 
    331340    try { 
    332341      String name = currentFile.getName(); 
     
    340349    } 
    341350 
     351    status("Looking for other .flex files"); 
    342352    if (!isGroupFiles()) doGrouping = false; 
    343353 
     
    361371      new FilterMetadata(getMetadataStore(), isMetadataFiltered()); 
    362372 
     373    status("Making sure that all .flex files are valid"); 
    363374    Vector<String> flex = new Vector<String>(); 
    364375    if (doGrouping) { 
     
    391402 
    392403  private void populateMetadataStore(MetadataStore store) { 
     404    status("Populating MetadataStore"); 
    393405    MetadataTools.populatePixels(store, this, true); 
    394406    String instrumentID = MetadataTools.createLSID("Instrument", 0); 
     
    520532    throws FormatException, IOException 
    521533  { 
     534    status("Parsing .flex file (well " + (wellRow + 'A') + (wellCol + 1) + ")"); 
    522535    debug("Parsing .flex file associated with well row " + wellRow + 
    523536      ", column " + wellCol); 
     
    553566    DefaultHandler handler = 
    554567      new FlexHandler(n, f, store, firstFile, currentWell); 
     568    status("Parsing XML in .flex file"); 
    555569    XMLTools.parseXML(xml.getBytes(), handler); 
    556570 
     
    558572 
    559573    int totalPlanes = getSeriesCount() * getImageCount(); 
     574 
     575    status("Populating pixel scaling factors"); 
    560576 
    561577    // verify factor count 
     
    609625    throws FormatException 
    610626  { 
     627    status("Populating core metadata"); 
    611628    debug("Populating core metadata for well row " + wellRow + ", column " + 
    612629      wellCol); 
     
    718735    debug("findFiles(" + baseFile.getAbsolutePath() + ")"); 
    719736 
     737    status("Looking for files that are in the same dataset as " + 
     738      baseFile.getAbsolutePath()); 
    720739    Vector<String> fileList = new Vector<String>(); 
    721740 
     
    864883    throws FormatException, IOException 
    865884  { 
     885    status("Grouping together files in the same dataset"); 
    866886    HashMap<String, String> v = new HashMap<String, String>(); 
    867887    for (String file : fileList) { 
     
    906926        s = 
    907927          new RandomAccessInputStream(new FileHandle(flexFiles[row][col], "r")); 
     928        status("Parsing IFDs for well " + (row + 'A') + (col + 1)); 
    908929        TiffParser tp = new TiffParser(s); 
    909930        ifds[row][col] = tp.getIFDs(); 
  • trunk/components/bio-formats/src/loci/formats/tiff/IFD.java

    r5669 r5720  
    338338      value = sb.toString(); 
    339339    } 
     340    else if (o instanceof short[]) { 
     341      StringBuffer sb = new StringBuffer(); 
     342      for (short s : ((short[]) o)) { 
     343        if (!Character.isISOControl((char) s)) { 
     344          sb.append((char) s); 
     345        } 
     346        else sb.append("\n"); 
     347      } 
     348      value = sb.toString(); 
     349    } 
    340350    else if (o != null) value = o.toString(); 
    341351 
     
    826836  /** Prints the contents of this IFD. */ 
    827837  public void printIFD() { 
     838    if (!LogTools.isDebug()) return; 
    828839    StringBuffer sb = new StringBuffer(); 
    829840    sb.append("IFD directory entry values:"); 
Note: See TracChangeset for help on using the changeset viewer.