use of ij.gui.ExtendedGenericDialog in project GDSC-SMLM by aherbert.
the class TraceDiffusion method showTraceDialog.
private boolean showTraceDialog(ArrayList<MemoryPeakResults> allResults) {
ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
gd.addHelp(About.HELP_URL);
if (!multiMode)
ResultsManager.addInput(gd, inputOption, InputSource.MEMORY);
globalSettings = SettingsManager.loadSettings();
settings = globalSettings.getClusteringSettings();
gd.addNumericField("Distance_Threshold (nm)", settings.distanceThreshold, 0);
gd.addNumericField("Distance_Exclusion (nm)", settings.distanceExclusion, 0);
gd.addSlider("Min_trace_length", 2, 20, settings.minimumTraceLength);
gd.addCheckbox("Ignore_ends", settings.ignoreEnds);
gd.addCheckbox("Save_traces", settings.saveTraces);
gd.showDialog();
if (gd.wasCanceled() || !readTraceDialog(gd))
return false;
// Update the settings
SettingsManager.saveSettings(globalSettings);
// Load the results
if (!multiMode) {
MemoryPeakResults results = ResultsManager.loadInputResults(inputOption, true);
if (results == null || results.size() == 0) {
IJ.error(TITLE, "No results could be loaded");
IJ.showStatus("");
return false;
}
if (!checkCalibration(results))
return false;
allResults.add(results);
}
return true;
}
use of ij.gui.ExtendedGenericDialog in project GDSC-SMLM by aherbert.
the class PeakFit method getGain.
private boolean getGain() {
ExtendedGenericDialog gd = newWizardDialog("Enter the total gain.", "This is usually supplied with your camera certificate. The gain indicates how many Analogue-to-Digital-Units (ADUs) are recorded at the pixel for each photon registered on the sensor.", "The gain is usually expressed using the product of the EM-gain (if applicable), the camera gain and the sensor quantum efficiency.", "A value of 1 means no conversion to photons will occur.");
// TODO - Add a wizard to allow calculation of total gain from EM-gain, camera gain and QE
gd.addNumericField("Gain (ADU/photon)", calibration.getGain(), 2);
gd.addCheckbox("EM-CCD", calibration.isEmCCD());
gd.showDialog();
if (gd.wasCanceled())
return false;
calibration.setGain(Math.abs(gd.getNextNumber()));
calibration.setEmCCD(gd.getNextBoolean());
return true;
}
use of ij.gui.ExtendedGenericDialog in project GDSC-SMLM by aherbert.
the class ResequenceResults method showDialog.
private boolean showDialog() {
ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
gd.addHelp(About.HELP_URL);
gd.addMessage("Resequence the results in memory (assumed to be continuous from 1).\n" + "Describe the regular repeat of the original image:\n" + "Start = The first frame that contained the data\n" + "Block = The number of continuous frames containing data\n" + "Skip = The number of continuous frames to ignore before the next data\n \n" + "E.G. 2:9:1 = Data was imaged from frame 2 for 9 frames, 1 frame to ignore, then repeat.");
ResultsManager.addInput(gd, inputOption, InputSource.MEMORY);
gd.addNumericField("Start", start, 0);
gd.addNumericField("Block", block, 0);
gd.addNumericField("Skip", skip, 0);
gd.addCheckbox("Log_mapping", logMapping);
gd.showDialog();
if (gd.wasCanceled())
return false;
inputOption = ResultsManager.getInputSource(gd);
start = (int) gd.getNextNumber();
block = (int) gd.getNextNumber();
skip = (int) gd.getNextNumber();
logMapping = gd.getNextBoolean();
// Check arguments
try {
Parameters.isAboveZero("Start", start);
Parameters.isAboveZero("Block", block);
Parameters.isPositive("Skip", skip);
} catch (IllegalArgumentException e) {
IJ.error(TITLE, e.getMessage());
return false;
}
return true;
}
use of ij.gui.ExtendedGenericDialog in project GDSC-SMLM by aherbert.
the class FreeFilterResults method showDialog.
private boolean showDialog() {
ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
gd.addHelp(About.HELP_URL);
gd.addMessage("Select a dataset to filter");
ResultsManager.addInput(gd, inputOption, InputSource.MEMORY);
GlobalSettings gs = SettingsManager.loadSettings();
filterSettings = gs.getFilterSettings();
String text;
try {
text = XmlUtils.prettyPrintXml(filterSettings.freeFilter);
} catch (Exception e) {
text = filterSettings.freeFilter;
}
gd.addTextAreas(text, null, 20, 80);
gd.addCheckbox("Show_demo_filters", false);
if (Utils.isShowGenericDialog()) {
Checkbox cb = (Checkbox) gd.getCheckboxes().get(0);
cb.addItemListener(this);
}
gd.showDialog();
if (gd.wasCanceled())
return false;
inputOption = ResultsManager.getInputSource(gd);
filterSettings.freeFilter = gd.getNextText();
boolean demoFilters = gd.getNextBoolean();
if (demoFilters) {
logDemoFilters(TITLE);
return false;
}
return SettingsManager.saveSettings(gs);
}
use of ij.gui.ExtendedGenericDialog in project GDSC-SMLM by aherbert.
the class FreeFilterResults method run.
/*
* (non-)
*
* @see ij.plugin.PlugIn#run(java.lang.String)
*/
public void run(String arg) {
SMLMUsageTracker.recordPlugin(this.getClass(), arg);
if (MemoryPeakResults.isMemoryEmpty()) {
// Ask user if they want to show the demo filters
ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
gd.enableYesNoCancel();
gd.hideCancelButton();
gd.addMessage("No results in memory. Show the demo filters?");
gd.showDialog();
if (gd.wasOKed())
logDemoFilters(TITLE);
return;
}
if (!showDialog())
return;
results = ResultsManager.loadInputResults(inputOption, false);
if (results == null || results.size() == 0) {
IJ.error(TITLE, "No results could be loaded");
IJ.showStatus("");
return;
}
// Filter results
Filter filter = Filter.fromXML(filterSettings.freeFilter);
if (filter != null) {
MemoryPeakResults newResults = filter.filter(results);
if (newResults.size() > 0) {
newResults.setName(results.getName() + " Free Filtered");
MemoryPeakResults.addResults(newResults);
}
IJ.showStatus(String.format("Filtered %d results to %d", results.size(), newResults.size()));
} else {
IJ.showStatus("ERROR: Unable to create filter");
}
}
Aggregations