Changeset 6480


Ignore:
Timestamp:
06/03/10 21:50:35 (9 years ago)
Author:
curtis
Message:

Tweak creation of ColorModel.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/loci-plugins/src/loci/plugins/util/ImageProcessorReader.java

    r6442 r6480  
    3131import ij.process.ShortProcessor; 
    3232 
     33import java.awt.image.ColorModel; 
    3334import java.awt.image.IndexColorModel; 
    3435import java.io.IOException; 
     
    128129    } 
    129130 
     131    // create a color model for this plane (null means default) 
     132    ij.IJ.log("For image #" + no + "...");//TEMP 
     133    final ColorModel cm = createColorModel(); 
     134 
    130135    // convert byte array to appropriate primitive array type 
    131136    boolean isFloat = FormatTools.isFloatingPoint(type); 
    132137    boolean isLittle = isLittleEndian(); 
    133138    boolean isSigned = FormatTools.isSigned(type); 
    134  
    135     IndexColorModel cm = null; 
    136     if (isIndexed()) cm = createIndexColorModel(); 
    137139 
    138140    // construct image processors 
     
    214216  // -- Helper methods -- 
    215217 
    216   private IndexColorModel createIndexColorModel() 
    217     throws FormatException, IOException 
    218   { 
     218  private ColorModel createColorModel() throws FormatException, IOException { 
     219    // NB: If a color table is present, we might as well use it, 
     220    // regardless of the value of isIndexed. 
     221    //if (!isIndexed()) return null; 
     222 
    219223    byte[][] byteTable = get8BitLookupTable(); 
    220224    if (byteTable == null) byteTable = convertTo8Bit(get16BitLookupTable()); 
    221225    if (byteTable == null) return null; 
     226    ij.IJ.log("Found 8-bit color table: last green value=" + byteTable[1][byteTable[1].length - 1]);//TEMP 
    222227    return new IndexColorModel(8, byteTable[0].length, 
    223228      byteTable[0], byteTable[1], byteTable[2]); 
Note: See TracChangeset for help on using the changeset viewer.