Changeset 7140


Ignore:
Timestamp:
10/26/10 17:59:32 (9 years ago)
Author:
melissa
Message:

Fixed an NPE and a few plane indexing bugs.

Files:
4 edited

Legend:

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

    r7097 r7140  
    829829    IFD ifd = tp.getFirstIFD(); 
    830830    s.close(); 
     831    if (ifd == null) return null; 
    831832    int[] colorMap = ifd.getIFDIntArray(IFD.COLOR_MAP); 
    832833    if (colorMap == null) return null; 
  • branches/4.2/components/bio-formats/src/loci/formats/in/TCSReader.java

    r7127 r7140  
    7878  private TiffParser tiffParser; 
    7979 
     80  private int lastPlane; 
    8081  private long datestamp; 
    8182  private String xmlFile; 
     
    162163  public byte[][] get8BitLookupTable() throws FormatException, IOException { 
    163164    FormatTools.assertId(currentId, true, 1); 
    164     return tiffReaders[0].get8BitLookupTable(); 
     165    return tiffReaders[lastPlane].get8BitLookupTable(); 
    165166  } 
    166167 
     
    168169  public short[][] get16BitLookupTable() throws FormatException, IOException { 
    169170    FormatTools.assertId(currentId, true, 1); 
    170     return tiffReaders[0].get16BitLookupTable(); 
     171    return tiffReaders[lastPlane].get16BitLookupTable(); 
    171172  } 
    172173 
     
    187188      return tiffReaders[0].openBytes(n, buf, x, y, w, h); 
    188189    } 
    189     return tiffReaders[n].openBytes(0, buf, x, y, w, h); 
     190    int plane = 0; 
     191    if (tiffReaders[0].getImageCount() > 1) { 
     192      n /= tiffReaders.length; 
     193      plane = n % tiffReaders.length; 
     194    } 
     195    lastPlane = n; 
     196    return tiffReaders[n].openBytes(plane, buf, x, y, w, h); 
    190197  } 
    191198 
     
    216223      datestamp = 0; 
    217224      xmlFile = null; 
     225      lastPlane = 0; 
    218226    } 
    219227  } 
  • trunk/components/bio-formats/src/loci/formats/in/MIASReader.java

    r7070 r7140  
    829829    IFD ifd = tp.getFirstIFD(); 
    830830    s.close(); 
     831    if (ifd == null) return null; 
    831832    int[] colorMap = ifd.getIFDIntArray(IFD.COLOR_MAP); 
    832833    if (colorMap == null) return null; 
  • trunk/components/bio-formats/src/loci/formats/in/TCSReader.java

    r7127 r7140  
    7878  private TiffParser tiffParser; 
    7979 
     80  private int lastPlane; 
    8081  private long datestamp; 
    8182  private String xmlFile; 
     
    162163  public byte[][] get8BitLookupTable() throws FormatException, IOException { 
    163164    FormatTools.assertId(currentId, true, 1); 
    164     return tiffReaders[0].get8BitLookupTable(); 
     165    return tiffReaders[lastPlane].get8BitLookupTable(); 
    165166  } 
    166167 
     
    168169  public short[][] get16BitLookupTable() throws FormatException, IOException { 
    169170    FormatTools.assertId(currentId, true, 1); 
    170     return tiffReaders[0].get16BitLookupTable(); 
     171    return tiffReaders[lastPlane].get16BitLookupTable(); 
    171172  } 
    172173 
     
    187188      return tiffReaders[0].openBytes(n, buf, x, y, w, h); 
    188189    } 
    189     return tiffReaders[n].openBytes(0, buf, x, y, w, h); 
     190    int plane = 0; 
     191    if (tiffReaders[0].getImageCount() > 1) { 
     192      n /= tiffReaders.length; 
     193      plane = n % tiffReaders.length; 
     194    } 
     195    lastPlane = n; 
     196    return tiffReaders[n].openBytes(plane, buf, x, y, w, h); 
    190197  } 
    191198 
     
    216223      datestamp = 0; 
    217224      xmlFile = null; 
     225      lastPlane = 0; 
    218226    } 
    219227  } 
Note: See TracChangeset for help on using the changeset viewer.