Changeset 7311


Ignore:
Timestamp:
12/02/10 12:17:37 (9 years ago)
Author:
melissa
Message:

A couple of fixes for reading a sub-image of the second channel in 2 channel LSM files. See  omero:#3627.

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

Legend:

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

    r7260 r7311  
    3636import loci.common.Location; 
    3737import loci.common.RandomAccessInputStream; 
     38import loci.common.Region; 
    3839import loci.common.services.DependencyException; 
    3940import loci.common.services.ServiceFactory; 
     
    176177  private int prevPlane = -1; 
    177178  private byte[] prevBuf = null; 
     179  private Region prevRegion = null; 
    178180 
    179181  // -- Constructor -- 
     
    215217      prevPlane = -1; 
    216218      prevBuf = null; 
     219      prevRegion = null; 
    217220      xCoordinates = null; 
    218221      yCoordinates = null; 
     
    315318      int plane = no / getSizeC(); 
    316319      int c = no % getSizeC(); 
     320      Region region = new Region(x, y, w, h); 
    317321 
    318322      if (prevPlane != plane || prevBuf == null || 
    319         prevBuf.length < buf.length * getSizeC()) 
     323        prevBuf.length < w * h * bpp * getSizeC() || !region.equals(prevRegion)) 
    320324      { 
    321         prevBuf = new byte[buf.length * getSizeC()]; 
     325        prevBuf = new byte[w * h * bpp * getSizeC()]; 
    322326        tiffParser.getSamples(ifds.get(plane), prevBuf, x, y, w, h); 
    323327        prevPlane = plane; 
     328        prevRegion = region; 
    324329      } 
    325330      ImageTools.splitChannels(prevBuf, buf, c, getSizeC(), bpp, false, false); 
  • trunk/components/bio-formats/src/loci/formats/tiff/TiffParser.java

    r6977 r7311  
    701701        tileBounds.y = row * (int) tileLength; 
    702702 
    703         if (!imageBounds.intersects(tileBounds)) continue; 
    704  
    705703        if (planarConfig == 2) { 
    706704          tileBounds.y = (int) ((row % nrows) * tileLength); 
     
    725723        realX *= pixel; 
    726724        realY *= rowLen; 
     725 
     726        if (!imageBounds.intersects(tileBounds)) continue; 
    727727 
    728728        for (int q=0; q<effectiveChannels; q++) { 
Note: See TracChangeset for help on using the changeset viewer.