Changeset 7075


Ignore:
Timestamp:
10/14/10 18:23:51 (9 years ago)
Author:
melissa
Message:
  • Fixed various file stitching bugs.
  • Removed debugging statement.
Location:
trunk/components
Files:
4 edited

Legend:

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

    r7071 r7075  
    161161    buildFiles("", num, fileList); 
    162162    files = fileList.toArray(new String[0]); 
     163 
     164    if (files.length == 0 && new Location(pattern).exists()) { 
     165      files = new String[] {pattern}; 
     166    } 
    163167 
    164168    valid = true; 
     
    448452  { 
    449453    String baseSuffix = base.substring(base.lastIndexOf(File.separator) + 1); 
    450     baseSuffix = baseSuffix.substring(baseSuffix.indexOf(".") + 1); 
     454    int dot = baseSuffix.indexOf("."); 
     455    if (dot < 0) baseSuffix = ""; 
     456    else baseSuffix = baseSuffix.substring(dot + 1); 
    451457 
    452458    ArrayList<String> patterns = new ArrayList<String>(); 
     
    457463      if (start < 0) start = 0; 
    458464      String patternSuffix = pattern.substring(start); 
    459       patternSuffix = patternSuffix.substring(patternSuffix.indexOf(".") + 1); 
     465      dot = patternSuffix.indexOf("."); 
     466      if (dot < 0) patternSuffix = ""; 
     467      else patternSuffix = patternSuffix.substring(dot + 1); 
     468 
     469      String checkPattern = findPattern(name, dir, nameList); 
     470      String[] checkFiles = new FilePattern(checkPattern).getFiles(); 
    460471 
    461472      if (!patterns.contains(pattern) && (!new Location(pattern).exists() || 
    462         base.equals(pattern)) && patternSuffix.equals(baseSuffix)) 
     473        base.equals(pattern)) && patternSuffix.equals(baseSuffix) && 
     474        DataTools.indexOf(checkFiles, base) >= 0) 
    463475      { 
    464476        patterns.add(pattern); 
  • trunk/components/bio-formats/src/loci/formats/FileStitcher.java

    r7070 r7075  
    708708    LOGGER.debug("initFile: {}", id); 
    709709 
    710     String[] patterns = findPatterns(id); 
    711     externals = new ExternalSeries[patterns.length]; 
    712  
    713     for (int i=0; i<externals.length; i++) { 
    714       externals[i] = new ExternalSeries(new FilePattern(patterns[i])); 
    715     } 
    716  
    717     FilePattern fp = new FilePattern(patterns[0]); 
     710    FilePattern fp = new FilePattern(id); 
    718711 
    719712    boolean mustGroup = false; 
     
    735728      return; 
    736729    } 
     730 
     731    String[] patterns = findPatterns(id); 
     732    if (patterns.length == 0) patterns = new String[] {id}; 
     733    externals = new ExternalSeries[patterns.length]; 
     734 
     735    for (int i=0; i<externals.length; i++) { 
     736      externals[i] = new ExternalSeries(new FilePattern(patterns[i])); 
     737    } 
     738    fp = new FilePattern(patterns[0]); 
     739 
    737740    reader.close(); 
    738741    reader.setGroupFiles(false); 
     
    854857    store = reader.getMetadataStore(); 
    855858    // don't overwrite pixel info if files aren't actually grouped 
    856     if (!noStitch && externals.length > 1) { 
     859    if (!noStitch) { 
    857860      MetadataTools.populatePixels(store, this); 
    858861      for (int i=0; i<getSeriesCount(); i++) { 
  • trunk/components/bio-formats/src/loci/formats/in/BioRadReader.java

    r7063 r7075  
    278278    in = new RandomAccessInputStream(id); 
    279279    in.order(true); 
    280  
    281     /* debug */ System.out.println("initializing .pic file: " + id); 
    282280 
    283281    offset = new Vector<Double>(); 
  • trunk/components/test-suite/src/loci/tests/testng/FormatReaderTest.java

    r6881 r7075  
    942942  private boolean initFile() { 
    943943    if (skip) throw new SkipException(SKIP_MESSAGE); 
     944 
     945    // initialize configuration tree 
     946    if (config != null) config.setId(id); 
     947 
    944948    if (reader == null) { 
    945       reader = new BufferedImageReader(new FileStitcher()); 
     949      if (config.noStitching()) { 
     950        reader = new BufferedImageReader(); 
     951      } 
     952      else { 
     953        reader = new BufferedImageReader(new FileStitcher()); 
     954      } 
    946955      reader.setNormalized(true); 
    947956      reader.setMetadataFiltered(true); 
     
    985994        LOGGER.error("Used files list does not include base file"); 
    986995      } 
    987  
    988       // initialize configuration tree 
    989       if (config != null) config.setId(id); 
    990996    } 
    991997    catch (Throwable t) { 
Note: See TracChangeset for help on using the changeset viewer.