Changeset 6221


Ignore:
Timestamp:
05/03/10 17:27:47 (10 years ago)
Author:
melissa
Message:

Fixed Nikon type, compression, and image count detection bugs.

File:
1 edited

Legend:

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

    r6139 r6221  
    119119  public boolean isThisType(RandomAccessInputStream stream) throws IOException { 
    120120    TiffParser tp = new TiffParser(stream); 
    121     tp.setDoCaching(false); 
    122121    IFD ifd = tp.getFirstIFD(); 
    123122    if (ifd == null) return false; 
    124     return ifd.containsKey(new Integer(TIFF_EPS_STANDARD)); 
     123    if (ifd.containsKey(TIFF_EPS_STANDARD)) return true; 
     124    String make = ifd.getIFDTextValue(IFD.MAKE); 
     125    return make != null && make.indexOf("Nikon") != -1; 
    125126  } 
    126127 
     
    135136    IFD ifd = ifds.get(no); 
    136137    int[] bps = ifd.getBitsPerSample(); 
    137  
    138     if (bps.length > 1) { 
     138    int dataSize = bps[0]; 
     139 
     140    long[] byteCounts = ifd.getStripByteCounts(); 
     141    long totalBytes = 0; 
     142    for (long b : byteCounts) { 
     143      totalBytes += b; 
     144    } 
     145    if (totalBytes == FormatTools.getPlaneSize(this) || bps.length > 1) { 
    139146      return super.openBytes(no, buf, x, y, w, h); 
    140147    } 
    141148 
    142     int dataSize = bps[0]; 
    143  
    144     long[] byteCounts = ifd.getStripByteCounts(); 
    145149    long[] offsets = ifd.getStripOffsets(); 
    146150 
     
    401405 
    402406    core[0].imageCount = 1; 
     407    core[0].sizeT = 1; 
    403408    if (ifds.get(0).getSamplesPerPixel() == 1) { 
    404409      core[0].interleaved = true; 
Note: See TracChangeset for help on using the changeset viewer.