Changeset 6422


Ignore:
Timestamp:
05/28/10 19:32:15 (10 years ago)
Author:
curtis
Message:

Fix more problems with ChannelFiller (some self-inflicted). Seems to work now.

File:
1 edited

Legend:

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

    r6418 r6422  
    4040 */ 
    4141public class ChannelFiller extends ReaderWrapper { 
    42    
     42 
    4343  // -- Utility methods -- 
    4444 
     
    5959  // -- IFormatReader API methods -- 
    6060 
     61  /* @see IFormatReader#getSizeC() */ 
    6162  @Override 
    6263  public int getSizeC() { 
     
    6566  } 
    6667 
     68  /* @see IFormatReader#getImageCount() */ 
     69/* 
     70  @Override 
     71  public int getImageCount() { 
     72    if (passthrough()) return reader.getImageCount(); 
     73    return reader.getImageCount() * getLookupTableComponentCount(); 
     74  } 
     75*/ 
     76 
    6777  /* @see IFormatReader#isRGB() */ 
    6878  @Override 
    6979  public boolean isRGB() { 
    7080    if (passthrough()) return reader.isRGB(); 
    71     return false; 
     81    return getRGBChannelCount() > 1; 
    7282  } 
    7383 
     
    7989  } 
    8090 
    81   /* @see IFormatReader#getRGBChannelCount() */ 
    82   @Override 
    83   public int getRGBChannelCount() { 
    84     if (passthrough()) return reader.getRGBChannelCount(); 
    85     return reader.getRGBChannelCount() * getLookupTableComponentCount(); 
    86   } 
    87  
    8891  /* @see IFormatReader#get8BitLookupTable() */ 
    8992  @Override 
     
    98101    if (passthrough()) return reader.get16BitLookupTable(); 
    99102    return null; 
     103  } 
     104 
     105  /* @see IFormatReader#getChannelDimLengths() */ 
     106  @Override 
     107  public int[] getChannelDimLengths() { 
     108    int[] cLengths = reader.getChannelDimLengths(); 
     109    if (passthrough()) return cLengths; 
     110 
     111    // in the case of a single channel, replace rather than append 
     112    if (cLengths.length == 1 && cLengths[0] == 1) cLengths = new int[0]; 
     113 
     114    // append filled dimension to channel dim lengths 
     115    int[] newLengths = new int[1 + cLengths.length]; 
     116    newLengths[0] = getLookupTableComponentCount(); 
     117    System.arraycopy(cLengths, 0, newLengths, 1, cLengths.length); 
     118    return newLengths; 
     119  } 
     120 
     121  /* @see IFormatReader#getChannelDimTypes() */ 
     122  @Override 
     123  public String[] getChannelDimTypes() { 
     124    String[] cTypes = reader.getChannelDimTypes(); 
     125    if (passthrough()) return cTypes; 
     126 
     127    // in the case of a single channel, leave type unchanged 
     128    int[] cLengths = reader.getChannelDimLengths(); 
     129    if (cLengths.length == 1 && cLengths[0] == 1) return cTypes; 
     130 
     131    // append filled dimension to channel dim types 
     132    String[] newTypes = new String[1 + cTypes.length]; 
     133    newTypes[0] = FormatTools.CHANNEL; 
     134    System.arraycopy(cTypes, 0, newTypes, 1, cTypes.length); 
     135    return newTypes; 
    100136  } 
    101137 
     
    186222    MetadataTools.populatePixels(store, this, false, false); 
    187223  } 
    188    
     224 
    189225  // -- Helper methods -- 
    190226 
     
    193229    return !reader.isIndexed() || reader.isFalseColor(); 
    194230  } 
    195    
     231 
    196232  /** Gets the number of color components in the lookup table. */ 
    197233  private int getLookupTableComponentCount() { 
Note: See TracChangeset for help on using the changeset viewer.