Ignore:
Timestamp:
06/03/10 20:25:11 (10 years ago)
Author:
curtis
Message:

Backport Bio-Formats and Importer bugfixes from trunk.

Location:
branches/4.2/components/loci-plugins/src
Files:
17 edited

Legend:

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

  • branches/4.2/components/loci-plugins/src/loci/plugins/BF.java

    r6322 r6477  
    5555    if (IJ.debugMode) IJ.log("LOCI: " + msg); 
    5656  } 
    57    
     57 
    5858  public static void status(boolean quiet, String msg) { 
    5959    if (quiet) return; 
    6060    IJ.showStatus(msg); 
    6161  } 
    62    
     62 
    6363  public static void warn(boolean quiet, String msg) { 
    6464    if (quiet) return; 
    6565    IJ.log("Warning: " + msg); 
    6666  } 
    67    
     67 
    6868  public static void progress(boolean quiet, int value, int max) { 
    6969    if (quiet) return; 
     
    8282    throws FormatException, IOException 
    8383  { 
    84     options.setQuiet(true);//TEMP 
    85     options.setWindowless(true);//TEMP 
     84    // TODO: Eliminate use of the ImporterPrompter. While no dialogs should 
     85    // appear due to the quiet and windowless flags, it would be cleaner to 
     86    // avoid piping everything through invisible GenericDialogs internally. 
     87    // 
     88    // However, we need to be sure all the Dialog classes are not performing 
     89    // any "side-effect" logic on the ImportProcess and/or ImporterOptions 
     90    // before we can make this change. 
     91    // 
     92    // Another downside might be that we could miss out on any other magic that 
     93    // ImageJ is performing (e.g., macro-related functionality), but further 
     94    // testing is warranted. 
     95 
     96    options.setQuiet(true); // NB: Only needed due to ImporterPrompter. 
     97    options.setWindowless(true); // NB: Only needed due to ImporterPrompter. 
     98 
    8699    ImportProcess process = new ImportProcess(options); 
    87     new ImporterPrompter(process);//TEMP 
     100 
     101    new ImporterPrompter(process); // NB: Could eliminate this (see above). 
     102 
    88103    if (!process.execute()) return null; 
    89104    ImagePlusReader reader = new ImagePlusReader(process); 
  • branches/4.2/components/loci-plugins/src/loci/plugins/config/ConfigWindow.java

    r6229 r6477  
    5858import javax.swing.SwingConstants; 
    5959import javax.swing.SwingUtilities; 
     60import javax.swing.WindowConstants; 
    6061import javax.swing.border.EmptyBorder; 
    6162import javax.swing.event.ListSelectionEvent; 
     
    103104  public ConfigWindow() { 
    104105    setTitle("LOCI Plugins Configuration"); 
    105     setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); 
     106    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); 
    106107 
    107108    // build UI 
     
    296297    log.println(); 
    297298    log.println("-- Formats --"); 
    298     FormatEntry[] formats = null; 
    299299    try { 
    300300      Class<?> irClass = Class.forName("loci.formats.ImageReader"); 
     
    316316 
    317317    // enumerate list of libraries 
    318     final String libCore = "Core library"; 
    319     final String libNative = "Native library"; 
    320     final String libPlugin = "ImageJ plugin"; 
    321     final String libJava = "Java library"; 
    322318 
    323319    String javaVersion = System.getProperty("java.version") + 
     
    379375 
    380376    HashMap<String, String> versions = new HashMap<String, String>(); 
    381     if (javaVersion != null) versions.put("javaVersion", javaVersion); 
    382     if (bfVersion != null) versions.put("bfVersion", bfVersion); 
     377    versions.put("javaVersion", javaVersion); 
     378    versions.put("bfVersion", bfVersion); 
    383379    if (qtVersion != null) versions.put("qtVersion", qtVersion); 
    384380    if (clibIIOVersion != null) versions.put("clibIIOVersion", clibIIOVersion); 
  • branches/4.2/components/loci-plugins/src/loci/plugins/in/ImagePlusReader.java

    r6343 r6477  
    126126  } 
    127127 
    128   // -- Helper methods -- 
     128  // -- Helper methods - image reading -- 
    129129 
    130130  private List<ImagePlus> readImages() 
     
    140140 
    141141    if (options.isVirtual()) { 
     142      // set virtual stack's reference count to match # of image windows 
     143      // in this case, these is one window per enabled image series 
     144      // when all image windows are closed, the Bio-Formats reader is closed 
    142145      int totalSeries = 0; 
    143146      for (int s=0; s<reader.getSeriesCount(); s++) { 
     
    147150    } 
    148151 
     152    // read in each image series 
    149153    for (int s=0; s<reader.getSeriesCount(); s++) { 
    150154      if (!options.isSeriesOn(s)) continue; 
     
    188192 
    189193    if (options.isVirtual()) { 
     194      // CTR FIXME - clean up this part 
    190195      boolean doMerge = false; //options.isMergeChannels(); 
    191196      boolean doColorize = false; //options.isColorize(); 
     
    293298  } 
    294299 
     300  // -- Helper methods - concatenation -- 
     301 
    295302  private List<ImagePlus> concatenate(List<ImagePlus> imps) { 
    296303    final ImporterOptions options = process.getOptions(); 
     
    299306  } 
    300307 
     308  // -- Helper methods - colorization -- 
     309 
    301310  private List<ImagePlus> applyColors(List<ImagePlus> imps) { 
    302311    final ImporterOptions options = process.getOptions(); 
    303312 
    304     // CTR FIXME - problems with single channel data 
    305     // CTR FIXME - problems with sizeC > 7 
    306313    // CTR FIXME - problems with default color mode 
    307314    int mode = -1; 
    308     if (options.isColorModeComposite()) mode = CompositeImage.COMPOSITE; 
     315    int sizeC = process.getReader().getSizeC(); 
     316    if (sizeC == 1) { 
     317      // NB: Cannot use CompositeImage for single-channel images. 
     318      // CTR FIXME finish sizeC==1 case 
     319      loci.plugins.BF.warn(options.isQuiet(), "sizeC = 1");//TEMP 
     320    } 
     321    else if (sizeC > 7) { 
     322      // NB: Cannot use CompositeImage when there are more than seven channels. 
     323      // CTR FIXME finish sizeC>7 case 
     324      loci.plugins.BF.warn(options.isQuiet(), "sizeC > 7");//TEMP 
     325    } 
     326    else if (options.isColorModeComposite()) mode = CompositeImage.COMPOSITE; 
    309327    else if (options.isColorModeColorized()) mode = CompositeImage.COLOR; 
    310328    else if (options.isColorModeGrayscale()) mode = CompositeImage.GRAYSCALE; 
     
    325343  } 
    326344 
     345  private LUT[] makeLUTs(int series) { 
     346    final ImageProcessorReader reader = process.getReader(); 
     347    reader.setSeries(series); 
     348    LUT[] luts = new LUT[reader.getSizeC()]; 
     349    for (int c=0; c<luts.length; c++) luts[c] = makeLUT(series, c); 
     350    return luts; 
     351  } 
     352 
     353  private LUT makeLUT(int series, int channel) { 
     354    final ImporterOptions options = process.getOptions(); 
     355    Color color = options.getCustomColor(series, channel); 
     356    if (color == null) color = options.getDefaultCustomColor(channel); 
     357    return makeLUT(color); 
     358  } 
     359 
     360  private LUT makeLUT(Color color) { 
     361    final int red = color.getRed(); 
     362    final int green = color.getGreen(); 
     363    final int blue = color.getBlue(); 
     364    final int lutLength = 256; 
     365    final int lutDivisor = lutLength - 1; 
     366    byte[] r = new byte[lutLength]; 
     367    byte[] g = new byte[lutLength]; 
     368    byte[] b = new byte[lutLength]; 
     369    for (int i=0; i<lutLength; i++) { 
     370      r[i] = (byte) (i * red / lutDivisor); 
     371      g[i] = (byte) (i * green / lutDivisor); 
     372      b[i] = (byte) (i * blue / lutDivisor); 
     373    } 
     374    return new LUT(r, g, b); 
     375  } 
     376 
     377  // -- Helper methods - window splitting -- 
     378 
    327379  private List<ImagePlus> splitDims(List<ImagePlus> imps) { 
    328380    final ImporterOptions options = process.getOptions(); 
     
    343395    return imps; 
    344396  } 
    345    
    346  
    347   private LUT[] makeLUTs(int series) { 
     397 
     398  // -- Helper methods - timing -- 
     399 
     400  private long startTime, time; 
     401 
     402  private void startTiming() { 
     403    startTime = time = System.currentTimeMillis(); 
     404  } 
     405 
     406  private void updateTiming(int s, int i, int current, int total) { 
    348407    final ImageProcessorReader reader = process.getReader(); 
    349     reader.setSeries(series); 
    350     LUT[] luts = new LUT[reader.getSizeC()]; 
    351     for (int c=0; c<luts.length; c++) luts[c] = makeLUT(series, c); 
    352     return luts; 
    353   } 
    354    
    355   private LUT makeLUT(int series, int channel) { 
    356     final ImporterOptions options = process.getOptions(); 
    357     Color color = options.getCustomColor(series, channel); 
    358     if (color == null) color = options.getDefaultCustomColor(channel); 
    359     return makeLUT(color); 
    360   } 
    361    
    362   private LUT makeLUT(Color color) { 
    363     final int red = color.getRed(); 
    364     final int green = color.getGreen(); 
    365     final int blue = color.getBlue(); 
    366     final int lutLength = 256; 
    367     byte[] r = new byte[lutLength]; 
    368     byte[] g = new byte[lutLength]; 
    369     byte[] b = new byte[lutLength]; 
    370     for (int i=0; i<lutLength; i++) { 
    371       r[i] = (byte) (i * red / lutLength); 
    372       g[i] = (byte) (i * green / lutLength); 
    373       b[i] = (byte) (i * blue / lutLength); 
    374     } 
    375     return new LUT(r, g, b); 
    376   } 
    377      
     408 
     409    long clock = System.currentTimeMillis(); 
     410    if (clock - time >= 100) { 
     411      String sLabel = reader.getSeriesCount() > 1 ? 
     412        ("series " + (s + 1) + ", ") : ""; 
     413      String pLabel = "plane " + (i + 1) + "/" + total; 
     414      notifyListeners(new StatusEvent("Reading " + sLabel + pLabel)); 
     415      time = clock; 
     416    } 
     417    notifyListeners(new StatusEvent(current, total, null)); 
     418  } 
     419 
     420  private void finishTiming() { 
     421    final ImageProcessorReader reader = process.getReader(); 
     422 
     423    long endTime = System.currentTimeMillis(); 
     424    double elapsed = (endTime - startTime) / 1000.0; 
     425    if (reader.getImageCount() == 1) { 
     426      notifyListeners(new StatusEvent("Bio-Formats: " + elapsed + " seconds")); 
     427    } 
     428    else { 
     429      long average = (endTime - startTime) / reader.getImageCount(); 
     430      notifyListeners(new StatusEvent("Bio-Formats: " + 
     431        elapsed + " seconds (" + average + " ms per plane)")); 
     432    } 
     433  } 
     434 
     435  // -- Helper methods -- miscellaneous -- 
     436 
    378437  private FileInfo createFileInfo() { 
    379438    FileInfo fi = new FileInfo(); 
     
    461520    imp.setOpenAsHyperStack(true); 
    462521 
    463     if (options.isAutoscale()) { 
     522    // apply intensity scaling 
     523    int pixelType = reader.getPixelType(); 
     524    // always autoscale floating point image data 
     525    if (options.isAutoscale() || FormatTools.isFloatingPoint(pixelType)) { 
    464526      ImagePlusTools.adjustColorRange(imp, process.getMinMaxCalculator()); 
    465527    } 
    466     else if (!(imp.getProcessor() instanceof ColorProcessor)) { 
    467       // ImageJ may autoscale the images anyway, so we need to manually 
    468       // set the display range to the min/max values allowed for 
    469       // this pixel type 
    470       imp.setDisplayRange(0, Math.pow(2, imp.getBitDepth()) - 1); 
    471     } 
    472  
    473 //    IFormatReader r = options.getReader(); 
    474 //    boolean windowless = options.isWindowless(); 
    475  
    476  
    477     // NB: ImageJ 1.39+ is required for hyperstacks 
    478  
    479 //      boolean hyper = options.isViewHyperstack() || options.isViewBrowser(); 
    480 // 
    481 //      boolean splitC = options.isSplitChannels(); 
    482 //      boolean splitZ = options.isSplitFocalPlanes(); 
    483 //      boolean splitT = options.isSplitTimepoints(); 
    484 // 
    485 //      boolean customColorize = options.isCustomColorize(); 
    486 //      boolean browser = options.isViewBrowser(); 
    487 //      boolean virtual = options.isVirtual(); 
    488 // 
    489 //      if (options.isColorize() || customColorize) { 
    490 //        byte[][][] lut = 
    491 //          Colorizer.makeDefaultLut(imp.getNChannels(), customColorize ? -1 : 0); 
    492 //        imp = Colorizer.colorize(imp, true, stackOrder, lut, r.getSeries(), null, options.isViewHyperstack()); 
    493 //      } 
    494 //      else if (colorModels != null && !browser && !virtual) { 
    495 //        byte[][][] lut = new byte[colorModels.length][][]; 
    496 //        for (int channel=0; channel<lut.length; channel++) { 
    497 //          lut[channel] = new byte[3][256]; 
    498 //          colorModels[channel].getReds(lut[channel][0]); 
    499 //          colorModels[channel].getGreens(lut[channel][1]); 
    500 //          colorModels[channel].getBlues(lut[channel][2]); 
    501 //        } 
    502 //        imp = Colorizer.colorize(imp, true, 
    503 //          stackOrder, lut, r.getSeries(), null, hyper); 
    504 //      } 
    505 //    } 
     528    else { 
     529      // ImageJ may autoscale the images anyway, so we need to manually set 
     530      // the display range to the min/max values allowed for this pixel type 
     531      int bitDepth = reader.getBitsPerPixel(); 
     532      // NB: ImageJ does not directly support signed data (it is merely 
     533      // unsigned data shifted downward by half via a "calibration"), 
     534      // so the following min and max values also work for signed. 
     535      double min = 0; 
     536      double max = Math.pow(2, bitDepth) - 1; 
     537      imp.setDisplayRange(min, max); 
     538    } 
    506539 
    507540    return imp; 
     
    586619  } 
    587620 
    588   // -- Helper methods - timing -- 
    589  
    590   private long startTime, time; 
    591  
    592   private void startTiming() { 
    593     startTime = time = System.currentTimeMillis(); 
    594   } 
    595  
    596   private void updateTiming(int s, int i, int current, int total) { 
    597     final ImageProcessorReader reader = process.getReader(); 
    598  
    599     long clock = System.currentTimeMillis(); 
    600     if (clock - time >= 100) { 
    601       String sLabel = reader.getSeriesCount() > 1 ? 
    602         ("series " + (s + 1) + ", ") : ""; 
    603       String pLabel = "plane " + (i + 1) + "/" + total; 
    604       notifyListeners(new StatusEvent("Reading " + sLabel + pLabel)); 
    605       time = clock; 
    606     } 
    607     notifyListeners(new StatusEvent(current, total, null)); 
    608   } 
    609  
    610   private void finishTiming() { 
    611     final ImageProcessorReader reader = process.getReader(); 
    612  
    613     long endTime = System.currentTimeMillis(); 
    614     double elapsed = (endTime - startTime) / 1000.0; 
    615     if (reader.getImageCount() == 1) { 
    616       notifyListeners(new StatusEvent("Bio-Formats: " + elapsed + " seconds")); 
    617     } 
    618     else { 
    619       long average = (endTime - startTime) / reader.getImageCount(); 
    620       notifyListeners(new StatusEvent("Bio-Formats: " + 
    621         elapsed + " seconds (" + average + " ms per plane)")); 
    622     } 
    623   } 
    624  
    625621} 
  • branches/4.2/components/loci-plugins/src/loci/plugins/in/ImportProcess.java

    r6457 r6477  
    416416    r.setId(options.getId()); 
    417417 
    418     boolean fillIndexed; 
     418    final boolean fillIndexed; 
    419419    if (r.isIndexed()) { 
     420      final int bpp = FormatTools.getBytesPerPixel(r.getPixelType()); 
     421      final byte[][] lut8 = r.get8BitLookupTable(); 
     422      final boolean defaultColorMode = options.isColorModeDefault(); 
     423 
     424      // NB: ImageJ only supports 8-bit RGB color tables. 
     425      // In addition, we only keep the indices in default color mode. 
     426      final boolean keepColorTable = defaultColorMode && 
     427        bpp == 1 && lut8 != null && lut8.length >= 1 && lut8.length <= 3; 
     428 
    420429      if (r.isFalseColor()) { 
    421         // false color; never fill indices 
     430        // false color; never fill the indices 
    422431        fillIndexed = false; 
     432        if (!keepColorTable) { 
     433          // warn the user that we'll have to throw away the color table 
     434          BF.warn(options.isQuiet(), 
     435            "false color table will be lost: " + getIdName()); 
     436        } 
    423437      } 
    424438      else { 
    425         // true color; fill indices unless 8-bit RGB with default color mode 
    426         int bpp = FormatTools.getBytesPerPixel(r.getPixelType()); 
    427         byte[][] lut8 = r.get8BitLookupTable(); 
    428         boolean defaultColorMode = options.isColorModeDefault(); 
    429         fillIndexed = !defaultColorMode || bpp > 1 || lut8 == null || lut8[0].length > 3; 
     439        // true color; if we can't keep the color table, then fill the indices 
     440        fillIndexed = !keepColorTable; 
    430441      } 
    431442    } 
     
    433444    if (fillIndexed) { 
    434445      r = channelFiller = new ChannelFiller(r); 
    435       BF.warn(options.isQuiet(), "Index values will be lost"); 
     446      BF.warn(options.isQuiet(), "index values will be lost: " + getIdName()); 
    436447    } 
    437448 
  • branches/4.2/components/loci-plugins/src/loci/plugins/in/Importer.java

    r6341 r6477  
    113113    options.loadOptions(); 
    114114    options.parseArg(arg); 
     115    options.checkObsoleteOptions(); 
    115116    return options; 
    116117  } 
  • branches/4.2/components/loci-plugins/src/loci/plugins/in/ImporterOptions.java

    r6343 r6477  
    2525 
    2626package loci.plugins.in; 
     27 
     28import ij.Macro; 
    2729 
    2830import java.awt.Color; 
     
    191193  } 
    192194 
     195  /** Handles obsolete macro keys, for backward compatibility. */ 
     196  public void checkObsoleteOptions() { 
     197    String options = Macro.getOptions(); 
     198    boolean mergeChannels = checkKey(options, "merge_channels"); 
     199    boolean rgbColorize = checkKey(options, "rgb_colorize"); 
     200    boolean customColorize = checkKey(options, "custom_colorize"); 
     201    if (mergeChannels) setColorMode(COLOR_MODE_COMPOSITE); 
     202    else if (rgbColorize) setColorMode(COLOR_MODE_COLORIZED); 
     203    else if (customColorize) setColorMode(COLOR_MODE_CUSTOM); 
     204  } 
     205 
    193206  // -- ImporterOptions methods - base options accessors and mutators -- 
    194207 
     
    385398  public void setCEnd(int s, int value) { set(cEnd, s, value, -1); } 
    386399  public int getCStep(int s) { return get(cStep, s, 1); } 
    387   public void setCStep(int s, int value) { set(cStep, s, value, 1); } 
     400  public void setCStep(int s, int value) { 
     401    if (value <= 0) { 
     402      throw new IllegalArgumentException("Invalid C step: " + value); 
     403    } 
     404    set(cStep, s, value, 1); 
     405  } 
    388406 
    389407  public int getZBegin(int s) { return get(zBegin, s, 0); } 
     
    392410  public void setZEnd(int s, int value) { set(zEnd, s, value, -1); } 
    393411  public int getZStep(int s) { return get(zStep, s, 1); } 
    394   public void setZStep(int s, int value) { set(zStep, s, value, 1); } 
     412  public void setZStep(int s, int value) { 
     413    if (value <= 0) { 
     414      throw new IllegalArgumentException("Invalid Z step: " + value); 
     415    } 
     416    set(zStep, s, value, 1); 
     417  } 
    395418 
    396419  public int getTBegin(int s) { return get(tBegin, s, 0); } 
     
    399422  public void setTEnd(int s, int value) { set(tEnd, s, value, -1); } 
    400423  public int getTStep(int s) { return get(tStep, s, 1); } 
    401   public void setTStep(int s, int value) { set(tStep, s, value, 1); } 
     424  public void setTStep(int s, int value) { 
     425    if (value <= 0) { 
     426      throw new IllegalArgumentException("Invalid T step: " + value); 
     427    } 
     428    set(tStep, s, value, 1); 
     429  } 
    402430 
    403431  // crop options 
     
    423451  } 
    424452 
    425   // -- Helper methods - miscellaneous -- 
     453  // -- Helper methods -- 
    426454 
    427455  private <T extends Object> void set(List<T> list, 
     
    437465  } 
    438466 
     467  /** Tests whether the given boolean key is set in the specified options. */ 
     468  private boolean checkKey(String options, String key) { 
     469    if (options == null) return false; 
     470 
     471    // delete anything inside square brackets, for simplicity 
     472    while (true) { 
     473      int lIndex = options.indexOf("["); 
     474      if (lIndex < 0) break; 
     475      int rIndex = options.indexOf("]"); 
     476      if (rIndex < 0) rIndex = options.length() - 1; 
     477      options = options.substring(0, lIndex) + options.substring(rIndex + 1); 
     478    } 
     479 
     480    // split the options string 
     481    final String[] tokens = options.split(" "); 
     482 
     483    // search for a token matching the key 
     484    for (String token : tokens) { 
     485      if (token.equals(key)) return true; 
     486    } 
     487    return false; 
     488  } 
     489 
    439490} 
  • branches/4.2/components/loci-plugins/src/loci/plugins/in/MainDialog.java

    r6341 r6477  
    2525 
    2626package loci.plugins.in; 
     27 
     28import com.jgoodies.forms.builder.PanelBuilder; 
     29import com.jgoodies.forms.layout.CellConstraints; 
     30import com.jgoodies.forms.layout.FormLayout; 
    2731 
    2832import ij.gui.GenericDialog; 
     
    4852 
    4953import loci.plugins.util.WindowTools; 
    50  
    51 import com.jgoodies.forms.builder.PanelBuilder; 
    52 import com.jgoodies.forms.layout.CellConstraints; 
    53 import com.jgoodies.forms.layout.FormLayout; 
    5454 
    5555/** 
     
    102102    super(process); 
    103103  } 
    104    
     104 
    105105  // -- ImporterDialog methods -- 
    106106 
     
    109109    return !process.isWindowless(); 
    110110  } 
    111    
     111 
    112112  @Override 
    113113  protected GenericDialog constructDialog() { 
     
    136136    return gd; 
    137137  } 
    138    
     138 
    139139  @Override 
    140140  protected boolean harvestResults(GenericDialog gd) { 
     
    161161    return true; 
    162162  } 
    163    
     163 
    164164  // -- FocusListener methods -- 
    165165 
     
    256256    verifyOptions(null); 
    257257 
     258    // TODO: The info table and focus logic could be split into 
     259    // its own class, rather than being specific to this dialog. 
     260 
    258261    // associate information for each option 
    259262    infoTable = new HashMap<Component, String>(); 
     
    288291      // second column 
    289292      "10dlu, pref, " + 
    290             // third column 
     293      // third column 
    291294      "10dlu, fill:150dlu"; 
    292295 
     
    300303      "9dlu, pref, 3dlu, pref, 3dlu, pref, 3dlu, pref, 3dlu, pref"; 
    301304 
    302     // TODO: change "Use virtual stack" and "Record modifications to virtual 
     305    // TODO: Change "Use virtual stack" and "Record modifications to virtual 
    303306    // stack" checkboxes to "Stack type" choice with options: 
    304307    //   "Normal", "Virtual" or "Smart virtual" 
     
    526529    boolean splitEnabled = !isStackNone && !isStackBrowser && 
    527530      !isStackImage5D && !isStackView5D && !isVirtual; 
    528     // TODO: make splitting work with Data Browser & virtual stacks 
     531    // TODO: Make splitting work with Data Browser & virtual stacks. 
    529532 
    530533    // splitCBox 
  • branches/4.2/components/loci-plugins/src/loci/plugins/in/SeriesDialog.java

    r6326 r6477  
    2626package loci.plugins.in; 
    2727 
     28import com.jgoodies.forms.builder.PanelBuilder; 
     29import com.jgoodies.forms.layout.CellConstraints; 
     30import com.jgoodies.forms.layout.FormLayout; 
     31 
    2832import ij.gui.GenericDialog; 
    2933 
    3034import java.awt.Button; 
    3135import java.awt.Checkbox; 
     36import java.awt.Color; 
    3237import java.awt.Dimension; 
    3338import java.awt.GridBagConstraints; 
    3439import java.awt.GridBagLayout; 
    35 import java.awt.GridLayout; 
    3640import java.awt.Insets; 
    3741import java.awt.Panel; 
    3842import java.awt.event.ActionEvent; 
    3943import java.awt.event.ActionListener; 
    40 import java.awt.image.BufferedImage; 
    41 import java.io.IOException; 
    4244import java.util.StringTokenizer; 
    4345 
    4446import javax.swing.Box; 
    45 import javax.swing.ImageIcon; 
    46 import javax.swing.JLabel; 
    47  
    48 import loci.formats.FormatException; 
    49 import loci.formats.FormatTools; 
    50 import loci.formats.gui.AWTImageTools; 
     47import javax.swing.JPanel; 
     48 
    5149import loci.formats.gui.BufferedImageReader; 
    52 import loci.plugins.BF; 
    5350import loci.plugins.util.WindowTools; 
    5451 
     
    6562 
    6663  public static final int MAX_COMPONENTS = 256; 
     64  public static final int MAX_SERIES_THUMBS = 200; 
    6765 
    6866  // -- Fields -- 
     
    9290 
    9391        // default all series to false 
    94         int seriesCount = process.getSeriesCount(); 
     92        final int seriesCount = process.getSeriesCount(); 
    9593        for (int s=0; s<seriesCount; s++) options.setSeriesOn(s, false); 
    9694 
     
    117115    // call both before and after the dialog here... 
    118116 
     117    final int seriesCount = process.getSeriesCount(); 
     118 
     119    // NB: Load thumbnails only when series count is modest. 
     120    if (seriesCount < MAX_SERIES_THUMBS) { 
     121      // construct thumbnail reader 
     122      thumbReader = new BufferedImageReader(process.getReader()); 
     123 
     124      // set up the thumbnail panels 
     125      p = new Panel[seriesCount]; 
     126      for (int i=0; i<seriesCount; i++) { 
     127        thumbReader.setSeries(i); 
     128        int sx = thumbReader.getThumbSizeX() + 10; // a little extra padding 
     129        int sy = thumbReader.getThumbSizeY(); 
     130        p[i] = new Panel(); 
     131        p[i].add(Box.createRigidArea(new Dimension(sx, sy))); 
     132        if (options.isForceThumbnails()) { 
     133          // load thumbnail immediately 
     134          ThumbLoader.loadThumb(thumbReader, 
     135            i, p[i], options.isQuiet(), options.isAutoscale()); 
     136        } 
     137      } 
     138    } 
     139 
    119140    GenericDialog gd = new GenericDialog("Bio-Formats Series Options"); 
    120141 
    121     // set up the thumbnail panels 
    122     thumbReader = new BufferedImageReader(process.getReader()); 
    123     int seriesCount = thumbReader.getSeriesCount(); 
    124     p = new Panel[seriesCount]; 
    125     for (int i=0; i<seriesCount; i++) { 
    126       thumbReader.setSeries(i); 
    127       int sx = thumbReader.getThumbSizeX() + 10; // a little extra padding 
    128       int sy = thumbReader.getThumbSizeY(); 
    129       p[i] = new Panel(); 
    130       p[i].add(Box.createRigidArea(new Dimension(sx, sy))); 
    131       if (options.isForceThumbnails()) { 
    132         BF.status(options.isQuiet(), 
    133           "Reading thumbnail for series #" + (i + 1)); 
    134         int z = thumbReader.getSizeZ() / 2; 
    135         int t = thumbReader.getSizeT() / 2; 
    136         int ndx = thumbReader.getIndex(z, 0, t); 
    137         try { 
    138           BufferedImage img = thumbReader.openThumbImage(ndx); 
    139           boolean isFloat = thumbReader.getPixelType() != FormatTools.FLOAT; 
    140           if (options.isAutoscale() && isFloat) { 
    141             img = AWTImageTools.autoscale(img); 
    142           } 
    143           ImageIcon icon = new ImageIcon(img); 
    144           p[i].removeAll(); 
    145           p[i].add(new JLabel(icon)); 
    146         } 
    147         catch (FormatException exc) { } 
    148         catch (IOException exc) { } 
    149       } 
    150     } 
    151  
    152     // add the checkboxes 
    153  
    154     // we need to add the checkboxes in groups, to prevent an 
    155     // exception from being thrown if there are more than 512 series 
    156     // see https://skyking.microscopy.wisc.edu/trac/java/ticket/408 and 
    157     // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5107980 
    158  
    159     int nPanels = p.length / MAX_COMPONENTS; 
    160     if (nPanels * MAX_COMPONENTS < p.length) nPanels++; 
    161  
     142    // NB: We need to add the checkboxes in groups, to prevent an 
     143    // exception from being thrown if there are more than 512 series. 
     144    // See also: 
     145    //   https://skyking.microscopy.wisc.edu/trac/java/ticket/408 and 
     146    //   http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5107980 
     147 
     148    final int nGroups = (seriesCount + MAX_COMPONENTS - 1) / MAX_COMPONENTS; 
    162149    int nextSeries = 0; 
    163     for (int i=0; i<nPanels; i++) { 
    164       int nRows = i == nPanels - 1 ? p.length % MAX_COMPONENTS : MAX_COMPONENTS; 
    165       String[] labels = new String[nRows]; 
    166       boolean[] defaultValues = new boolean[nRows]; 
     150    for (int i=0; i<nGroups; i++) { 
     151      final int nRows = Math.min(MAX_COMPONENTS, seriesCount - nextSeries); 
     152      final String[] labels = new String[nRows]; 
     153      final boolean[] defaultValues = new boolean[nRows]; 
    167154      for (int row=0; row<nRows; row++) { 
    168155        labels[row] = process.getSeriesLabel(nextSeries); 
    169         defaultValues[row] = options.isSeriesOn(nextSeries++); 
     156        defaultValues[row] = options.isSeriesOn(nextSeries); 
     157        nextSeries++; 
    170158      } 
    171159      gd.addCheckboxGroup(nRows, 1, labels, defaultValues); 
    172160    } 
    173161 
     162    // extract checkboxes, for "Select All" and "Deselect All" functions 
    174163    boxes = WindowTools.getCheckboxes(gd).toArray(new Checkbox[0]); 
    175164 
    176     // remove components and re-add everything so that the thumbnails and 
    177     // checkboxes line up correctly 
    178  
    179     rebuildDialog(gd, nPanels); 
     165    // rebuild dialog so that the thumbnails and checkboxes line up correctly 
     166    rebuildDialog(gd, nGroups); 
    180167 
    181168    return gd; 
     
    185172  protected boolean displayDialog(GenericDialog gd) { 
    186173    ThumbLoader loader = null; 
    187     if (!options.isForceThumbnails()) { 
     174    if (thumbReader != null && !options.isForceThumbnails()) { 
    188175      // spawn background thumbnail loader 
    189176      loader = new ThumbLoader(thumbReader, p, gd, options.isAutoscale()); 
     
    196183  @Override 
    197184  protected boolean harvestResults(GenericDialog gd) { 
     185    final int seriesCount = process.getSeriesCount(); 
    198186    String seriesString = "["; 
    199     int seriesCount = process.getSeriesCount(); 
    200187    for (int i=0; i<seriesCount; i++) { 
    201188      boolean on = gd.getNextBoolean(); 
     
    232219  } 
    233220 
    234   private void rebuildDialog(GenericDialog gd, int nPanels) { 
    235     int seriesCount = process.getSeriesCount(); 
     221  private void rebuildDialog(GenericDialog gd, int buttonRow) { 
     222    // rebuild dialog using FormLayout to organize things more nicely 
     223 
     224    final String cols = p == null ? "pref" : "pref, 3dlu, pref"; 
     225 
     226    final StringBuilder sb = new StringBuilder("pref"); 
     227    for (int s=1; s<boxes.length; s++) sb.append(", 3dlu, pref"); 
     228    final String rows = sb.toString(); 
     229 
     230    final PanelBuilder builder = new PanelBuilder(new FormLayout(cols, rows)); 
     231    final CellConstraints cc = new CellConstraints(); 
     232 
     233    int row = 1; 
     234    for (int s=0; s<boxes.length; s++) { 
     235      builder.add(boxes[s], cc.xy(1, row)); 
     236      if (p != null) builder.add(p[s], cc.xy(3, row)); 
     237      row += 2; 
     238    } 
     239 
     240    final JPanel masterPanel = builder.getPanel(); 
    236241 
    237242    gd.removeAll(); 
    238  
    239     Panel masterPanel = new Panel(); 
    240     masterPanel.setLayout(new GridLayout(seriesCount, 2)); 
    241  
    242     for (int i=0; i<seriesCount; i++) { 
    243       masterPanel.add(boxes[i]); 
    244       masterPanel.add(p[i]); 
    245     } 
    246243 
    247244    GridBagLayout gdl = (GridBagLayout) gd.getLayout(); 
     
    250247    gbc.gridy = 0; 
    251248    gdl.setConstraints(masterPanel, gbc); 
     249 
    252250    gd.add(masterPanel); 
    253251 
    254252    WindowTools.addScrollBars(gd); 
     253    gd.setBackground(Color.white); // HACK: workaround for JPanel in a Dialog 
    255254 
    256255    // add Select All and Deselect All buttons 
     
    269268 
    270269    gbc.gridx = 2; 
    271     gbc.gridy = nPanels; 
     270    gbc.gridy = buttonRow; 
    272271    gbc.anchor = GridBagConstraints.EAST; 
    273272    gbc.insets = new Insets(15, 0, 0, 0); 
  • branches/4.2/components/loci-plugins/src/loci/plugins/in/SwapDialog.java

    r6273 r6477  
    2626package loci.plugins.in; 
    2727 
    28 import ij.IJ; 
    2928import ij.gui.GenericDialog; 
     29 
     30import java.awt.Choice; 
     31import java.awt.event.ItemEvent; 
     32import java.awt.event.ItemListener; 
     33import java.util.List; 
    3034 
    3135import loci.plugins.util.ImageProcessorReader; 
     
    3943 * <a href="https://skyking.microscopy.wisc.edu/svn/java/trunk/components/loci-plugins/src/loci/plugins/in/SwapDialog.java">SVN</a></dd></dl> 
    4044 */ 
    41 public class SwapDialog extends ImporterDialog { 
     45public class SwapDialog extends ImporterDialog implements ItemListener { 
     46 
     47  // -- Fields -- 
     48 
     49  private Choice zChoice, cChoice, tChoice; 
    4250 
    4351  // -- Constructor -- 
     
    4957 
    5058  // -- ImporterDialog methods -- 
    51    
     59 
    5260  @Override 
    5361  protected boolean needPrompt() { 
    5462    return !process.isWindowless() && options.isSwapDimensions(); 
    5563  } 
    56    
     64 
    5765  @Override 
    5866  protected GenericDialog constructDialog() { 
     
    7684      } 
    7785    } 
     86 
     87    List<Choice> choices = WindowTools.getChoices(gd); 
     88    zChoice = choices.get(0); 
     89    cChoice = choices.get(1); 
     90    tChoice = choices.get(2); 
     91    zChoice.addItemListener(this); 
     92    cChoice.addItemListener(this); 
     93    tChoice.addItemListener(this); 
     94 
    7895    WindowTools.addScrollBars(gd); 
    7996 
    8097    return gd; 
    8198  } 
    82    
     99 
    83100  @Override 
    84101  protected boolean harvestResults(GenericDialog gd) { 
     
    94111 
    95112      if (z.equals(t) || z.equals(c) || c.equals(t)) { 
    96         IJ.error("Invalid swapping options - each axis can be used only once."); 
    97         throw new IllegalStateException(); // CTR FIXME 
     113        // should never occur... ;-) 
     114        throw new IllegalStateException( 
     115          "Invalid swapping options - each axis can be used only once."); 
    98116      } 
    99117 
     
    112130  } 
    113131 
     132  // -- ItemListener methods -- 
     133 
     134  public void itemStateChanged(ItemEvent e) { 
     135    final Object src = e.getSource(); 
     136    final int zIndex = zChoice.getSelectedIndex(); 
     137    final int cIndex = cChoice.getSelectedIndex(); 
     138    final int tIndex = tChoice.getSelectedIndex(); 
     139    if (src == zChoice) { 
     140      if (zIndex == cIndex) cChoice.select(firstAvailable(zIndex, tIndex)); 
     141      else if (zIndex == tIndex) tChoice.select(firstAvailable(zIndex, cIndex)); 
     142    } 
     143    else if (src == cChoice) { 
     144      if (cIndex == zIndex) zChoice.select(firstAvailable(cIndex, tIndex)); 
     145      else if (cIndex == tIndex) tChoice.select(firstAvailable(zIndex, cIndex)); 
     146    } 
     147    else if (src == tChoice) { 
     148      if (tIndex == zIndex) zChoice.select(firstAvailable(cIndex, tIndex)); 
     149      else if (tIndex == cIndex) cChoice.select(firstAvailable(zIndex, tIndex)); 
     150    } 
     151  } 
     152 
     153  // -- Helper methods -- 
     154 
     155  private int firstAvailable(int... index) { 
     156    final int minValue = 0, maxValue = 2; 
     157    for (int v=minValue; v<=maxValue; v++) { 
     158      boolean taken = false; 
     159      for (int i : index) { 
     160        if (v == i) { 
     161          taken = true; 
     162          break; 
     163        } 
     164      } 
     165      if (!taken) return v; 
     166    } 
     167    return -1; 
     168  } 
     169 
    114170} 
  • branches/4.2/components/loci-plugins/src/loci/plugins/in/ThumbLoader.java

    r6341 r6477  
    4141import loci.formats.gui.BufferedImageReader; 
    4242import loci.plugins.BF; 
     43import loci.plugins.util.WindowTools; 
    4344 
    4445/** 
     
    100101  /** Does the work of loading the thumbnails. */ 
    101102  public void run() { 
     103    BF.status(false, "Gathering series information"); 
     104    int seriesCount = ir.getSeriesCount(); 
     105 
     106    // find image plane for each series and sort by size 
     107    SeriesInfo[] info = new SeriesInfo[seriesCount]; 
     108    for (int i=0; i<seriesCount; i++) { 
     109      if (stop) return; 
     110      ir.setSeries(i); 
     111      info[i] = new SeriesInfo(i, ir.getSizeX() * ir.getSizeY()); 
     112    } 
     113    if (stop) return; 
     114    Arrays.sort(info); 
     115 
     116    // open each thumbnail, fastest/smallest first 
     117    for (int i=0; i<seriesCount; i++) { 
     118      if (stop) return; 
     119      final int ii = info[i].index; 
     120      loadThumb(ir, ii, p[ii], false, scale); 
     121      if (dialog != null) dialog.validate(); 
     122    } 
     123  } 
     124 
     125  // -- Helper methods -- 
     126 
     127  public static void loadThumb(BufferedImageReader thumbReader, 
     128    int series, Panel panel, boolean quiet, boolean autoscale) 
     129  { 
     130    BF.status(quiet, "Reading thumbnail for series #" + (series + 1)); 
     131    thumbReader.setSeries(series); 
     132    // open middle image thumbnail 
     133    int z = thumbReader.getSizeZ() / 2; 
     134    int t = thumbReader.getSizeT() / 2; 
     135    int ndx = thumbReader.getIndex(z, 0, t); 
     136    Exception exc = null; 
    102137    try { 
    103       BF.status(false, "Gathering series information"); 
    104       int seriesCount = ir.getSeriesCount(); 
    105  
    106       // find image plane for each series and sort by size 
    107       SeriesInfo[] info = new SeriesInfo[seriesCount]; 
    108       for (int i=0; i<seriesCount; i++) { 
    109         if (stop) return; 
    110         ir.setSeries(i); 
    111         info[i] = new SeriesInfo(i, ir.getSizeX() * ir.getSizeY()); 
    112       } 
    113       if (stop) return; 
    114       Arrays.sort(info); 
    115  
    116       // open each thumbnail, fastest/smallest first 
    117       for (int i=0; i<seriesCount; i++) { 
    118         if (stop) return; 
    119         final int ii = info[i].index; 
    120         BF.status(false, "Reading thumbnail for series #" + (ii + 1)); 
    121         ir.setSeries(ii); 
    122         // open middle image thumbnail 
    123         int z = ir.getSizeZ() / 2; 
    124         int t = ir.getSizeT() / 2; 
    125         int ndx = ir.getIndex(z, 0, t); 
    126         BufferedImage thumb = ir.openThumbImage(ndx); 
    127         if (scale && ir.getPixelType() != FormatTools.FLOAT) { 
    128           thumb = AWTImageTools.autoscale(thumb); 
    129         } 
    130         ImageIcon icon = new ImageIcon(thumb); 
    131         p[ii].removeAll(); 
    132         p[ii].add(new JLabel(icon)); 
    133         if (dialog != null) dialog.validate(); 
    134       } 
     138      BufferedImage thumb = thumbReader.openThumbImage(ndx); 
     139      boolean notFloat = thumbReader.getPixelType() != FormatTools.FLOAT; 
     140      if (autoscale && notFloat) thumb = AWTImageTools.autoscale(thumb); 
     141      ImageIcon icon = new ImageIcon(thumb); 
     142      panel.removeAll(); 
     143      panel.add(new JLabel(icon)); 
    135144    } 
    136     catch (IOException exc) { 
    137       exc.printStackTrace(); 
    138     } 
    139     catch (FormatException exc) { 
    140       exc.printStackTrace(); 
     145    catch (FormatException e) { exc = e; } 
     146    catch (IOException e) { exc = e; } 
     147    if (exc != null) { 
     148      WindowTools.reportException(exc, quiet, 
     149        "Error loading thumbnail for series #" + (series + 1)); 
    141150    } 
    142151  } 
  • branches/4.2/components/loci-plugins/src/loci/plugins/macro/LociFunctions.java

    r6341 r6477  
    190190  } 
    191191 
     192  @SuppressWarnings("deprecation") 
    192193  public void setMetadataCollected(Boolean collect) { 
    193194    r.setMetadataCollected(collect.booleanValue()); 
    194195  } 
    195196 
     197  @SuppressWarnings("deprecation") 
    196198  public void isMetadataCollected(Boolean[] collect) { 
    197199    collect[0] = new Boolean(r.isMetadataCollected()); 
     
    334336        "Instructions on doing so will be printed to the Results window."); 
    335337 
    336       IJ.write("To gain access to more advanced features of Bio-Formats"); 
    337       IJ.write("from within a macro, put the following line at the"); 
    338       IJ.write("beginning of your macro:"); 
    339       IJ.write(""); 
    340       IJ.write("run(\"Bio-Formats Macro Extensions\");"); 
    341       IJ.write(""); 
    342       IJ.write("This will enable the following macro functions:"); 
    343       IJ.write(""); 
    344       IJ.write("-= Usable any time =-"); 
    345       IJ.write(""); 
    346       IJ.write("Ext.getFormat(id, format)"); 
    347       IJ.write("-- Retrieves the file format of the given id (filename)."); 
    348       IJ.write("Ext.setId(id)"); 
    349       IJ.write("-- Initializes the given id (filename)."); 
    350       IJ.write("Ext.isThisType(name, thisType)"); 
    351       IJ.write("-- True if Bio-Formats recognizes the given file as a"); 
    352       IJ.write("-- supported image file format; if necessary, will "); 
    353       IJ.write("-- examine the file contents to decide for sure."); 
    354       IJ.write("Ext.isThisTypeFast(name, thisType)"); 
    355       IJ.write("-- True if Bio-Formats recognizes the given filename as a"); 
    356       IJ.write("-- supported image file format; will decide based on file"); 
    357       IJ.write("-- extension only, without examining file contents."); 
    358       IJ.write("Ext.isMetadataComplete(complete)"); 
    359       IJ.write("-- True if Bio-Formats completely parses the current"); 
    360       IJ.write("-- dataset's file format. If this function returns false,"); 
    361       IJ.write("-- there are known limitations or missing features in how"); 
    362       IJ.write("-- Bio-Formats handles this file format."); 
    363       IJ.write("Ext.fileGroupOption(id, fileGroupOption)"); 
    364       IJ.write("-- Returns a code indicating the file grouping policy for"); 
    365       IJ.write("-- for the current dataset. Possible values are:"); 
    366       IJ.write("--   must, can, cannot, unknown"); 
    367       IJ.write(""); 
    368       IJ.write("-= Usable before initializing a file =-"); 
    369       IJ.write(""); 
    370       IJ.write("Ext.setNormalized(normalize)"); 
    371       IJ.write("-- Sets whether to normalize floating point data to [0-1]."); 
    372       IJ.write("Ext.isNormalized(normalize)"); 
    373       IJ.write("-- Gets whether float data is being normalized to [0-1]."); 
    374       IJ.write("Ext.setMetadataCollected(collect)"); 
    375       IJ.write("-- Sets whether Bio-Formats should extract metadata at all."); 
    376       IJ.write("Ext.isMetadataCollected(collect)"); 
    377       IJ.write("-- Gets whether Bio-Formats is supposed to extract metadata."); 
    378       IJ.write("Ext.setOriginalMetadataPopulated(populate)"); 
    379       IJ.write("-- Sets whether Bio-Formats should save proprietary metadata"); 
    380       IJ.write("-- to the OME metadata store as custom attributes."); 
    381       IJ.write("Ext.isOriginalMetadataPopulated(populate)"); 
    382       IJ.write("-- Sets whether Bio-Formats is saving proprietary metadata"); 
    383       IJ.write("-- to the OME metadata store as custom attributes."); 
    384       IJ.write("Ext.setGroupFiles(group)"); 
    385       IJ.write("-- For multi-file formats, sets whether to force grouping."); 
    386       IJ.write("Ext.isGroupFiles(group)"); 
    387       IJ.write("-- Gets whether grouping is forced for multi-file formats.."); 
    388       IJ.write("Ext.setMetadataFiltered(filter)"); 
    389       IJ.write("-- Sets whether to filter out ugly metadata from the table"); 
    390       IJ.write("-- (i.e., entries with unprintable characters, and extremely"); 
    391       IJ.write("-- long values)."); 
    392       IJ.write("Ext.isMetadataFiltered(filter)"); 
    393       IJ.write("-- Gets whether ugly metadata is being filtered out."); 
    394       IJ.write(""); 
    395       IJ.write("-== Usable after initializing a file ==-"); 
    396       IJ.write(""); 
    397       IJ.write("Ext.getSeriesCount(seriesCount)"); 
    398       IJ.write("-- Gets the number of image series in the active dataset."); 
    399       IJ.write("Ext.setSeries(seriesNum)"); 
    400       IJ.write("-- Sets the current series within the active dataset."); 
    401       IJ.write("Ext.getSeries(seriesNum)"); 
    402       IJ.write("-- Gets the current series within the active dataset."); 
    403       IJ.write("Ext.getUsedFileCount(count)"); 
    404       IJ.write("-- Gets the number of files that are part of this dataset."); 
    405       IJ.write("Ext.getUsedFile(i, used)"); 
    406       IJ.write("-- Gets the i'th filename part of this dataset."); 
    407       IJ.write("Ext.getCurrentFile(file)"); 
    408       IJ.write("-- Gets the base filename used to initialize this dataset."); 
    409       IJ.write("Ext.openImage(title, no)"); 
    410       IJ.write("-- Opens the no'th plane in a new window named 'title'."); 
    411       IJ.write("Ext.openImage(title, no, x, y, width, height)"); 
    412       IJ.write("-- Opens a subset of the no'th plane in a new window"); 
    413       IJ.write("-- named 'title'."); 
    414       IJ.write("Ext.close()"); 
    415       IJ.write("-- Closes the active dataset."); 
    416       IJ.write("Ext.closeFileOnly()"); 
    417       IJ.write("-- Closes open files, leaving the current dataset active."); 
    418       IJ.write(""); 
    419       IJ.write("-== Applying to the current series ==-"); 
    420       IJ.write(""); 
    421       IJ.write("Ext.getImageCount(imageCount)"); 
    422       IJ.write("-- Gets the total number of planes in the current dataset."); 
    423       IJ.write("Ext.getSizeX(sizeX)"); 
    424       IJ.write("-- Gets the width of each image plane in pixels."); 
    425       IJ.write("Ext.getSizeY(sizeY)"); 
    426       IJ.write("-- Gets the height of each image plane in pixels."); 
    427       IJ.write("Ext.getSizeZ(sizeZ)"); 
    428       IJ.write("-- Gets the number of focal planes in the dataset."); 
    429       IJ.write("Ext.getSizeC(sizeC)"); 
    430       IJ.write("-- Gets the number of channels in the dataset."); 
    431       IJ.write("Ext.getSizeT(sizeT)"); 
    432       IJ.write("-- Gets the number of time points in the dataset."); 
    433       IJ.write("Ext.getPixelType(pixelType)"); 
    434       IJ.write("-- Gets a code representing the pixel type of the image."); 
    435       IJ.write("-- Possible values include:"); 
    436       IJ.write("--   int8, uint8, int16, uint16, int32, uint32, float, double"); 
    437       IJ.write("Ext.getEffectiveSizeC(effectiveSizeC)"); 
    438       IJ.write("-- Gets the 'effective' number of channels, such that:"); 
    439       IJ.write("-- effectiveSizeC * sizeZ * sizeT == imageCount"); 
    440       IJ.write("Ext.getRGBChannelCount(rgbChannelCount)"); 
    441       IJ.write("-- Gets the number of channels per composite image plane:"); 
    442       IJ.write("-- sizeC / rgbChannelCount == effectiveSizeC"); 
    443       IJ.write("Ext.isIndexed(indexed)"); 
    444       IJ.write("-- Gets whether the image planes are stored as indexed color"); 
    445       IJ.write("-- (i.e., whether they have embedded LUTs)."); 
    446       IJ.write("Ext.getChannelDimCount(channelDimCount)"); 
    447       IJ.write("-- For highly multidimensional image data, the C dimension"); 
    448       IJ.write("-- may consist of multiple embedded 'sub' dimensions."); 
    449       IJ.write("-- This function returns the number of such dimensions."); 
    450       IJ.write("Ext.getChannelDimLength(i, channelDimLength)"); 
    451       IJ.write("-- Gets the length of the i'th embedded 'sub' dimension."); 
    452       IJ.write("Ext.getChannelDimType(i, channelDimType)"); 
    453       IJ.write("-- Gets a string label for the i'th embedded 'sub' channel."); 
    454       IJ.write("Ext.isLittleEndian(littleEndian)"); 
    455       IJ.write("-- For multi-byte pixel types, get the data's endianness."); 
    456       IJ.write("Ext.getDimensionOrder(dimOrder)"); 
    457       IJ.write("-- Gets a five-character string representing the dimensional"); 
    458       IJ.write("-- rasterization order within the dataset. Valid orders are:"); 
    459       IJ.write("--   XYCTZ, XYCZT, XYTCZ, XYTZC, XYZCT, XYZTC"); 
    460       IJ.write("-- In cases where the channels are interleaved (e.g., CXYTZ),"); 
    461       IJ.write("-- C will be the first dimension after X and Y (e.g., XYCTZ)"); 
    462       IJ.write("-- and the isInterleaved function will return true."); 
    463       IJ.write("Ext.isOrderCertain(orderCertain)"); 
    464       IJ.write("-- Gets whether the dimension order and sizes are known,"); 
    465       IJ.write("-- or merely guesses."); 
    466       IJ.write("Ext.isInterleaved(interleaved)"); 
    467       IJ.write("-- Gets whether or not the channels are interleaved."); 
    468       IJ.write("-- This function exists because X and Y must appear first"); 
    469       IJ.write("-- in the dimension order. For interleaved data, XYCTZ or"); 
    470       IJ.write("-- XYCZT is used, and this method returns true."); 
    471       IJ.write("Ext.isInterleavedSubC(subC, interleaved)"); 
    472       IJ.write("-- Gets whether the given 'sub' channel is interleaved."); 
    473       IJ.write("-- This method exists because some data with multiple"); 
    474       IJ.write("-- rasterized sub-dimensions within C have one sub-dimension"); 
    475       IJ.write("-- interleaved, and the other not -- e.g., the SDT reader"); 
    476       IJ.write("-- handles spectral-lifetime data with interleaved lifetime"); 
    477       IJ.write("-- bins and non-interleaved spectral channels."); 
    478       IJ.write("Ext.getIndex(z, c, t, index)"); 
    479       IJ.write("-- Gets the rasterized index corresponding to the given"); 
    480       IJ.write("-- Z, C and T coordinates, according to the dataset's"); 
    481       IJ.write("-- dimension order."); 
    482       IJ.write("Ext.getZCTCoords(index, z, c, t)"); 
    483       IJ.write("-- Gets the Z, C and T coordinates corresponding to the given"); 
    484       IJ.write("-- rasterized index value, according to the dataset's"); 
    485       IJ.write("-- dimension order."); 
    486       IJ.write("Ext.getMetadataValue(field, value)"); 
    487       IJ.write("-- Obtains the specified metadata field's value."); 
    488       IJ.write("Ext.getSeriesName(seriesName)"); 
    489       IJ.write("-- Obtains the name of the current series."); 
    490       IJ.write("Ext.getImageCreationDate(creationDate)"); 
    491       IJ.write("-- Obtains the creation date of the dataset"); 
    492       IJ.write("-- in ISO 8601 format."); 
    493       IJ.write("Ext.getPlaneTimingDeltaT(deltaT, no)"); 
    494       IJ.write("-- Obtains the time offset (seconds since the beginning "); 
    495       IJ.write("-- of the experiment) for the no'th plane, or NaN if none."); 
    496       IJ.write("Ext.getPlaneTimingExposureTime(exposureTime, no)"); 
    497       IJ.write("-- Obtains the exposure time (in seconds) for the no'th"); 
    498       IJ.write("-- plane, or NaN if none."); 
    499       IJ.write(""); 
    500       IJ.write("For more information, see the online Javadocs"); 
    501       IJ.write("for the loci.formats.IFormatReader and "); 
    502       IJ.write("loci.formats.meta.MetadataRetrieve interfaces:"); 
    503       IJ.write(URL_LOCI_SOFTWARE_JAVADOCS); 
     338      IJ.log("To gain access to more advanced features of Bio-Formats"); 
     339      IJ.log("from within a macro, put the following line at the"); 
     340      IJ.log("beginning of your macro:"); 
     341      IJ.log(""); 
     342      IJ.log("run(\"Bio-Formats Macro Extensions\");"); 
     343      IJ.log(""); 
     344      IJ.log("This will enable the following macro functions:"); 
     345      IJ.log(""); 
     346      IJ.log("-= Usable any time =-"); 
     347      IJ.log(""); 
     348      IJ.log("Ext.getFormat(id, format)"); 
     349      IJ.log("-- Retrieves the file format of the given id (filename)."); 
     350      IJ.log("Ext.setId(id)"); 
     351      IJ.log("-- Initializes the given id (filename)."); 
     352      IJ.log("Ext.isThisType(name, thisType)"); 
     353      IJ.log("-- True if Bio-Formats recognizes the given file as a"); 
     354      IJ.log("-- supported image file format; if necessary, will "); 
     355      IJ.log("-- examine the file contents to decide for sure."); 
     356      IJ.log("Ext.isThisTypeFast(name, thisType)"); 
     357      IJ.log("-- True if Bio-Formats recognizes the given filename as a"); 
     358      IJ.log("-- supported image file format; will decide based on file"); 
     359      IJ.log("-- extension only, without examining file contents."); 
     360      IJ.log("Ext.isMetadataComplete(complete)"); 
     361      IJ.log("-- True if Bio-Formats completely parses the current"); 
     362      IJ.log("-- dataset's file format. If this function returns false,"); 
     363      IJ.log("-- there are known limitations or missing features in how"); 
     364      IJ.log("-- Bio-Formats handles this file format."); 
     365      IJ.log("Ext.fileGroupOption(id, fileGroupOption)"); 
     366      IJ.log("-- Returns a code indicating the file grouping policy for"); 
     367      IJ.log("-- for the current dataset. Possible values are:"); 
     368      IJ.log("--   must, can, cannot, unknown"); 
     369      IJ.log(""); 
     370      IJ.log("-= Usable before initializing a file =-"); 
     371      IJ.log(""); 
     372      IJ.log("Ext.setNormalized(normalize)"); 
     373      IJ.log("-- Sets whether to normalize floating point data to [0-1]."); 
     374      IJ.log("Ext.isNormalized(normalize)"); 
     375      IJ.log("-- Gets whether float data is being normalized to [0-1]."); 
     376      IJ.log("Ext.setMetadataCollected(collect)"); 
     377      IJ.log("-- Sets whether Bio-Formats should extract metadata at all."); 
     378      IJ.log("Ext.isMetadataCollected(collect)"); 
     379      IJ.log("-- Gets whether Bio-Formats is supposed to extract metadata."); 
     380      IJ.log("Ext.setOriginalMetadataPopulated(populate)"); 
     381      IJ.log("-- Sets whether Bio-Formats should save proprietary metadata"); 
     382      IJ.log("-- to the OME metadata store as custom attributes."); 
     383      IJ.log("Ext.isOriginalMetadataPopulated(populate)"); 
     384      IJ.log("-- Sets whether Bio-Formats is saving proprietary metadata"); 
     385      IJ.log("-- to the OME metadata store as custom attributes."); 
     386      IJ.log("Ext.setGroupFiles(group)"); 
     387      IJ.log("-- For multi-file formats, sets whether to force grouping."); 
     388      IJ.log("Ext.isGroupFiles(group)"); 
     389      IJ.log("-- Gets whether grouping is forced for multi-file formats.."); 
     390      IJ.log("Ext.setMetadataFiltered(filter)"); 
     391      IJ.log("-- Sets whether to filter out ugly metadata from the table"); 
     392      IJ.log("-- (i.e., entries with unprintable characters, and extremely"); 
     393      IJ.log("-- long values)."); 
     394      IJ.log("Ext.isMetadataFiltered(filter)"); 
     395      IJ.log("-- Gets whether ugly metadata is being filtered out."); 
     396      IJ.log(""); 
     397      IJ.log("-== Usable after initializing a file ==-"); 
     398      IJ.log(""); 
     399      IJ.log("Ext.getSeriesCount(seriesCount)"); 
     400      IJ.log("-- Gets the number of image series in the active dataset."); 
     401      IJ.log("Ext.setSeries(seriesNum)"); 
     402      IJ.log("-- Sets the current series within the active dataset."); 
     403      IJ.log("Ext.getSeries(seriesNum)"); 
     404      IJ.log("-- Gets the current series within the active dataset."); 
     405      IJ.log("Ext.getUsedFileCount(count)"); 
     406      IJ.log("-- Gets the number of files that are part of this dataset."); 
     407      IJ.log("Ext.getUsedFile(i, used)"); 
     408      IJ.log("-- Gets the i'th filename part of this dataset."); 
     409      IJ.log("Ext.getCurrentFile(file)"); 
     410      IJ.log("-- Gets the base filename used to initialize this dataset."); 
     411      IJ.log("Ext.openImage(title, no)"); 
     412      IJ.log("-- Opens the no'th plane in a new window named 'title'."); 
     413      IJ.log("Ext.openImage(title, no, x, y, width, height)"); 
     414      IJ.log("-- Opens a subset of the no'th plane in a new window"); 
     415      IJ.log("-- named 'title'."); 
     416      IJ.log("Ext.close()"); 
     417      IJ.log("-- Closes the active dataset."); 
     418      IJ.log("Ext.closeFileOnly()"); 
     419      IJ.log("-- Closes open files, leaving the current dataset active."); 
     420      IJ.log(""); 
     421      IJ.log("-== Applying to the current series ==-"); 
     422      IJ.log(""); 
     423      IJ.log("Ext.getImageCount(imageCount)"); 
     424      IJ.log("-- Gets the total number of planes in the current dataset."); 
     425      IJ.log("Ext.getSizeX(sizeX)"); 
     426      IJ.log("-- Gets the width of each image plane in pixels."); 
     427      IJ.log("Ext.getSizeY(sizeY)"); 
     428      IJ.log("-- Gets the height of each image plane in pixels."); 
     429      IJ.log("Ext.getSizeZ(sizeZ)"); 
     430      IJ.log("-- Gets the number of focal planes in the dataset."); 
     431      IJ.log("Ext.getSizeC(sizeC)"); 
     432      IJ.log("-- Gets the number of channels in the dataset."); 
     433      IJ.log("Ext.getSizeT(sizeT)"); 
     434      IJ.log("-- Gets the number of time points in the dataset."); 
     435      IJ.log("Ext.getPixelType(pixelType)"); 
     436      IJ.log("-- Gets a code representing the pixel type of the image."); 
     437      IJ.log("-- Possible values include:"); 
     438      IJ.log("--   int8, uint8, int16, uint16, int32, uint32, float, double"); 
     439      IJ.log("Ext.getEffectiveSizeC(effectiveSizeC)"); 
     440      IJ.log("-- Gets the 'effective' number of channels, such that:"); 
     441      IJ.log("-- effectiveSizeC * sizeZ * sizeT == imageCount"); 
     442      IJ.log("Ext.getRGBChannelCount(rgbChannelCount)"); 
     443      IJ.log("-- Gets the number of channels per composite image plane:"); 
     444      IJ.log("-- sizeC / rgbChannelCount == effectiveSizeC"); 
     445      IJ.log("Ext.isIndexed(indexed)"); 
     446      IJ.log("-- Gets whether the image planes are stored as indexed color"); 
     447      IJ.log("-- (i.e., whether they have embedded LUTs)."); 
     448      IJ.log("Ext.getChannelDimCount(channelDimCount)"); 
     449      IJ.log("-- For highly multidimensional image data, the C dimension"); 
     450      IJ.log("-- may consist of multiple embedded 'sub' dimensions."); 
     451      IJ.log("-- This function returns the number of such dimensions."); 
     452      IJ.log("Ext.getChannelDimLength(i, channelDimLength)"); 
     453      IJ.log("-- Gets the length of the i'th embedded 'sub' dimension."); 
     454      IJ.log("Ext.getChannelDimType(i, channelDimType)"); 
     455      IJ.log("-- Gets a string label for the i'th embedded 'sub' channel."); 
     456      IJ.log("Ext.isLittleEndian(littleEndian)"); 
     457      IJ.log("-- For multi-byte pixel types, get the data's endianness."); 
     458      IJ.log("Ext.getDimensionOrder(dimOrder)"); 
     459      IJ.log("-- Gets a five-character string representing the dimensional"); 
     460      IJ.log("-- rasterization order within the dataset. Valid orders are:"); 
     461      IJ.log("--   XYCTZ, XYCZT, XYTCZ, XYTZC, XYZCT, XYZTC"); 
     462      IJ.log("-- In cases where the channels are interleaved (e.g., CXYTZ),"); 
     463      IJ.log("-- C will be the first dimension after X and Y (e.g., XYCTZ)"); 
     464      IJ.log("-- and the isInterleaved function will return true."); 
     465      IJ.log("Ext.isOrderCertain(orderCertain)"); 
     466      IJ.log("-- Gets whether the dimension order and sizes are known,"); 
     467      IJ.log("-- or merely guesses."); 
     468      IJ.log("Ext.isInterleaved(interleaved)"); 
     469      IJ.log("-- Gets whether or not the channels are interleaved."); 
     470      IJ.log("-- This function exists because X and Y must appear first"); 
     471      IJ.log("-- in the dimension order. For interleaved data, XYCTZ or"); 
     472      IJ.log("-- XYCZT is used, and this method returns true."); 
     473      IJ.log("Ext.isInterleavedSubC(subC, interleaved)"); 
     474      IJ.log("-- Gets whether the given 'sub' channel is interleaved."); 
     475      IJ.log("-- This method exists because some data with multiple"); 
     476      IJ.log("-- rasterized sub-dimensions within C have one sub-dimension"); 
     477      IJ.log("-- interleaved, and the other not -- e.g., the SDT reader"); 
     478      IJ.log("-- handles spectral-lifetime data with interleaved lifetime"); 
     479      IJ.log("-- bins and non-interleaved spectral channels."); 
     480      IJ.log("Ext.getIndex(z, c, t, index)"); 
     481      IJ.log("-- Gets the rasterized index corresponding to the given"); 
     482      IJ.log("-- Z, C and T coordinates, according to the dataset's"); 
     483      IJ.log("-- dimension order."); 
     484      IJ.log("Ext.getZCTCoords(index, z, c, t)"); 
     485      IJ.log("-- Gets the Z, C and T coordinates corresponding to the given"); 
     486      IJ.log("-- rasterized index value, according to the dataset's"); 
     487      IJ.log("-- dimension order."); 
     488      IJ.log("Ext.getMetadataValue(field, value)"); 
     489      IJ.log("-- Obtains the specified metadata field's value."); 
     490      IJ.log("Ext.getSeriesName(seriesName)"); 
     491      IJ.log("-- Obtains the name of the current series."); 
     492      IJ.log("Ext.getImageCreationDate(creationDate)"); 
     493      IJ.log("-- Obtains the creation date of the dataset"); 
     494      IJ.log("-- in ISO 8601 format."); 
     495      IJ.log("Ext.getPlaneTimingDeltaT(deltaT, no)"); 
     496      IJ.log("-- Obtains the time offset (seconds since the beginning "); 
     497      IJ.log("-- of the experiment) for the no'th plane, or NaN if none."); 
     498      IJ.log("Ext.getPlaneTimingExposureTime(exposureTime, no)"); 
     499      IJ.log("-- Obtains the exposure time (in seconds) for the no'th"); 
     500      IJ.log("-- plane, or NaN if none."); 
     501      IJ.log(""); 
     502      IJ.log("For more information, see the online Javadocs"); 
     503      IJ.log("for the loci.formats.IFormatReader and "); 
     504      IJ.log("loci.formats.meta.MetadataRetrieve interfaces:"); 
     505      IJ.log(URL_LOCI_SOFTWARE_JAVADOCS); 
    504506    } 
    505507  } 
  • branches/4.2/components/loci-plugins/src/loci/plugins/out/Exporter.java

    r6459 r6477  
    391391      w.setInterleaved(false); 
    392392 
     393      int no = 0; 
    393394      for (int i=start; i<end; i+=n) { 
    394395        if (doStack) { 
     
    458459          IJ.error("Pixel type not supported by this format."); 
    459460        } 
    460         else w.saveBytes(plane, i == end - n); 
     461        else w.saveBytes(no++, plane); 
    461462      } 
    462463      w.close(); 
  • branches/4.2/components/loci-plugins/src/loci/plugins/util/ImagePlusTools.java

    r6341 r6477  
    137137    if (td != null) tcal = td.floatValue(); 
    138138 
    139     boolean xcalMissing = Double.isNaN(xcal); 
    140     boolean ycalMissing = Double.isNaN(ycal); 
    141     boolean zcalMissing = Double.isNaN(zcal); 
    142     boolean tcalMissing = Double.isNaN(tcal); 
    143     if (xcalMissing || ycalMissing || zcalMissing || tcalMissing) { 
    144       // if the physical width or physical height are missing, assume that 
    145       // the width and height are equal 
    146       if (!xcalMissing) xcal = ycal; 
    147       if (!ycalMissing) ycal = xcal; 
    148  
     139    final boolean xcalPresent = !Double.isNaN(xcal); 
     140    final boolean ycalPresent = !Double.isNaN(ycal); 
     141    final boolean zcalPresent = !Double.isNaN(zcal); 
     142    final boolean tcalPresent = !Double.isNaN(tcal); 
     143 
     144    // if the physical width or physical height are missing, 
     145    // assume that the width and height are equal 
     146    if (xcalPresent && !ycalPresent) ycal = xcal; 
     147    else if (ycalPresent && !xcalPresent) xcal = ycal; 
     148 
     149    final boolean hasSpatial = xcalPresent || ycalPresent || zcalPresent; 
     150    final boolean hasCalibration = hasSpatial || ycalPresent; 
     151 
     152    if (hasCalibration) { 
     153      // set calibration only if at least one value is present 
    149154      Calibration cal = new Calibration(); 
    150       cal.setUnit("micron"); 
    151       cal.pixelWidth = xcal; 
    152       cal.pixelHeight = ycal; 
    153       cal.pixelDepth = zcal; 
    154       cal.frameInterval = tcal; 
     155      if (hasSpatial) cal.setUnit("micron"); 
     156      if (xcalPresent) cal.pixelWidth = xcal; 
     157      if (ycalPresent) cal.pixelHeight = ycal; 
     158      if (zcalPresent) cal.pixelDepth = zcal; 
     159      if (tcalPresent) cal.frameInterval = tcal; 
    155160      imp.setCalibration(cal); 
    156161    } 
  • branches/4.2/components/loci-plugins/src/loci/plugins/util/ImageProcessorReader.java

    r6265 r6477  
    9898    boolean first = true; 
    9999    while (true) { 
     100      // TODO: This is the wrong place to prompt for the LuraWave code. 
     101      // This logic should be moved to a higher, GUI-specific level. 
     102 
    100103      // read LuraWave license code, if available 
    101104      String code = LuraWave.initLicenseCode(); 
    102105      try { 
    103         b = openBytes(no, x, y, w, h);  
     106        b = openBytes(no, x, y, w, h); 
    104107        break; 
    105108      } 
     
    131134 
    132135    IndexColorModel cm = null; 
    133     if (isIndexed()) { 
    134       byte[][] byteTable = get8BitLookupTable(); 
    135       if (byteTable != null) { 
    136         cm = new IndexColorModel(8, byteTable[0].length, byteTable[0], 
    137           byteTable[1], byteTable[2]); 
    138       } 
    139       short[][] shortTable = get16BitLookupTable(); 
    140       if (shortTable != null) { 
    141         byteTable = new byte[3][256]; 
    142  
    143         for (int i=0; i<byteTable[0].length; i++) { 
    144           byteTable[0][i] = (byte) shortTable[0][i]; 
    145           byteTable[1][i] = (byte) shortTable[1][i]; 
    146           byteTable[2][i] = (byte) shortTable[2][i]; 
    147         } 
    148  
    149         cm = new IndexColorModel(8, byteTable[0].length, byteTable[0], 
    150           byteTable[1], byteTable[2]); 
    151       } 
    152     } 
     136    if (isIndexed()) cm = createIndexColorModel(); 
    153137 
    154138    // construct image processors 
     
    228212  } 
    229213 
     214  // -- Helper methods -- 
     215 
     216  private IndexColorModel createIndexColorModel() 
     217    throws FormatException, IOException 
     218  { 
     219    byte[][] byteTable = get8BitLookupTable(); 
     220    if (byteTable == null) byteTable = convertTo8Bit(get16BitLookupTable()); 
     221    if (byteTable == null) return null; 
     222    return new IndexColorModel(8, byteTable[0].length, 
     223      byteTable[0], byteTable[1], byteTable[2]); 
     224  } 
     225 
     226  private byte[][] convertTo8Bit(short[][] shortTable) { 
     227    if (shortTable == null) return null; 
     228    byte[][] byteTable = new byte[shortTable.length][256]; 
     229    for (int c=0; c<byteTable.length; c++) { 
     230      int len = Math.min(byteTable.length, shortTable[c].length); 
     231      for (int i=0; i<len; i++) byteTable[c][i] = (byte) shortTable[c][i]; 
     232    } 
     233    return byteTable; 
     234  } 
     235 
    230236} 
  • branches/4.2/components/loci-plugins/src/loci/plugins/util/RecordedImageProcessor.java

    r6341 r6477  
    325325  } 
    326326 
    327   public void drawDot2(int x, int y) { 
    328     record("drawDot2", new Object[] {new Integer(x), new Integer(y)}, 
    329       new Class[] {int.class, int.class}); 
    330     proc.drawDot2(x, y); 
    331   } 
    332  
    333327  public void drawLine(int x1, int y1, int x2, int y2) { 
    334328    record("drawLine", new Object[] {new Integer(x1), new Integer(y1), 
     
    698692    record("isInvertedLut"); 
    699693    return proc.isInvertedLut(); 
    700   } 
    701  
    702   public boolean isKillable() { 
    703     record("isKillable"); 
    704     return proc.isKillable(); 
    705694  } 
    706695 
     
    10861075  } 
    10871076 
    1088   public void translate(int xOffset, int yOffset, boolean eraseBackground) { 
    1089     record("translate", new Object[] {new Integer(xOffset), 
    1090       new Integer(yOffset), new Boolean(eraseBackground)}, new Class[] { 
    1091       int.class, int.class, boolean.class}); 
    1092     proc.translate(xOffset, yOffset, eraseBackground); 
     1077  public void translate(int xOffset, int yOffset) { 
     1078    record("translate", 
     1079      new Object[] {new Integer(xOffset), new Integer(yOffset)}, 
     1080      new Class[] {int.class, int.class}); 
     1081    proc.translate(xOffset, yOffset); 
    10931082  } 
    10941083 
     
    11021091    record("xor", new Integer(value), int.class); 
    11031092    proc.xor(value); 
     1093  } 
     1094   
     1095  // -- Deprecated methods -- 
     1096 
     1097  /** @deprecated */ 
     1098  public void drawDot2(int x, int y) { 
     1099    record("drawDot2", new Object[] {new Integer(x), new Integer(y)}, 
     1100      new Class[] {int.class, int.class}); 
     1101    proc.drawDot2(x, y); 
     1102  } 
     1103 
     1104  /** @deprecated */ 
     1105  public boolean isKillable() { 
     1106    record("isKillable"); 
     1107    return proc.isKillable(); 
    11041108  } 
    11051109 
  • branches/4.2/components/loci-plugins/src/loci/plugins/util/WindowTools.java

    r6322 r6477  
    3232import java.awt.BorderLayout; 
    3333import java.awt.Checkbox; 
     34import java.awt.Choice; 
    3435import java.awt.Component; 
    3536import java.awt.Container; 
     
    187188      String s = DebugTools.getStackTrace(t); 
    188189      StringTokenizer st = new StringTokenizer(s, "\n\r"); 
    189       while (st.hasMoreTokens()) IJ.write(st.nextToken()); 
     190      while (st.hasMoreTokens()) IJ.log(st.nextToken()); 
    190191    } 
    191192    if (msg != null) IJ.error("Bio-Formats Importer", msg); 
     
    202203  } 
    203204 
     205  @SuppressWarnings("unchecked") 
     206  public static List<Choice> getChoices(GenericDialog gd) { 
     207    return gd.getChoices(); 
     208  } 
     209 
    204210} 
Note: See TracChangeset for help on using the changeset viewer.