Changeset 6561


Ignore:
Timestamp:
06/22/10 17:53:40 (9 years ago)
Author:
curtis
Message:

Do not fill indices for true color data if LUT is compatible with ImageJ.

Location:
trunk/components
Files:
2 edited

Legend:

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

    r6554 r6561  
    4949  } 
    5050 
     51  // -- Fields -- 
     52 
     53  /** 
     54   * Whether to fill in the indices. 
     55   * By default, indices are filled iff data not false color. 
     56   */ 
     57  protected Boolean filled = null; 
     58 
    5159  // -- Constructors -- 
    5260 
     
    6169  /** Returns true if the indices are being factored out. */ 
    6270  public boolean isFilled() { 
    63     return reader.isIndexed() && !reader.isFalseColor(); 
     71    if (!reader.isIndexed()) return false; // cannot fill non-indexed color 
     72    return filled == null ? !reader.isFalseColor() : filled; 
     73  } 
     74 
     75  /** Toggles whether the indices should be factored out. */ 
     76  public void setFilled(boolean filled) { 
     77    this.filled = filled; 
    6478  } 
    6579 
  • trunk/components/loci-plugins/src/loci/plugins/in/ImportProcess.java

    r6558 r6561  
    416416    r.setId(options.getId()); 
    417417 
     418    // NB: This test will fail if the LUT is null before calling openBytes. 
     419    final byte[][] lut8 = r.get8BitLookupTable(); 
     420    final int sizeC = r.getSizeC(); 
    418421    r = channelFiller = new ChannelFiller(r); 
     422    if (sizeC == 1 && lut8 != null && lut8.length <= 3) { 
     423      // NB: ImageJ can preserve the color table, so no need to fill indices. 
     424      channelFiller.setFilled(false); 
     425    } 
     426    else BF.warn(false, "sizeC=" + r.getSizeC() + ", lut8.length=" + lut8.length); 
    419427    if (channelFiller.isFilled()) { 
    420       BF.warn(options.isQuiet(), "index values will be lost: " + getIdName()); 
    421     } 
     428      BF.warn(options.isQuiet(), getIdName() + ": index values will be lost"); 
     429    } 
     430 
    422431    r = channelSeparator = new ChannelSeparator(r); 
    423432    r = dimensionSwapper = new DimensionSwapper(r); 
Note: See TracChangeset for help on using the changeset viewer.