use of java.awt.TextArea in project GDSC-SMLM by aherbert.
the class BenchmarkFilterAnalysis method showScoreDialog.
private boolean showScoreDialog() {
GenericDialog gd = new GenericDialog(TITLE);
gd.addHelp(About.HELP_URL);
addSimulationData(gd);
// Get the last scored filter or default to the best filter
getScoreFilter();
gd.addSlider("Fail_count", 0, 20, scoreFailCount);
if (BenchmarkSpotFit.computeDoublets)
gd.addSlider("Residuals_threshold", 0.01, 1, scoreResidualsThreshold);
gd.addNumericField("Duplicate_distance", scoreDuplicateDistance, 2);
gd.addTextAreas(XmlUtils.convertQuotes(scoreFilter.toXML()), null, 6, 60);
gd.addCheckbox("Reset_filter", false);
//gd.addCheckbox("Show_table", showResultsTable);
gd.addCheckbox("Show_summary", showSummaryTable);
gd.addCheckbox("Clear_tables", clearTables);
//gd.addSlider("Summary_top_n", 0, 20, summaryTopN);
gd.addCheckbox("Save_best_filter", saveBestFilter);
gd.addCheckbox("Save_template", saveTemplate);
gd.addCheckbox("Calculate_sensitivity", calculateSensitivity);
gd.addSlider("Delta", 0.01, 1, delta);
if (!simulationParameters.fixedDepth)
gd.addCheckbox("Depth_recall_analysis", depthRecallAnalysis);
gd.addCheckbox("Score_analysis", scoreAnalysis);
gd.addChoice("Component_analysis", COMPONENT_ANALYSIS, COMPONENT_ANALYSIS[componentAnalysis]);
gd.addStringField("Title", resultsTitle, 20);
String[] labels = { "Show_TP", "Show_FP", "Show_FN" };
gd.addCheckboxGroup(1, 3, labels, new boolean[] { showTP, showFP, showFN });
// Dialog to have a reset checkbox. This reverts back to the default.
if (Utils.isShowGenericDialog()) {
final Checkbox cb = (Checkbox) (gd.getCheckboxes().get(0));
@SuppressWarnings("unchecked") final Vector<TextField> v = gd.getNumericFields();
final TextArea ta = gd.getTextArea1();
cb.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if (cb.getState()) {
scoreFilter = null;
getScoreFilter();
int i = 0;
v.get(i++).setText(Integer.toString(scoreFailCount));
if (BenchmarkSpotFit.computeDoublets)
v.get(i++).setText(Double.toString(scoreResidualsThreshold));
v.get(i++).setText(Double.toString(scoreDuplicateDistance));
ta.setText(XmlUtils.convertQuotes(scoreFilter.toXML()));
}
}
});
}
gd.showDialog();
if (gd.wasCanceled())
return false;
scoreFailCount = (int) Math.abs(gd.getNextNumber());
if (BenchmarkSpotFit.computeDoublets)
scoreResidualsThreshold = Math.abs(gd.getNextNumber());
scoreDuplicateDistance = Math.abs(gd.getNextNumber());
String xml = gd.getNextText();
try {
scoreFilter = (DirectFilter) DirectFilter.fromXML(xml);
} catch (Exception e) {
scoreFilter = null;
getScoreFilter();
}
boolean reset = gd.getNextBoolean();
if (reset) {
scoreFilter = null;
getScoreFilter();
}
//showResultsTable = gd.getNextBoolean();
showSummaryTable = gd.getNextBoolean();
clearTables = gd.getNextBoolean();
//summaryTopN = (int) Math.abs(gd.getNextNumber());
saveBestFilter = gd.getNextBoolean();
saveTemplate = gd.getNextBoolean();
calculateSensitivity = gd.getNextBoolean();
delta = gd.getNextNumber();
if (!simulationParameters.fixedDepth)
depthRecallAnalysis = gd.getNextBoolean();
scoreAnalysis = gd.getNextBoolean();
componentAnalysis = gd.getNextChoiceIndex();
resultsTitle = gd.getNextString();
showTP = gd.getNextBoolean();
showFP = gd.getNextBoolean();
showFN = gd.getNextBoolean();
if (gd.invalidNumber())
return false;
resultsPrefix = BenchmarkSpotFit.resultPrefix + "\t" + resultsTitle + "\t";
createResultsPrefix2(scoreFailCount, scoreResidualsThreshold, scoreDuplicateDistance);
// Check there is one output
if (!showSummaryTable && !calculateSensitivity && !saveBestFilter && !saveTemplate) {
IJ.error(TITLE, "No output selected");
return false;
}
// Check arguments
try {
Parameters.isAboveZero("Delta", delta);
Parameters.isBelow("Delta", delta, 1);
} catch (IllegalArgumentException e) {
IJ.error(TITLE, e.getMessage());
return false;
}
if (!selectTableColumns())
return false;
return true;
}
Aggregations