Changeset 4745


Ignore:
Timestamp:
01/14/09 16:48:38 (11 years ago)
Author:
curtis
Message:

Some tweaks for Steve:

  • Output probe details to the log, but only on mouse button release.
  • Add a button to clear the log.
  • Improved GUI layout.
Location:
trunk/components/slim-plotter/src/loci/slim
Files:
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/components/slim-plotter/src/loci/slim/ColorWidget.java

    r4440 r4745  
    7474  private static final Color INVALID_COLOR = Color.red.brighter(); 
    7575 
     76  private static final int PREF_HEIGHT = 120; 
     77 
    7678  // -- Static fields -- 
    7779 
     
    103105    widget = new ColorMapWidget(map); 
    104106    Dimension prefSize = widget.getPreferredSize(); 
    105     widget.setPreferredSize(new Dimension(prefSize.width, 0)); 
     107    widget.setPreferredSize(new Dimension(prefSize.width, PREF_HEIGHT)); 
    106108 
    107109    cOverride = new JCheckBox("", false); 
  • trunk/components/slim-plotter/src/loci/slim/SlimData.java

    r4521 r4745  
    306306    paramPane.setBorder(new EmptyBorder(10, 10, 10, 10)); 
    307307    paramDialog.setContentPane(paramPane); 
    308     paramPane.setLayout(new GridLayout(14, 3)); 
     308    paramPane.setLayout(new SpringLayout()); 
    309309    // rows 1-7 
    310310    wField = addRow(paramPane, "Image width", width, "pixels"); 
     
    368368    ok.addActionListener(this); 
    369369    paramPane.add(ok); 
     370    paramPane.add(new JLabel()); 
     371 
    370372    // size dialog 
     373    SpringUtilities.makeCompactGrid(paramPane, 14, 3, 3, 3, 3, 3); 
    371374    paramDialog.pack(); 
    372375    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 
  • trunk/components/slim-plotter/src/loci/slim/SlimPlotter.java

    r4697 r4745  
    140140  private JFrame masterWindow; 
    141141  private OutputConsole console; 
     142  private JButton clearLog; 
    142143 
    143144  // VisAD objects 
     
    161162    console.getTextArea().setColumns(54); 
    162163    console.getTextArea().setRows(10); 
     164    Font consoleFont = console.getTextArea().getFont().deriveFont(8f); 
     165    console.getTextArea().setFont(consoleFont); 
    163166 
    164167    PrintStream err = new PrintStream(console); 
     
    499502        new MouseBehaviorButtons(decayPlot, data.channels > 1, false); 
    500503 
     504      JPanel numbers = new JPanel(); 
     505      numbers.setBorder(new EmptyBorder(0, 0, 8, 8)); 
     506      numbers.setLayout(new SpringLayout()); 
     507 
     508      JLabel a1Label = new JLabel("a1"); 
     509      a1Label.setHorizontalAlignment(SwingConstants.RIGHT); 
     510      numbers.add(a1Label); 
     511      a1Param = new JTextField(9); 
     512      a1Param.setEditable(false); 
     513      numbers.add(a1Param); 
     514 
     515      JLabel t1Label = new JLabel("t1"); 
     516      t1Label.setHorizontalAlignment(SwingConstants.RIGHT); 
     517      numbers.add(t1Label); 
     518      t1Param = new JTextField(9); 
     519      t1Param.setEditable(false); 
     520      numbers.add(t1Param); 
     521 
     522      JLabel a2Label = new JLabel("a2"); 
     523      a2Label.setHorizontalAlignment(SwingConstants.RIGHT); 
     524      numbers.add(a2Label); 
     525      a2Param = new JTextField(9); 
     526      a2Param.setEditable(false); 
     527      numbers.add(a2Param); 
     528 
     529      JLabel t2Label = new JLabel("t2"); 
     530      t2Label.setHorizontalAlignment(SwingConstants.RIGHT); 
     531      numbers.add(t2Label); 
     532      t2Param = new JTextField(9); 
     533      t2Param.setEditable(false); 
     534      numbers.add(t2Param); 
     535 
     536      JLabel cLabel = new JLabel("c"); 
     537      cLabel.setHorizontalAlignment(SwingConstants.RIGHT); 
     538      numbers.add(cLabel); 
     539      cParam = new JTextField(9); 
     540      cParam.setEditable(false); 
     541      numbers.add(cParam); 
     542 
     543      JLabel chi2Label = new JLabel("chi^2"); 
     544      chi2Label.setHorizontalAlignment(SwingConstants.RIGHT); 
     545      numbers.add(chi2Label); 
     546      chi2 = new JTextField(9); 
     547      chi2.setEditable(false); 
     548      numbers.add(chi2); 
     549 
     550      SpringUtilities.makeCompactGrid(numbers, 6, 2, 0, 0, 4, 4); 
     551 
    501552      colorWidget = new ColorWidget(vMap, "Decay Color Mapping"); 
    502553 
     
    510561      zScaleValue.getDocument().addDocumentListener(this); 
    511562 
     563      clearLog = new JButton("Clear Log"); 
     564      clearLog.setToolTipText("Clears the output log above"); 
     565      clearLog.addActionListener(this); 
     566 
    512567      exportData = new JButton("Export"); 
    513568      exportData.setToolTipText( 
     
    516571 
    517572      setProgress(progress, 990); // estimate: 99% 
     573 
     574      JPanel logButtons = new JPanel(); 
     575      logButtons.setLayout(new BoxLayout(logButtons, BoxLayout.X_AXIS)); 
     576      logButtons.add(clearLog); 
     577      logButtons.add(exportData); 
     578 
     579      JPanel logPane = new JPanel(); 
     580      logPane.setLayout(new BoxLayout(logPane, BoxLayout.Y_AXIS)); 
     581      logPane.add(console.getWindow().getContentPane()); 
     582      logPane.add(logButtons); 
    518583 
    519584      JPanel scalePanel = new JPanel(); 
     
    523588      scalePanel.add(zScaleValue); 
    524589 
    525       JPanel numbers = new JPanel(); 
    526       numbers.setBorder(new TitledBorder("Numbers")); 
    527       numbers.setLayout(new GridLayout(5, 5)); 
    528  
    529       JLabel a1Label = new JLabel("a1 "); 
    530       a1Label.setHorizontalAlignment(SwingConstants.RIGHT); 
    531       numbers.add(a1Label); 
    532       a1Param = new JTextField(9); 
    533       a1Param.setEditable(false); 
    534       numbers.add(a1Param); 
    535       JLabel t1Label = new JLabel("t1 "); 
    536       t1Label.setHorizontalAlignment(SwingConstants.RIGHT); 
    537       numbers.add(t1Label); 
    538       t1Param = new JTextField(9); 
    539       t1Param.setEditable(false); 
    540       numbers.add(t1Param); 
    541       numbers.add(new JLabel(""));//TEMP 
    542  
    543       JLabel a2Label = new JLabel("a2 "); 
    544       a2Label.setHorizontalAlignment(SwingConstants.RIGHT); 
    545       numbers.add(a2Label); 
    546       a2Param = new JTextField(9); 
    547       a2Param.setEditable(false); 
    548       numbers.add(a2Param); 
    549       JLabel t2Label = new JLabel("t2 "); 
    550       t2Label.setHorizontalAlignment(SwingConstants.RIGHT); 
    551       numbers.add(t2Label); 
    552       t2Param = new JTextField(9); 
    553       t2Param.setEditable(false); 
    554       numbers.add(t2Param); 
    555       numbers.add(new JLabel(""));//TEMP 
    556  
    557       JLabel cLabel = new JLabel("c "); 
    558       cLabel.setHorizontalAlignment(SwingConstants.RIGHT); 
    559       numbers.add(cLabel); 
    560       cParam = new JTextField(9); 
    561       cParam.setEditable(false); 
    562       numbers.add(cParam); 
    563       JLabel chi2Label = new JLabel("chi^2 "); 
    564       chi2Label.setHorizontalAlignment(SwingConstants.RIGHT); 
    565       numbers.add(chi2Label); 
    566       chi2 = new JTextField(9); 
    567       chi2.setEditable(false); 
    568       numbers.add(chi2); 
    569       numbers.add(new JLabel(""));//TEMP 
    570  
    571       numbers.add(new JLabel(""));//TEMP 
    572       numbers.add(new JLabel(""));//TEMP 
    573       numbers.add(new JLabel(""));//TEMP 
    574       numbers.add(new JLabel(""));//TEMP 
    575       numbers.add(new JLabel(""));//TEMP 
    576  
    577       numbers.add(new JLabel(""));//TEMP 
    578       numbers.add(new JLabel(""));//TEMP 
    579       numbers.add(new JLabel(""));//TEMP 
    580       numbers.add(new JLabel(""));//TEMP 
    581       numbers.add(new JLabel(""));//TEMP 
    582  
    583590      JPanel miscRow = new JPanel(); 
    584591      miscRow.setLayout(new BoxLayout(miscRow, BoxLayout.X_AXIS)); 
    585592      miscRow.add(scalePanel); 
    586593      miscRow.add(Box.createHorizontalStrut(5)); 
    587       miscRow.add(exportData); 
    588  
    589       JPanel miscPanel = new JPanel(); 
    590       miscPanel.setLayout(new BoxLayout(miscPanel, BoxLayout.Y_AXIS)); 
    591       miscPanel.add(numbers); 
    592       miscPanel.add(miscRow); 
    593  
    594       JPanel stuff = new JPanel(); 
    595       stuff.setLayout(new BoxLayout(stuff, BoxLayout.X_AXIS)); 
    596       stuff.add(colorWidget); 
    597       stuff.add(miscPanel); 
    598594 
    599595      JPanel options = new JPanel(); 
    600596      options.setLayout(new BoxLayout(options, BoxLayout.Y_AXIS)); 
    601       options.add(mbButtons); 
    602       options.add(stuff); 
     597      options.add(numbers); 
     598      options.add(colorWidget); 
     599      options.add(miscRow); 
    603600      options.setBorder(new EmptyBorder(8, 5, 8, 5)); 
    604601 
    605       decayPane.add(options, BorderLayout.SOUTH); 
     602      JPanel decayWidgetsRow2 = new JPanel(); 
     603      decayWidgetsRow2.setLayout( 
     604        new BoxLayout(decayWidgetsRow2, BoxLayout.X_AXIS)); 
     605      decayWidgetsRow2.add(logPane); 
     606      decayWidgetsRow2.add(options); 
     607 
     608      JPanel decayWidgets = new JPanel(); 
     609      decayWidgets.setLayout(new BoxLayout(decayWidgets, BoxLayout.Y_AXIS)); 
     610      decayWidgets.add(mbButtons); 
     611      decayWidgets.add(decayWidgetsRow2); 
     612 
     613      decayPane.add(decayWidgets, BorderLayout.SOUTH); 
     614 
    606615      masterPane.add(decayPane, BorderLayout.CENTER); 
    607616 
    608       JPanel rightPanel = new JPanel() { 
     617      JPanel fixedPanel = new JPanel() { 
    609618        public Dimension getMaximumSize() { 
    610619          Dimension pref = getPreferredSize(); 
     
    613622        } 
    614623      }; 
    615       rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.Y_AXIS)); 
    616       rightPanel.add(twoDPane); 
    617       rightPanel.add(console.getWindow().getContentPane()); 
     624      fixedPanel.setLayout(new BoxLayout(fixedPanel, BoxLayout.Y_AXIS)); 
     625      fixedPanel.add(twoDPane); 
     626 
    618627      BreakawayPanel breakawayPanel = new BreakawayPanel(masterPane, 
    619628        "Intensity Data - " + file.getName(), false); 
     
    621630      breakawayPanel.setUpEnabled(false); 
    622631      breakawayPanel.setDownEnabled(false); 
    623       breakawayPanel.setContentPane(rightPanel); 
     632      breakawayPanel.setContentPane(fixedPanel); 
    624633 
    625634      setProgress(progress, 999); // estimate: 99.9% 
     
    628637      masterWindow.pack(); 
    629638      Dimension size = masterWindow.getSize(); 
    630       Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); 
    631       masterWindow.setLocation((screen.width - size.width) / 2, 
    632         (screen.height - size.height) / 2); 
     639      Dimension ss = Toolkit.getDefaultToolkit().getScreenSize(); 
     640      int maxWidth = ss.width - 16; 
     641      int maxHeight = ss.height - 48; 
     642      if (size.width > maxWidth) size.width = maxWidth; 
     643      if (size.height > maxHeight) size.height = maxHeight; 
     644      masterWindow.setSize(size); 
     645      masterWindow.setLocation((ss.width - size.width) / 2, 
     646        (ss.height - size.height) / 2); 
    633647      masterWindow.setVisible(true); 
    634648    } 
     
    756770          SlimData.TITLE, JOptionPane.ERROR_MESSAGE); 
    757771      } 
     772    } 
     773    else if (src == clearLog) { 
     774      console.getTextArea().setText(""); 
    758775    } 
    759776  } 
     
    926943      float[][][] fwhmLines = null; 
    927944      if (data.computeFWHMs) { 
    928         log("Calculating full width half maxes"); 
     945        if (doRescale) log("Calculating full width half maxes"); 
    929946        fwhmLines = new float[data.channels][3][2]; 
    930947        int grandTotal = 0; 
     
    977994          if (doLog) half = linearToLog(half); // adjust for log scale 
    978995          fwhmLines[c][2][0] = fwhmLines[c][2][1] = half; 
    979           String s = "#" + (c + 1); 
    980           while (s.length() < 3) s = " " + s; 
    981           float h1 = 1000 * fwhm1, h2 = 1000 * fwhm2; 
    982           log("\tChannel " + s + ": fwhm = " + (h2 - h1) + " ps"); 
    983           log("\t             counts = " + sumTotal); 
    984           log("\t             peak = " + maxSum); 
    985           log("\t             center = " + ((h1 + h2) / 2) + " ps"); 
    986           log("\t             range = [" + h1 + ", " + h2 + "] ps"); 
     996 
     997          // when doing an "expensive" plot, output FWHM values to log 
     998          if (doRescale) { 
     999            String s = "#" + (c + 1); 
     1000            while (s.length() < 3) s = " " + s; 
     1001            float h1 = 1000 * fwhm1, h2 = 1000 * fwhm2; 
     1002            log("\tChannel " + s + ": fwhm = " + (h2 - h1) + " ps"); 
     1003            log("\t             counts = " + sumTotal); 
     1004            log("\t             peak = " + maxSum); 
     1005            log("\t             center = " + ((h1 + h2) / 2) + " ps"); 
     1006            log("\t             range = [" + h1 + ", " + h2 + "] ps"); 
     1007          } 
    9871008          if (plotCanceled) break; 
    9881009          cc++; 
    9891010        } 
    990         log("\tTotal counts = " + grandTotal); 
     1011        if (doRescale) log("\tTotal counts = " + grandTotal); 
    9911012      } 
    9921013 
     
    11291150        sb.append("%)"); 
    11301151      } 
     1152      /* 
    11311153      if (tauMin == tauMin && tauMax == tauMax) { 
    11321154        sb.append("; "); 
     
    11591181        sb.append("]"); 
    11601182      } 
    1161       decayLabel.setText(sb.toString()); 
     1183      */ 
     1184      String decayText = sb.toString(); 
     1185      decayLabel.setText(decayText); 
    11621186 
    11631187      // update Numbers fields 
     
    11771201      cParam.setText("" + fitC[activeC]); 
    11781202      chi2.setText("" + fitChi2[activeC]); 
     1203 
     1204      // when doing an "expensive" plot, output probe values to log 
     1205      if (doProbe && doRescale) { 
     1206        log(decayText); 
     1207        log("\tchannel = " + activeC); 
     1208        log("\tx = " + twoDPane.getROIX()); 
     1209        log("\ty = " + twoDPane.getROIY()); 
     1210        log("\ta1 = " + a1 + "%"); 
     1211        log("\tt1 = " + t1); 
     1212        log("\ta2 = " + a2 + "%"); 
     1213        log("\tt2 = " + t2); 
     1214        log("\tc = " + fitC[activeC]); 
     1215        log("\tchi^2 = " + fitChi2[activeC]); 
     1216      } 
    11791217 
    11801218      try { 
  • trunk/components/slim-plotter/src/loci/slim/SpringUtilities.java

    r4359 r4745  
    44 
    55/* 
    6 LOCI Plugins for ImageJ: a collection of ImageJ plugins including the 
    7 Bio-Formats Importer, Bio-Formats Exporter, Data Browser, Stack Colorizer, 
    8 Stack Slicer, and OME plugins. Copyright (C) 2005-@year@ Melissa Linkert, 
    9 Curtis Rueden, Christopher Peterson and Philip Huettl. 
     6SLIM Plotter application and curve fitting library for 
     7combined spectral lifetime visualization and analysis. 
     8Copyright (C) 2006-@year@ Curtis Rueden and Eric Kjellman. 
    109 
    1110This program is free software; you can redistribute it and/or modify 
     
    5554 */ 
    5655 
    57 package loci.plugins.config; 
     56package loci.slim; 
    5857 
    5958import java.awt.*; 
     
    6766 * 
    6867 * <dl><dt><b>Source code:</b></dt> 
    69  * <dd><a href="https://skyking.microscopy.wisc.edu/trac/java/browser/trunk/components/loci-plugins/src/loci/plugins/config/SpringUtilities.java">Trac</a>, 
    70  * <a href="https://skyking.microscopy.wisc.edu/svn/java/trunk/components/loci-plugins/src/loci/plugins/config/SpringUtilities.java">SVN</a></dd></dl> 
     68 * <dd><a href="https://skyking.microscopy.wisc.edu/trac/java/browser/trunk/components/slim-plotter/src/loci/slim/SpringUtilities.java">Trac</a>, 
     69 * <a href="https://skyking.microscopy.wisc.edu/svn/java/trunk/components/slim-plotter/src/loci/slim/SpringUtilities.java">SVN</a></dd></dl> 
    7170 */ 
    7271public class SpringUtilities { 
Note: See TracChangeset for help on using the changeset viewer.