Changeset 3270


Ignore:
Timestamp:
10/12/07 08:46:09 (12 years ago)
Author:
melissa
Message:

Fixed tiling bug and added remaining BigTIFF types.

File:
1 edited

Legend:

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

    r3269 r3270  
    7575  public static final int FLOAT = 11; 
    7676  public static final int DOUBLE = 12; 
     77  public static final int LONG8 = 16; 
     78  public static final int SLONG8 = 17; 
     79  public static final int IFD8 = 18; 
    7780 
    7881  public static final int[] BYTES_PER_ELEMENT = { 
     
    9093    4, // FLOAT 
    9194    8, // DOUBLE 
     95    -1, // invalid type 
     96    -1, // invalid type 
     97    -1, // invalid type 
     98    -1, // invalid type 
     99    8, // LONG8 
     100    8, // SLONG8 
     101    8 // IFD8 
    92102  }; 
    93103 
     
    513523        } 
    514524      } 
     525      else if (type == LONG8 || type == SLONG8 || type == IFD8) { 
     526        if (count > threshhold / 8) { 
     527          long pointer = bigTiff ? in.readLong() : in.readInt(); 
     528          in.seek(pointer); 
     529        } 
     530        if (count == 1) value = new Long(in.readLong()); 
     531        else { 
     532          long[] longs = new long[count]; 
     533          for (int j=0; j<count; j++) longs[j] = in.readLong(); 
     534          value = longs; 
     535        } 
     536      } 
    515537      else if (type == RATIONAL || type == SRATIONAL) { 
    516538        // Two LONGs: the first represents the numerator of a fraction; 
     
    12881310        b = uncompress(b, compression); 
    12891311 
    1290         int rowBytes = (int) (tileWidth * 
    1291           (stripByteCounts[0] / (tileWidth*tileLength))); 
     1312        int ext = (int) (stripByteCounts[0] / (tileWidth * tileLength)); 
     1313        int rowBytes = (int) (tileWidth * ext); 
     1314        if (tileWidth + col > imageWidth) { 
     1315          rowBytes = (int) ((imageWidth - col) * ext); 
     1316        } 
    12921317 
    12931318        for (int j=0; j<tileLength; j++) { 
    1294           int len = rowBytes; 
    1295           if (col*bytes + rowBytes > imageWidth*bytes) { 
    1296             len = (int) (imageWidth*bytes - col*bytes); 
    1297           } 
    1298  
    1299           System.arraycopy(b, j*rowBytes, data, 
    1300             (int) ((row+j)*imageWidth*bytes + col*bytes), len); 
     1319          System.arraycopy(b, rowBytes*j, data, 
     1320            (int) ((row + j)*imageWidth*ext + ext*col), rowBytes); 
    13011321        } 
    13021322 
Note: See TracChangeset for help on using the changeset viewer.