Changeset 5712


Ignore:
Timestamp:
11/22/09 11:56:59 (10 years ago)
Author:
melissa
Message:
  • Merged r5706, r5636, and r5654 into 4.1 branch.
  • Fixed SizeC mismatch with certain OME-TIFF files.
Files:
3 edited

Legend:

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

    r5517 r5712  
    7373  public MinimalTiffReader(String name, String[] suffixes) { 
    7474    super(name, suffixes); 
     75  } 
     76 
     77  // -- MinimalTiffReader API methods -- 
     78 
     79  /** Gets the list of IFDs associated with the current TIFF's image planes. */ 
     80  public IFDList getIFDs() { 
     81    return ifds; 
     82  } 
     83 
     84  /** Gets the list of IFDs associated with the current TIFF's thumbnails. */ 
     85  public IFDList getThumbnailIFDs() { 
     86    return thumbnailIFDs; 
    7587  } 
    7688 
     
    231243      IFD ifd = ifds.get(i); 
    232244      boolean thumbnail = ifd.getIFDIntValue(IFD.NEW_SUBFILE_TYPE) == 1 && 
    233         (ifds.size() > 1 || ifd.get(new Integer(IFD.IMAGE_WIDTH)) == null); 
     245        (ifds.size() > 1 || ifd.getIFDValue(IFD.IMAGE_WIDTH) == null); 
    234246      if (thumbnail) thumbs.add(ifd); 
    235247      else v.add(ifd); 
  • branches/4.1/components/bio-formats/src/loci/formats/in/OMETiffReader.java

    r5564 r5712  
    166166    FormatTools.checkPlaneParameters(this, no, buf.length, x, y, w, h); 
    167167    lastPlane = no; 
    168     IFormatReader r = info[series][no].reader; 
    169     r.setId(info[series][no].id); 
    170     return r.openBytes(info[series][no].ifd, buf, x, y, w, h); 
     168    int i = info[series][no].ifd; 
     169    MinimalTiffReader r = (MinimalTiffReader) info[series][no].reader; 
     170    if (r.getCurrentFile() == null) { 
     171      r.setId(info[series][no].id); 
     172    } 
     173    IFD ifd = r.getIFDs().get(i); 
     174    RandomAccessInputStream s = 
     175      new RandomAccessInputStream(info[series][no].id); 
     176    TiffParser p = new TiffParser(s); 
     177    p.getSamples(ifd, buf, x, y, w, h); 
     178    s.close(); 
     179    return buf; 
    171180  } 
    172181 
     
    381390          IFormatReader r = readers.get(filename); 
    382391          if (r == null) { 
    383             r = new TiffReader(); 
     392            r = new MinimalTiffReader(); 
    384393            readers.put(filename, r); 
    385394          } 
     
    488497          int photo = firstIFD.getPhotometricInterpretation(); 
    489498          core[s].rgb = samples > 1 || photo == PhotoInterp.RGB; 
    490           if (samples != core[s].sizeC && (samples % core[s].sizeC) != 0 && 
    491             (core[s].sizeC % samples) != 0) 
     499          if ((samples != core[s].sizeC && (samples % core[s].sizeC) != 0 && 
     500            (core[s].sizeC % samples) != 0) || core[s].sizeC == 1) 
    492501          { 
    493502            core[s].sizeC *= samples; 
     
    548557 
    549558  // -- Helper methods -- 
    550  
    551   private IFormatReader getReader(int no) throws FormatException, IOException { 
    552     FormatTools.checkPlaneNumber(this, no); 
    553     IFormatReader r = info[series][no].reader; 
    554     r.setId(info[series][no].id); 
    555     return r; 
    556   } 
    557559 
    558560  private String normalizeFilename(String dir, String name) { 
  • trunk/components/bio-formats/src/loci/formats/in/OMETiffReader.java

    r5706 r5712  
    497497          int photo = firstIFD.getPhotometricInterpretation(); 
    498498          core[s].rgb = samples > 1 || photo == PhotoInterp.RGB; 
    499           if (samples != core[s].sizeC && (samples % core[s].sizeC) != 0 && 
    500             (core[s].sizeC % samples) != 0) 
     499          if ((samples != core[s].sizeC && (samples % core[s].sizeC) != 0 && 
     500            (core[s].sizeC % samples) != 0) || core[s].sizeC == 1) 
    501501          { 
    502502            core[s].sizeC *= samples; 
Note: See TracChangeset for help on using the changeset viewer.