Changeset 6319


Ignore:
Timestamp:
05/14/10 12:43:38 (10 years ago)
Author:
curtis
Message:

Change gradient to always start at smallest possible value for integer types.

File:
1 edited

Legend:

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

    r6310 r6319  
    107107    int bpp = FormatTools.getBytesPerPixel(pixelType); 
    108108    boolean signed = FormatTools.isSigned(pixelType); 
     109    boolean floating = FormatTools.isFloatingPoint(pixelType); 
    109110    boolean little = isLittleEndian(); 
    110111    boolean indexed = isIndexed(); 
     
    113114    int zIndex = zct[0], cIndex = zct[1], tIndex = zct[2]; 
    114115 
    115     for (int r=0; r<h; r++) { 
    116       int yy = y + r; 
    117       for (int c=0; c<w; c++) { 
    118         int index = bpp * (w * r + c); 
    119         int xx = x + c; 
     116    // integer types start gradient at the smallest value 
     117    long min = signed ? (long) -Math.pow(2, 8 * bpp - 1) : 0; 
     118    if (floating) min = 0; // floating point types always start at 0 
     119 
     120    for (int row=0; row<h; row++) { 
     121      int yy = y + row; 
     122      for (int col=0; col<w; col++) { 
     123        int index = bpp * (w * row + col); 
     124        int xx = x + col; 
    120125 
    121126        // encode various information into the image plane 
    122         long pixel = signed ? -xx : xx; 
     127        long pixel = min + xx; 
    123128        if (yy < BOX_SIZE) { 
    124129          int grid = xx / BOX_SIZE; 
Note: See TracChangeset for help on using the changeset viewer.