Changeset 6385


Ignore:
Timestamp:
05/25/10 13:20:38 (9 years ago)
Author:
curtis
Message:

Fix rounding error in LUT generation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/loci-plugins/src/loci/plugins/in/ImagePlusReader.java

    r6345 r6385  
    366366    final int blue = color.getBlue(); 
    367367    final int lutLength = 256; 
     368    final int lutDivisor = lutLength - 1; 
    368369    byte[] r = new byte[lutLength]; 
    369370    byte[] g = new byte[lutLength]; 
    370371    byte[] b = new byte[lutLength]; 
    371372    for (int i=0; i<lutLength; i++) { 
    372       r[i] = (byte) (i * red / lutLength); 
    373       g[i] = (byte) (i * green / lutLength); 
    374       b[i] = (byte) (i * blue / lutLength); 
     373      r[i] = (byte) (i * red / lutDivisor); 
     374      g[i] = (byte) (i * green / lutDivisor); 
     375      b[i] = (byte) (i * blue / lutDivisor); 
    375376    } 
    376377    return new LUT(r, g, b); 
Note: See TracChangeset for help on using the changeset viewer.