Ignore:
Timestamp:
06/11/10 10:43:11 (9 years ago)
Author:
melissa
Message:

Merged r6521 and a bunch of ImageJ plugin changes to 4.2.

Location:
branches/4.2/components/loci-plugins
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2/components/loci-plugins

  • branches/4.2/components/loci-plugins/src

    • Property svn:mergeinfo deleted
  • branches/4.2/components/loci-plugins/src/loci/plugins/Slicer.java

    • Property svn:mergeinfo deleted
  • branches/4.2/components/loci-plugins/src/loci/plugins/in/ImagePlusReader.java

    r6500 r6524  
    310310  private List<ImagePlus> applyColors(List<ImagePlus> imps) { 
    311311    final ImporterOptions options = process.getOptions(); 
    312  
    313     // CTR FIXME - problems with default color mode 
    314     int mode = -1; 
    315     boolean indexed = process.getReader().isIndexed(); 
    316     int sizeC = process.getReader().getSizeC(); 
    317     if (sizeC == 1) { 
    318       // NB: Cannot use CompositeImage for single-channel images. 
    319       // CTR FIXME finish sizeC==1 case 
    320       loci.plugins.BF.warn(options.isQuiet(), "sizeC = 1");//TEMP 
    321     } 
    322     else if (sizeC > 7) { 
    323       // NB: Cannot use CompositeImage when there are more than seven channels. 
    324       // CTR FIXME finish sizeC>7 case 
    325       loci.plugins.BF.warn(options.isQuiet(), "sizeC > 7");//TEMP 
    326     } 
    327     else if (options.isColorModeComposite()) mode = CompositeImage.COMPOSITE; 
    328     else if (options.isColorModeColorized()) mode = CompositeImage.COLOR; 
    329     else if (options.isColorModeGrayscale()) mode = CompositeImage.GRAYSCALE; 
    330     else if (options.isColorModeCustom()) mode = CompositeImage.COLOR; 
    331     else if (indexed && sizeC > 1) mode = CompositeImage.COLOR; 
    332  
    333     if (mode != -1) { 
    334       List<ImagePlus> compositeImps = new ArrayList<ImagePlus>(); 
    335       for (ImagePlus imp : imps) { 
     312    final ImageProcessorReader reader = process.getReader(); 
     313 
     314    for (int image=0; image<imps.size(); image++) { 
     315      ImagePlus imp = imps.get(image); 
     316      int series = (Integer) imp.getProperty("Series"); 
     317      reader.setSeries(series); 
     318 
     319      // CTR FIXME - problems with default color mode 
     320      int mode = -1; 
     321      boolean indexed = reader.isIndexed(); 
     322      int sizeC = reader.getEffectiveSizeC(); 
     323      if (sizeC == 1 && 
     324        (options.isColorModeColorized() || options.isColorModeCustom())) 
     325      { 
     326        LUT lut = makeLUT(options.getDefaultCustomColor(0)); 
     327        if (options.isColorModeCustom()) { 
     328          lut = makeLUT(series, 0); 
     329        } 
     330        imp.getProcessor().setColorModel(lut); 
     331      } 
     332      else if (sizeC > 7) { 
     333        // NB: Cannot use CompositeImage when there are more than 
     334        // seven channels. 
     335        // CTR FIXME finish sizeC>7 case 
     336        loci.plugins.BF.warn(options.isQuiet(), "sizeC > 7");//TEMP 
     337      } 
     338      else if (options.isColorModeComposite()) mode = CompositeImage.COMPOSITE; 
     339      else if (options.isColorModeColorized()) mode = CompositeImage.COLOR; 
     340      else if (options.isColorModeGrayscale()) mode = CompositeImage.GRAYSCALE; 
     341      else if (options.isColorModeCustom()) mode = CompositeImage.COLOR; 
     342      else if (indexed && sizeC > 1) mode = CompositeImage.COLOR; 
     343 
     344      if (mode != -1) { 
    336345        CompositeImage compImage = new CompositeImage(imp, mode); 
    337346        LUT[] luts = null; 
    338         int series = (Integer) imp.getProperty("Series"); 
    339347        if (options.isColorModeCustom()) luts = makeLUTs(series); 
    340348        else if (indexed) { 
     
    343351            byte[][] lut = null; 
    344352            try { 
    345               int index = process.getReader().getIndex(0, i, 0); 
    346               process.getReader().openBytes(index, 0, 0, 1, 1); 
    347               lut = process.getReader().get8BitLookupTable(); 
     353              int index = reader.getIndex(0, i, 0); 
     354              reader.openBytes(index, 0, 0, 1, 1); 
     355              lut = reader.get8BitLookupTable(); 
    348356            } 
    349357            catch (FormatException e) { } 
     
    359367        } 
    360368        if (luts != null) compImage.setLuts(luts); 
    361         compositeImps.add(compImage); 
    362       } 
    363       imps = compositeImps; 
     369        imps.set(image, compImage); 
     370      } 
    364371    } 
    365372    return imps; 
  • branches/4.2/components/loci-plugins/src/loci/plugins/in/ImporterOptions.java

    • Property svn:mergeinfo deleted
  • branches/4.2/components/loci-plugins/src/loci/plugins/util/ImagePlusTools.java

    r6477 r6524  
    184184    MinMaxCalculator minMaxCalc) 
    185185  { 
    186     double min = Double.MAX_VALUE; 
    187     double max = Double.MIN_VALUE; 
     186    double min = Double.POSITIVE_INFINITY; 
     187    double max = Double.NEGATIVE_INFINITY; 
    188188 
    189189    // try to grab min and max values from the MinMaxCalculator 
     
    207207 
    208208    // couldn't find min and max values; determine manually 
    209     if (min == Double.MAX_VALUE && max == Double.MIN_VALUE) { 
     209    if (min == Double.POSITIVE_INFINITY && max == Double.NEGATIVE_INFINITY) { 
    210210      ImageStack stack = imp.getStack(); 
    211211      for (int i=0; i<stack.getSize(); i++) { 
  • branches/4.2/components/loci-plugins/src/loci/plugins/util/ImageProcessorReader.java

    r6477 r6524  
    3131import ij.process.ShortProcessor; 
    3232 
     33import java.awt.image.ColorModel; 
    3334import java.awt.image.IndexColorModel; 
    3435import java.io.IOException; 
     
    128129    } 
    129130 
     131    // create a color model for this plane (null means default) 
     132    final ColorModel cm = createColorModel(); 
     133 
    130134    // convert byte array to appropriate primitive array type 
    131135    boolean isFloat = FormatTools.isFloatingPoint(type); 
    132136    boolean isLittle = isLittleEndian(); 
    133137    boolean isSigned = FormatTools.isSigned(type); 
    134  
    135     IndexColorModel cm = null; 
    136     if (isIndexed()) cm = createIndexColorModel(); 
    137138 
    138139    // construct image processors 
     
    214215  // -- Helper methods -- 
    215216 
    216   private IndexColorModel createIndexColorModel() 
    217     throws FormatException, IOException 
    218   { 
     217  private ColorModel createColorModel() throws FormatException, IOException { 
     218    // NB: If a color table is present, we might as well use it, 
     219    // regardless of the value of isIndexed. 
     220    //if (!isIndexed()) return null; 
     221 
    219222    byte[][] byteTable = get8BitLookupTable(); 
    220223    if (byteTable == null) byteTable = convertTo8Bit(get16BitLookupTable()); 
Note: See TracChangeset for help on using the changeset viewer.