Changeset 6571


Ignore:
Timestamp:
06/25/10 16:27:22 (9 years ago)
Author:
curtis
Message:

Fix indexing bug when reading only a subset of planes.

File:
1 edited

Legend:

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

    r6558 r6571  
    3737 
    3838import loci.formats.ChannelFiller; 
     39import loci.formats.DimensionSwapper; 
     40import loci.formats.FormatTools; 
    3941import loci.formats.ImageReader; 
    4042import loci.plugins.BF; 
     
    6769    final ImporterOptions options = process.getOptions(); 
    6870    final ImageProcessorReader reader = process.getReader(); 
     71    final DimensionSwapper dimSwapper = process.getDimensionSwapper(); 
    6972    final ChannelFiller channelFiller = process.getChannelFiller(); 
    7073    final ImageReader imageReader = process.getImageReader(); 
     
    8083      // get each channel's color model 
    8184      final ImageStack stack = imp.getStack(); 
    82       final int sizeC = reader.getEffectiveSizeC(); 
    83       final LUT[] channelLUTs = new LUT[sizeC]; 
     85      final String stackOrder = dimSwapper.getDimensionOrder(); 
     86      final int zSize = imp.getNSlices(); 
     87      final int cSize = imp.getNChannels(); 
     88      final int tSize = imp.getNFrames(); 
     89      final int stackSize = imp.getStackSize(); 
     90      final LUT[] channelLUTs = new LUT[cSize]; 
    8491      boolean hasChannelLUT = false; 
    85       for (int c=0; c<sizeC; c++) { 
    86         final int index = reader.getIndex(0, c, 0) + 1; 
     92      for (int c=0; c<cSize; c++) { 
     93        final int index = FormatTools.getIndex(stackOrder, 
     94          zSize, cSize, tSize, stackSize, 0, c, 0) + 1; 
    8795        final ColorModel cm = stack.getProcessor(index).getColorModel(); 
    8896 
     
    140148      } 
    141149 
    142       final boolean doComposite = mode != -1 && sizeC > 1 && sizeC <= 7; 
     150      final boolean doComposite = mode != -1 && cSize > 1 && cSize <= 7; 
    143151      if (doComposite) { 
    144152        CompositeImage compImage = new CompositeImage(imp, mode); 
     
    151159          imp.getProcessor().setColorModel(luts[0]); 
    152160        } 
    153         if (mode != -1 && sizeC > 1) { 
     161        if (mode != -1 && cSize > 1) { 
    154162          // NB: Cannot use CompositeImage with more than seven channels. 
    155163          BF.warn(options.isQuiet(), "Data has too many channels for " + 
Note: See TracChangeset for help on using the changeset viewer.