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;
}
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);
}
Aggregations