use of uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog in project GDSC-SMLM by aherbert.
the class ClassificationMatchCalculator method showDialog.
private boolean showDialog() {
final ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
settings = Settings.load();
gd.addMessage("Compare the points in two results sets\nand compute the match statistics");
ResultsManager.addInput(gd, "Results1", settings.inputOption1, InputSource.MEMORY_CLUSTERED, InputSource.MEMORY_CATEGORY);
ResultsManager.addInput(gd, "Results2", settings.inputOption2, InputSource.MEMORY_CLUSTERED, InputSource.MEMORY_CATEGORY);
gd.addNumericField("Match_distance", settings.matchDistance, -2, 6, "px");
gd.addChoice("Use_id", ANALYSIS_OPTION, settings.useId.ordinal());
gd.addChoice("Use_category", ANALYSIS_OPTION, settings.useCategory.ordinal());
gd.addHelp(HelpUrls.getUrl("classification-match-calculator"));
gd.showDialog();
if (gd.wasCanceled()) {
return false;
}
settings.inputOption1 = gd.getNextChoice();
settings.inputOption2 = gd.getNextChoice();
settings.matchDistance = gd.getNextNumber();
settings.useId = ClassAnalysis.fromNumber(gd.getNextChoiceIndex());
settings.useCategory = ClassAnalysis.fromNumber(gd.getNextChoiceIndex());
settings.save();
if (settings.useId.ordinal() + settings.useCategory.ordinal() == 0) {
IJ.error(TITLE, "No classifications specified (id or category)");
return false;
}
// Check arguments
try {
ParameterUtils.isPositive("Match distance", settings.matchDistance);
} 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 AstigmatismModelManager method saveModel.
private boolean saveModel() {
final ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
gd.addMessage("Save the model");
gd.addCheckbox("Save_model", pluginSettings.getSaveModel());
gd.addStringField("Model_name", pluginSettings.getModelName());
gd.addMessage("Save the model width to this plugin's settings, e.g. to use\n" + "on another selected PSF when creating a model.");
gd.addCheckbox("Save_fit_width", pluginSettings.getSaveFitWidth());
gd.addHelp(HelpUrls.getUrl("astigmatism-model-manager-create"));
gd.showDialog();
if (gd.wasCanceled()) {
return false;
}
pluginSettings.setSaveModel(gd.getNextBoolean());
final String name = gd.getNextString();
pluginSettings.setSaveFitWidth(gd.getNextBoolean());
if (pluginSettings.getSaveFitWidth()) {
// Save the widths in the fit configuration
fitConfig.setInitialPeakStdDev0(parameters[P_S0X]);
fitConfig.setInitialPeakStdDev1(parameters[P_S0Y]);
pluginSettings.setPsf(fitConfig.getPsf());
}
writeAstigmatismModelManagerSettings(pluginSettings);
if (pluginSettings.getSaveModel()) {
final AstigmatismModel.Builder model = AstigmatismModel.newBuilder();
model.setGamma(parameters[P_GAMMA]);
model.setD(parameters[P_D]);
model.setS0X(parameters[P_S0X]);
model.setAx(parameters[P_AX]);
model.setBx(parameters[P_BX]);
model.setS0Y(parameters[P_S0Y]);
model.setAy(parameters[P_AY]);
model.setBy(parameters[P_BY]);
model.setZDistanceUnit(DistanceUnit.UM);
model.setSDistanceUnit(DistanceUnit.PIXEL);
model.setNmPerPixel(fitConfig.getCalibrationReader().getNmPerPixel());
model.setZ0(parameters[P_Z0]);
return save(name, model);
}
return true;
}
use of uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog in project GDSC-SMLM by aherbert.
the class PeakResultTableModelFrame method doResultsSave.
private void doResultsSave() {
final PeakResultTableModel model = getModel();
if (model == null || model.getRowCount() == 0) {
return;
}
final ExtendedGenericDialog gd = new ExtendedGenericDialog("Save Results", this);
if (TextUtils.isNullOrEmpty(saveName)) {
saveName = getTitle();
}
gd.addStringField("Results_set_name", saveName, 30);
gd.showDialog();
if (gd.wasCanceled()) {
return;
}
saveName = gd.getNextString();
if (TextUtils.isNullOrEmpty(saveName)) {
IJ.error("No results set name");
return;
}
final MemoryPeakResults results = model.toMemoryPeakResults();
results.setName(saveName);
MemoryPeakResults.addResults(results);
}
use of uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog in project GDSC-SMLM by aherbert.
the class TcPalmAnalysis method showAnalysisSettingsDialog.
/**
* Show a dialog to change the analysis settings.
*
* @param event the event
*/
private void showAnalysisSettingsDialog(ActionEvent event) {
final ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
gd.addCheckbox("Disable_overlap_check", settings.getDisableOverlapCheck());
gd.addCheckbox("Show_size_histogram", settings.getShowSizeHistogram());
gd.addCheckbox("Show_duration_histogram", settings.getShowDurationHistogram());
gd.addCheckbox("Show_area_histogram", settings.getShowAreaHistogram());
gd.addCheckbox("Show_density_histogram", settings.getShowDensityHistogram());
gd.addHelp(HelpUrls.getUrl("tc-palm-analysis"));
gd.showDialog();
if (gd.wasCanceled()) {
return;
}
settings.setDisableOverlapCheck(gd.getNextBoolean());
settings.setShowSizeHistogram(gd.getNextBoolean());
settings.setShowDurationHistogram(gd.getNextBoolean());
settings.setShowAreaHistogram(gd.getNextBoolean());
settings.setShowDensityHistogram(gd.getNextBoolean());
}
use of uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog in project GDSC-SMLM by aherbert.
the class TcPalmAnalysis method showDialog.
/**
* Show dialog.
*
* @return true, if successful
*/
private boolean showDialog() {
settings = SettingsManager.readTcPalmAnalysisSettings(0).toBuilder();
final ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
gd.addMessage("Analyse the time-correlated activation of traced data");
ResultsManager.addInput(gd, "Input", settings.getInputOption(), InputSource.MEMORY);
// Require results settings to use the standard ResultsManager image options
final ResultsSettings.Builder tmp = ResultsSettings.newBuilder();
tmp.setResultsImageSettings(settings.getResultsImageSettingsBuilder());
final int flags = ResultsManager.FLAG_NO_SECTION_HEADER | ResultsManager.FLAG_IMAGE_REMOVE_NONE;
ResultsManager.addImageResultsOptions(gd, tmp, flags);
gd.addHelp(HelpUrls.getUrl("tc-palm-analysis"));
gd.showDialog();
if (gd.wasCanceled()) {
return false;
}
settings.setInputOption(ResultsManager.getInputSource(gd));
final ResultsImageSettings.Builder newImgSettings = tmp.getResultsImageSettingsBuilder();
// Note: The initial none option was removed
newImgSettings.setImageTypeValue(gd.getNextChoiceIndex() + 1);
settings.setResultsImageSettings(newImgSettings);
SettingsManager.writeSettings(settings);
return true;
}
Aggregations