Changeset 3174


Ignore:
Timestamp:
09/18/07 13:24:40 (12 years ago)
Author:
melissa
Message:

Fixed strip offset calculation for IFDs that are missing strip byte count/rows per strip tags.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/TiffTools.java

    r3131 r3174  
    869869      // have the StripByteCounts tag, it also won't have the RowsPerStrip tag 
    870870      stripByteCounts = new long[stripOffsets.length]; 
    871       stripByteCounts[0] = stripOffsets[0]; 
    872       for (int i=1; i<stripByteCounts.length; i++) { 
    873         stripByteCounts[i] = stripOffsets[i] - stripByteCounts[i-1]; 
     871      if (stripByteCounts.length == 1) { 
     872        stripByteCounts[0] = imageWidth * imageLength * (bitsPerSample[0] / 8); 
     873      } 
     874      else { 
     875        stripByteCounts[0] = stripOffsets[0]; 
     876        for (int i=1; i<stripByteCounts.length; i++) { 
     877          stripByteCounts[i] = stripOffsets[i] - stripByteCounts[i-1]; 
     878        } 
    874879      } 
    875880    } 
     
    15121517        if (photoInterp == WHITE_IS_ZERO) { // invert color value 
    15131518          samples[channelNum][ndx] = 
    1514             (short) (Integer.MAX_VALUE - samples[channelNum][ndx]); 
     1519            (short) ((65535 - samples[channelNum][ndx]) & 0xffff); 
    15151520        } 
    15161521        else if (photoInterp == CMYK) { 
     
    16791684 
    16801685          if (photoInterp == WHITE_IS_ZERO) { // invert color value 
    1681             samples[i][ndx] = (short) (Integer.MAX_VALUE - samples[i][ndx]); 
     1686            samples[i][ndx] = (short) ((65535 - samples[i][ndx]) & 0xffff); 
    16821687          } 
    16831688          else if (photoInterp == CMYK) { 
Note: See TracChangeset for help on using the changeset viewer.