Search in sources :

Example 86 with GenericDialog

use of ij.gui.GenericDialog in project GDSC-SMLM by aherbert.

the class PCPALMMolecules method showManualTracingDialog.

private boolean showManualTracingDialog() {
    GenericDialog gd = new GenericDialog(TITLE);
    gd.addHelp(About.HELP_URL);
    gd.addMessage("Use distance and time thresholds to trace localisations into molecules.");
    gd.addNumericField("Distance (nm)", dThreshold, 0);
    gd.addNumericField("Time (seconds)", tThreshold, 2);
    gd.showDialog();
    if (gd.wasCanceled())
        return false;
    dThreshold = Math.abs(gd.getNextNumber());
    tThreshold = Math.abs(gd.getNextNumber());
    // Check arguments
    try {
        Parameters.isAboveZero("Distance threshold", dThreshold);
        Parameters.isAboveZero("Time threshold", tThreshold);
    } catch (IllegalArgumentException ex) {
        IJ.error(TITLE, ex.getMessage());
        return false;
    }
    return true;
}
Also used : ExtendedGenericDialog(ij.gui.ExtendedGenericDialog) GenericDialog(ij.gui.GenericDialog)

Example 87 with GenericDialog

use of ij.gui.GenericDialog in project GDSC-SMLM by aherbert.

the class ShowResultsHeader method run.

/*
	 * (non-Javadoc)
	 * 
	 * @see ij.plugin.PlugIn#run(java.lang.String)
	 */
public void run(String arg) {
    SMLMUsageTracker.recordPlugin(this.getClass(), arg);
    GenericDialog gd = new GenericDialog(TITLE);
    gd.addMessage("Show the results header in the ImageJ log.\n(Double-click the string field to open a file chooser.)");
    gd.addStringField("Filename", inputFilename, 30);
    gd.addCheckbox("Raw", raw);
    textConfigFile = (TextField) gd.getStringFields().get(0);
    textConfigFile.addMouseListener(this);
    gd.showDialog();
    if (gd.wasCanceled())
        return;
    inputFilename = gd.getNextString();
    raw = gd.getNextBoolean();
    Prefs.set(Constants.inputFilename, inputFilename);
    PeakResultsReader reader = new PeakResultsReader(inputFilename);
    String header = reader.getHeader();
    if (header == null) {
        IJ.error(TITLE, "No header found in file: " + inputFilename);
        return;
    }
    if (raw) {
        // The ImageJ TextPanel class correctly stores lines with tab characters.
        // However when it is drawn in ij.text.TextCanvas using java.awt.Graphics.drawChars(...) 
        // the instance of this class is sun.java2d.SunGraphics2D which omits '\t' chars.
        // This may be a problem specific to the Linux JRE.
        // TODO - Find out if this is a Linux specific bug.
        // Output the raw text. This preserves the tabs in the Cut/Copy commands.
        IJ.log(header);
        //IJ.log(header.replace("\t", "    "));
        return;
    }
    // Output what information we can extract
    boolean found = false;
    found |= show("Format", reader.getFormat().toString());
    found |= show("Name", reader.getName());
    found |= show("Bounds", reader.getBounds());
    found |= show("Calibration", reader.getCalibration());
    found |= show("Configuration", reader.getConfiguration());
    if (!found)
        IJ.error(TITLE, "No header information found in file: " + inputFilename);
}
Also used : GenericDialog(ij.gui.GenericDialog) PeakResultsReader(gdsc.smlm.results.PeakResultsReader)

Aggregations

GenericDialog (ij.gui.GenericDialog)87 NonBlockingGenericDialog (ij.gui.NonBlockingGenericDialog)12 ExtendedGenericDialog (ij.gui.ExtendedGenericDialog)10 GlobalSettings (gdsc.smlm.ij.settings.GlobalSettings)9 Checkbox (java.awt.Checkbox)9 Color (java.awt.Color)8 Component (java.awt.Component)8 GridBagConstraints (java.awt.GridBagConstraints)8 GridBagLayout (java.awt.GridBagLayout)8 Rectangle (java.awt.Rectangle)7 BasePoint (gdsc.core.match.BasePoint)6 FitConfiguration (gdsc.smlm.fitting.FitConfiguration)6 PeakResultPoint (gdsc.smlm.ij.plugins.ResultsMatchCalculator.PeakResultPoint)6 Calibration (gdsc.smlm.results.Calibration)6 ArrayList (java.util.ArrayList)6 PeakResult (gdsc.smlm.results.PeakResult)5 TextField (java.awt.TextField)5 File (java.io.File)5 Vector (java.util.Vector)5 FitEngineConfiguration (gdsc.smlm.engine.FitEngineConfiguration)4