Changeset 6450


Ignore:
Timestamp:
06/02/10 17:19:57 (9 years ago)
Author:
curtis
Message:

Better indexed color logic; still broken in various cases though.

Location:
trunk/components/loci-plugins/src/loci/plugins/in
Files:
2 edited

Legend:

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

    r6433 r6450  
    307307    final ImporterOptions options = process.getOptions(); 
    308308 
    309     // CTR FIXME - problems with single channel data 
    310     // CTR FIXME - problems with sizeC > 7 
    311309    // CTR FIXME - problems with default color mode 
    312310    int mode = -1; 
    313     if (options.isColorModeComposite()) mode = CompositeImage.COMPOSITE; 
     311    int sizeC = process.getReader().getSizeC(); 
     312    if (sizeC == 1) { 
     313      // NB: Cannot use CompositeImage for single-channel images. 
     314      // CTR FIXME finish sizeC==1 case 
     315      loci.plugins.BF.warn(options.isQuiet(), "sizeC = 1");//TEMP 
     316    } 
     317    else if (sizeC > 7) { 
     318      // NB: Cannot use CompositeImage when there are more than seven channels. 
     319      // CTR FIXME finish sizeC>7 case 
     320      loci.plugins.BF.warn(options.isQuiet(), "sizeC > 7");//TEMP 
     321    } 
     322    else if (options.isColorModeComposite()) mode = CompositeImage.COMPOSITE; 
    314323    else if (options.isColorModeColorized()) mode = CompositeImage.COLOR; 
    315324    else if (options.isColorModeGrayscale()) mode = CompositeImage.GRAYSCALE; 
  • trunk/components/loci-plugins/src/loci/plugins/in/ImportProcess.java

    r6324 r6450  
    416416    r.setId(options.getId()); 
    417417 
    418     boolean fillIndexed; 
     418    final boolean fillIndexed; 
    419419    if (r.isIndexed()) { 
     420      final int bpp = FormatTools.getBytesPerPixel(r.getPixelType()); 
     421      final byte[][] lut8 = r.get8BitLookupTable(); 
     422      final boolean defaultColorMode = options.isColorModeDefault(); 
     423 
     424      // NB: ImageJ only supports 8-bit RGB color tables. 
     425      // In addition, we only keep the indices in default color mode. 
     426      final boolean keepColorTable = defaultColorMode && 
     427        bpp == 1 && lut8 != null && lut8.length >= 1 && lut8.length <= 3; 
     428 
    420429      if (r.isFalseColor()) { 
    421         // false color; never fill indices 
     430        // false color; never fill the indices 
    422431        fillIndexed = false; 
     432        if (!keepColorTable) { 
     433          // warn the user that we'll have to throw away the color table 
     434          BF.warn(options.isQuiet(), 
     435            "false color table will be lost: " + getIdName()); 
     436        } 
    423437      } 
    424438      else { 
    425         // true color; fill indices unless 8-bit RGB with default color mode 
    426         int bpp = FormatTools.getBytesPerPixel(r.getPixelType()); 
    427         byte[][] lut8 = r.get8BitLookupTable(); 
    428         boolean defaultColorMode = options.isColorModeDefault(); 
    429         fillIndexed = !defaultColorMode || bpp > 1 || lut8 == null || lut8[0].length > 3; 
     439        // true color; if we can't keep the color table, then fill the indices 
     440        fillIndexed = !keepColorTable; 
    430441      } 
    431442    } 
     
    433444    if (fillIndexed) { 
    434445      r = channelFiller = new ChannelFiller(r); 
    435       BF.warn(options.isQuiet(), "Index values will be lost"); 
     446      BF.warn(options.isQuiet(), "index values will be lost: " + getIdName()); 
    436447    } 
    437448 
Note: See TracChangeset for help on using the changeset viewer.