Changeset 4301


Ignore:
Timestamp:
08/07/08 15:58:16 (12 years ago)
Author:
curtis
Message:

Fix some problems in channel separator and dimension swapper. Still bugs left.

Location:
trunk/loci/formats
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/ChannelSeparator.java

    r4048 r4301  
    7171    FormatTools.assertId(getCurrentFile(), true, 2); 
    7272    return (reader.isRGB() && !reader.isIndexed()) ? 
    73       (getSizeC() / reader.getEffectiveSizeC()) * reader.getImageCount() : 
     73      reader.getRGBChannelCount() * reader.getImageCount() : 
    7474      reader.getImageCount(); 
    7575  } 
  • trunk/loci/formats/DimensionSwapper.java

    r4291 r4301  
    106106    int oldT = oldOrder.indexOf("T"); 
    107107 
     108    if (oldC != newC && getRGBChannelCount() > 1) { 
     109      throw new IllegalArgumentException( 
     110        "Cannot swap C dimension when RGB channel count > 1"); 
     111    } 
     112 
    108113    dims[oldX] = getSizeX(); 
    109114    dims[oldY] = getSizeY(); 
     
    121126    core.sizeT[series] = dims[newT]; 
    122127    core.currentOrder[series] = order; 
     128 
     129    if (oldC != newC) { 
     130      // C was overridden; clear the sub-C dimensional metadata 
     131      core.cLengths[series] = null; 
     132      core.cTypes[series] = null; 
     133    } 
    123134 
    124135    MetadataStore store = getMetadataStore(); 
  • trunk/loci/formats/FileStitcher.java

    r4300 r4301  
    332332  /* @see IFormatReader#getChannelDimLengths() */ 
    333333  public int[] getChannelDimLengths() { 
    334     FormatTools.assertId(currentId, true, 1); 
    335     return noStitch ? reader.getChannelDimLengths() : 
    336       core.cLengths[getSeries()]; 
     334    FormatTools.assertId(currentId, true, 2); 
     335    if (noStitch) return reader.getChannelDimLengths(); 
     336    if (core.cLengths[series] == null) return new int[] {core.sizeC[series]}; 
     337    return core.cLengths[series]; 
    337338  } 
    338339 
    339340  /* @see IFormatReader#getChannelDimTypes() */ 
    340341  public String[] getChannelDimTypes() { 
    341     FormatTools.assertId(currentId, true, 1); 
    342     return noStitch ? reader.getChannelDimTypes() : core.cTypes[getSeries()]; 
     342    FormatTools.assertId(currentId, true, 2); 
     343    if (noStitch) return reader.getChannelDimTypes(); 
     344    if (core.cTypes[series] == null) return new String[] {FormatTools.CHANNEL}; 
     345    return core.cTypes[series]; 
    343346  } 
    344347 
  • trunk/loci/formats/FormatReader.java

    r4291 r4301  
    342342  public int[] getChannelDimLengths() { 
    343343    FormatTools.assertId(currentId, true, 1); 
    344     if (core.cLengths[series] == null) { 
    345       core.cLengths[series] = new int[] {core.sizeC[series]}; 
    346     } 
     344    if (core.cLengths[series] == null) return new int[] {core.sizeC[series]}; 
    347345    return core.cLengths[series]; 
    348346  } 
     
    351349  public String[] getChannelDimTypes() { 
    352350    FormatTools.assertId(currentId, true, 1); 
    353     if (core.cTypes[series] == null) { 
    354       core.cTypes[series] = new String[] {FormatTools.CHANNEL}; 
    355     } 
     351    if (core.cTypes[series] == null) return new String[] {FormatTools.CHANNEL}; 
    356352    return core.cTypes[series]; 
    357353  } 
     
    363359      int sx = getSizeX(); 
    364360      int sy = getSizeY(); 
    365       core.thumbSizeX[series] = 
     361      int thumbSizeX = 
    366362        sx > sy ? THUMBNAIL_DIMENSION : sx * THUMBNAIL_DIMENSION / sy; 
    367       if (core.thumbSizeX[series] == 0) core.thumbSizeX[series] = 1; 
     363      if (thumbSizeX == 0) thumbSizeX = 1; 
     364      return thumbSizeX; 
    368365    } 
    369366    return core.thumbSizeX[series]; 
     
    376373      int sx = getSizeX(); 
    377374      int sy = getSizeY(); 
    378       core.thumbSizeY[series] = 
     375      int thumbSizeY = 
    379376        sy > sx ? THUMBNAIL_DIMENSION : sy * THUMBNAIL_DIMENSION / sx; 
    380       if (core.thumbSizeY[series] == 0) core.thumbSizeY[series] = 1; 
     377      if (thumbSizeY == 0) thumbSizeY = 1; 
     378      return thumbSizeY; 
    381379    } 
    382380    return core.thumbSizeY[series]; 
Note: See TracChangeset for help on using the changeset viewer.