Changeset 7125


Ignore:
Timestamp:
10/24/10 17:28:18 (9 years ago)
Author:
melissa
Message:

Fixed a handful of little bugs exposed during testing.

Files:
12 edited

Legend:

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

    r7097 r7125  
    460460    for (String name : nameList) { 
    461461      String pattern = findPattern(name, dir, nameList, exclude); 
     462      if (pattern == null) continue; 
    462463      int start = pattern.lastIndexOf(File.separator) + 1; 
    463464      if (start < 0) start = 0; 
  • branches/4.2/components/bio-formats/src/loci/formats/codec/LZWCodec.java

    r7007 r7125  
    345345          currOutPos += outLength; 
    346346          // 2) Add string[old_code]+firstByte(string[curr_code]) to the table 
     347          if (nextCode >= anotherCodes.length) break;  
    347348          anotherCodes[nextCode] = oldCode; 
    348349          newBytes[nextCode] = output[i]; 
  • branches/4.2/components/bio-formats/src/loci/formats/in/FlexReader.java

    r7102 r7125  
    141141 
    142142  // -- IFormatReader API methods -- 
     143 
     144  /* @see loci.formats.IFormatReader#fileGroupOption(String) */ 
     145  public int fileGroupOption(String id) throws FormatException, IOException { 
     146    return FormatTools.MUST_GROUP; 
     147  } 
    143148 
    144149  /* @see loci.formats.IFormatReader#isSingleFile(String) */ 
  • branches/4.2/components/bio-formats/src/loci/formats/in/LeicaReader.java

    r7102 r7125  
    552552      core[i].metadataComplete = true; 
    553553      core[i].interleaved = false; 
     554 
     555      String filename = (String) files[i].get(0); 
     556      tiff.setId(filename); 
     557 
     558      core[i].sizeX = tiff.getSizeX(); 
     559      core[i].sizeY = tiff.getSizeY(); 
    554560    } 
    555561 
  • branches/4.2/components/bio-formats/src/loci/formats/in/TillVisionReader.java

    r7103 r7125  
    7474  private boolean embeddedImages; 
    7575  private long embeddedOffset; 
     76  private String[] infFiles; 
    7677 
    7778  private Vector<String> imageNames = new Vector<String>(); 
     
    121122      pixelsStream = null; 
    122123      pixelsFiles = null; 
     124      infFiles = null; 
    123125      embeddedOffset = 0; 
    124126      embeddedImages = false; 
     
    142144    files.add(currentId); 
    143145    if (!noPixels) { 
    144       for (String file : pixelsFiles) { 
    145         if (file != null) files.add(file); 
    146       } 
     146      if (pixelsFiles[getSeries()] != null) { 
     147        files.add(pixelsFiles[getSeries()]); 
     148      } 
     149    } 
     150    if (infFiles[getSeries()] != null) { 
     151      files.add(infFiles[getSeries()]); 
    147152    } 
    148153    return files.toArray(new String[files.size()]); 
     
    340345            } 
    341346          } 
    342           else if (nextFile < nImages) { 
    343             pixelsFile[nextFile++] = f; 
    344           } 
    345347        } 
    346348      } 
    347349      if (nextFile == 0) { 
    348         throw new FormatException("No image files found."); 
     350        for (String f : files) { 
     351          if (checkSuffix(f, "pst")) { 
     352            pixelsFile[nextFile++] = 
     353              new Location(directory, f).getAbsolutePath(); 
     354          } 
     355        } 
     356 
     357        if (nextFile == 0) throw new FormatException("No image files found."); 
    349358      } 
    350359    } 
     
    353362 
    354363    pixelsFiles = new String[getSeriesCount()]; 
     364    infFiles = new String[getSeriesCount()]; 
    355365 
    356366    Object[] metadataKeys = tmpSeriesMetadata.keySet().toArray(); 
     
    387397        int dot = file.lastIndexOf("."); 
    388398        String inf = file.substring(0, dot) + ".inf"; 
     399        infFiles[i] = inf; 
    389400 
    390401        BufferedReader reader = new BufferedReader(new FileReader(inf)); 
  • branches/4.2/components/bio-formats/src/loci/formats/in/ZeissLSMReader.java

    r7102 r7125  
    302302    FormatTools.checkPlaneParameters(this, no, buf.length, x, y, w, h); 
    303303 
     304    in.close(); 
    304305    in = new RandomAccessInputStream(getLSMFileFromSeries(getSeries())); 
    305306    in.order(!isLittleEndian()); 
     
    507508 
    508509  private int getExtraSeries(String file) throws FormatException, IOException { 
     510    if (in != null) in.close(); 
    509511    in = new RandomAccessInputStream(file); 
    510512    boolean littleEndian = in.read() == TiffConstants.LITTLE; 
     
    563565    IFD ifd = ifds.get(0); 
    564566 
     567    in.close(); 
    565568    in = new RandomAccessInputStream(getLSMFileFromSeries(series)); 
    566569    in.order(isLittleEndian()); 
     
    16051608    } 
    16061609 
    1607     String[] fileList = parent.list(); 
     1610    String[] fileList = parent.list(true); 
    16081611    for (int i=0; i<fileList.length; i++) { 
    16091612      if (checkSuffix(fileList[i], new String[] {"lsm"}) && 
  • trunk/components/bio-formats/src/loci/formats/FilePattern.java

    r7075 r7125  
    460460    for (String name : nameList) { 
    461461      String pattern = findPattern(name, dir, nameList, exclude); 
     462      if (pattern == null) continue; 
    462463      int start = pattern.lastIndexOf(File.separator) + 1; 
    463464      if (start < 0) start = 0; 
  • trunk/components/bio-formats/src/loci/formats/codec/LZWCodec.java

    r6975 r7125  
    345345          currOutPos += outLength; 
    346346          // 2) Add string[old_code]+firstByte(string[curr_code]) to the table 
     347          if (nextCode >= anotherCodes.length) break;  
    347348          anotherCodes[nextCode] = oldCode; 
    348349          newBytes[nextCode] = output[i]; 
  • trunk/components/bio-formats/src/loci/formats/in/FlexReader.java

    r7055 r7125  
    141141 
    142142  // -- IFormatReader API methods -- 
     143 
     144  /* @see loci.formats.IFormatReader#fileGroupOption(String) */ 
     145  public int fileGroupOption(String id) throws FormatException, IOException { 
     146    return FormatTools.MUST_GROUP; 
     147  } 
    143148 
    144149  /* @see loci.formats.IFormatReader#isSingleFile(String) */ 
  • trunk/components/bio-formats/src/loci/formats/in/LeicaReader.java

    r7055 r7125  
    552552      core[i].metadataComplete = true; 
    553553      core[i].interleaved = false; 
     554 
     555      String filename = (String) files[i].get(0); 
     556      tiff.setId(filename); 
     557 
     558      core[i].sizeX = tiff.getSizeX(); 
     559      core[i].sizeY = tiff.getSizeY(); 
    554560    } 
    555561 
  • trunk/components/bio-formats/src/loci/formats/in/TillVisionReader.java

    r6881 r7125  
    7474  private boolean embeddedImages; 
    7575  private long embeddedOffset; 
     76  private String[] infFiles; 
    7677 
    7778  private Vector<String> imageNames = new Vector<String>(); 
     
    121122      pixelsStream = null; 
    122123      pixelsFiles = null; 
     124      infFiles = null; 
    123125      embeddedOffset = 0; 
    124126      embeddedImages = false; 
     
    142144    files.add(currentId); 
    143145    if (!noPixels) { 
    144       for (String file : pixelsFiles) { 
    145         if (file != null) files.add(file); 
    146       } 
     146      if (pixelsFiles[getSeries()] != null) { 
     147        files.add(pixelsFiles[getSeries()]); 
     148      } 
     149    } 
     150    if (infFiles[getSeries()] != null) { 
     151      files.add(infFiles[getSeries()]); 
    147152    } 
    148153    return files.toArray(new String[files.size()]); 
     
    340345            } 
    341346          } 
    342           else if (nextFile < nImages) { 
    343             pixelsFile[nextFile++] = f; 
    344           } 
    345347        } 
    346348      } 
    347349      if (nextFile == 0) { 
    348         throw new FormatException("No image files found."); 
     350        for (String f : files) { 
     351          if (checkSuffix(f, "pst")) { 
     352            pixelsFile[nextFile++] = 
     353              new Location(directory, f).getAbsolutePath(); 
     354          } 
     355        } 
     356 
     357        if (nextFile == 0) throw new FormatException("No image files found."); 
    349358      } 
    350359    } 
     
    353362 
    354363    pixelsFiles = new String[getSeriesCount()]; 
     364    infFiles = new String[getSeriesCount()]; 
    355365 
    356366    Object[] metadataKeys = tmpSeriesMetadata.keySet().toArray(); 
     
    387397        int dot = file.lastIndexOf("."); 
    388398        String inf = file.substring(0, dot) + ".inf"; 
     399        infFiles[i] = inf; 
    389400 
    390401        BufferedReader reader = new BufferedReader(new FileReader(inf)); 
  • trunk/components/bio-formats/src/loci/formats/in/ZeissLSMReader.java

    r7055 r7125  
    302302    FormatTools.checkPlaneParameters(this, no, buf.length, x, y, w, h); 
    303303 
     304    in.close(); 
    304305    in = new RandomAccessInputStream(getLSMFileFromSeries(getSeries())); 
    305306    in.order(!isLittleEndian()); 
     
    507508 
    508509  private int getExtraSeries(String file) throws FormatException, IOException { 
     510    if (in != null) in.close(); 
    509511    in = new RandomAccessInputStream(file); 
    510512    boolean littleEndian = in.read() == TiffConstants.LITTLE; 
     
    563565    IFD ifd = ifds.get(0); 
    564566 
     567    in.close(); 
    565568    in = new RandomAccessInputStream(getLSMFileFromSeries(series)); 
    566569    in.order(isLittleEndian()); 
     
    16051608    } 
    16061609 
    1607     String[] fileList = parent.list(); 
     1610    String[] fileList = parent.list(true); 
    16081611    for (int i=0; i<fileList.length; i++) { 
    16091612      if (checkSuffix(fileList[i], new String[] {"lsm"}) && 
Note: See TracChangeset for help on using the changeset viewer.