use of uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog in project GDSC-SMLM by aherbert.
the class DarkTimeAnalysis method showDialog.
private boolean showDialog() {
final ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
gd.addHelp(HelpUrls.getUrl("dark-time-analysis"));
settings = Settings.load();
gd.addMessage("Compute the cumulative dark-time histogram");
ResultsManager.addInput(gd, settings.inputOption, InputSource.MEMORY);
gd.addChoice("Method", METHOD, METHOD[settings.method]);
gd.addSlider("Search_distance (nm)", 5, 150, settings.searchDistance);
gd.addNumericField("Max_dark_time (seconds)", settings.maxDarkTime, 2);
gd.addSlider("Percentile", 0, 100, settings.percentile);
gd.addSlider("Histogram_bins", -1, 100, settings.histogramBins);
gd.showDialog();
if (gd.wasCanceled()) {
return false;
}
settings.inputOption = gd.getNextChoice();
settings.method = gd.getNextChoiceIndex();
settings.searchDistance = gd.getNextNumber();
settings.maxDarkTime = gd.getNextNumber();
settings.percentile = gd.getNextNumber();
settings.histogramBins = (int) gd.getNextNumber();
settings.save();
// Check arguments
try {
ParameterUtils.isAboveZero("Search distance", settings.searchDistance);
ParameterUtils.isPositive("Percentile", settings.percentile);
} catch (final IllegalArgumentException ex) {
IJ.error(TITLE, ex.getMessage());
return false;
}
return true;
}
use of uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog in project GDSC-SMLM by aherbert.
the class DensityEstimator method showDialog.
private boolean showDialog() {
settings = Settings.load();
final ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
gd.addHelp(HelpUrls.getUrl("density-estimator"));
gd.addMessage(TextUtils.wrap("Compute local density using NxN squares around localisations. The border size " + "should reflect the extent of the PSF in pixels (N=2*border+1). All overlapping " + "PSFs are joined to an area and the density of localisations in each area is " + "computed.", 80));
ResultsManager.addInput(gd, settings.inputOption, InputSource.MEMORY);
gd.addSlider("Border", 0, 20, settings.border);
gd.addCheckbox("Include_singles", settings.includeSingles);
gd.showDialog();
if (gd.wasCanceled()) {
return false;
}
settings.inputOption = ResultsManager.getInputSource(gd);
settings.border = (int) gd.getNextNumber();
settings.includeSingles = gd.getNextBoolean();
settings.save();
return true;
}
use of uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog in project GDSC-SMLM by aherbert.
the class AstigmatismModelManager method run.
@Override
public void run(String arg) {
SmlmUsageTracker.recordPlugin(this.getClass(), arg);
String[] options = OPTIONS;
final AstigmatismModelSettings settings = AstigmatismModelSettingsHolder.getSettings();
if (settings.getAstigmatismModelResourcesCount() == 0) {
options = OPTIONS2;
}
pluginSettings = readAstigmatismModelManagerSettings();
final ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
gd.addChoice("Option", options, pluginSettings.getOption());
gd.addHelp(HelpUrls.getUrl("astigmatism-model-manager"));
gd.showDialog();
if (gd.wasCanceled()) {
return;
}
pluginSettings.setOption(gd.getNextChoiceIndex());
switch(pluginSettings.getOption()) {
case 5:
exportModel();
break;
case 4:
invertModel();
break;
case 3:
deleteModel();
break;
case 2:
viewModel();
break;
case 1:
importModel();
break;
default:
createModel();
}
writeAstigmatismModelManagerSettings(pluginSettings);
}
use of uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog in project GDSC-SMLM by aherbert.
the class AstigmatismModelManager method exportModel.
private void exportModel() {
final ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
final String[] models = listAstigmatismModels(false);
gd.addChoice("Model", models, pluginSettings.getSelected());
gd.addFilenameField("Filename", pluginSettings.getFilename());
gd.addHelp(HelpUrls.getUrl("astigmatism-model-manager-export"));
gd.showDialog();
if (gd.wasCanceled()) {
return;
}
final String name = gd.getNextChoice();
pluginSettings.setSelected(name);
pluginSettings.setFilename(gd.getNextString());
// Try and get the named resource
final AstigmatismModel model = AstigmatismModelSettingsHolder.getSettings().getAstigmatismModelResourcesMap().get(name);
if (model == null) {
IJ.error(TITLE, "Failed to find astigmatism model: " + name);
return;
}
if (!SettingsManager.toJson(model, new File(pluginSettings.getFilename()), 0)) {
IJ.error(TITLE, "Failed to export astigmatism model: " + name);
return;
}
ImageJUtils.log("Exported astigmatism model: %s to %s", name, pluginSettings.getFilename());
}
use of uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog in project GDSC-SMLM by aherbert.
the class AstigmatismModelManager method showFitDialog.
private boolean showFitDialog() {
guessScale();
final ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
gd.addMessage("Use Gaussian 2D PSF fitting to create an astigmatism z-model");
gd.addNumericField("nm_per_slice", pluginSettings.getNmPerSlice(), 0);
gd.addHelp(HelpUrls.getUrl("astigmatism-model-manager-create"));
gd.showDialog();
if (gd.wasCanceled()) {
return false;
}
pluginSettings.setNmPerSlice(gd.getNextNumber());
writeAstigmatismModelManagerSettings(pluginSettings);
// Check arguments
try {
ParameterUtils.isPositive("nm/slice", pluginSettings.getNmPerSlice());
} catch (final IllegalArgumentException ex) {
IJ.error(TITLE, ex.getMessage());
return false;
}
return true;
}
Aggregations