use of uk.ac.sussex.gdsc.core.ij.gui.NonBlockingExtendedGenericDialog in project GDSC-SMLM by aherbert.
the class TcPalmAnalysis method showAnalysisDialog.
/**
* Show analysis dialog.
*
* @return true, if successful
*/
private boolean showAnalysisDialog() {
final NonBlockingExtendedGenericDialog gd = new NonBlockingExtendedGenericDialog(TITLE);
gd.addMessage("Analyse the time-correlated activation of traced data");
gd.addCheckbox("ROI_intersects", settings.getIntersects());
minT = results.getMinFrame();
maxT = results.getMaxFrame();
// No need to check other end of the range as the dialog slider will clip to the range.
if (settings.getMinFrame() > maxT) {
settings.setMinFrame(minT);
}
if (settings.getMaxFrame() < minT) {
settings.setMaxFrame(maxT);
}
gd.addSlider("Min_frame", minT, maxT, settings.getMinFrame());
gd.addSlider("Max_frame", minT, maxT, settings.getMaxFrame());
gd.addCheckbox("Fixed_time_axis", settings.getFixedTimeAxis());
gd.addCheckbox("Time_in_seconds", settings.getTimeInSeconds());
darkTimeToleranceTextField = gd.addAndGetSlider("Dark_time_tolerance", 0, 100, settings.getDarkTimeTolerance());
minClusterSizeTextField = gd.addAndGetSlider("Min_cluster_size", 0, 100, settings.getMinClusterSize());
gd.addAndGetButton("Loop settings", this::showLoopSettingsDialog);
gd.addAndGetButton("Analysis settings", this::showAnalysisSettingsDialog);
gd.addAndGetButton("Analyse ROIs", this::analyseRois);
gd.addDialogListener(this::readDialog);
gd.hideCancelButton();
gd.setOKLabel("Close");
gd.showDialog();
if (gd.wasCanceled()) {
return false;
}
return true;
}
use of uk.ac.sussex.gdsc.core.ij.gui.NonBlockingExtendedGenericDialog in project GDSC-SMLM by aherbert.
the class PulseActivationAnalysis method showPulseAnalysisDialog.
private boolean showPulseAnalysisDialog() {
final NonBlockingExtendedGenericDialog gd = new NonBlockingExtendedGenericDialog(title);
gd.addMessage("Plot molecules activated after a pulse");
String[] correctionNames = null;
String[] assignmentNames = null;
if (settings.channels > 1) {
if (settings.channels == 2) {
gd.addNumericField("Crosstalk_21", settings.ct[Settings.C21], 3);
gd.addNumericField("Crosstalk_12", settings.ct[Settings.C12], 3);
} else {
for (int i = 0; i < Settings.ctNames.length; i++) {
gd.addNumericField("Crosstalk_" + Settings.ctNames[i], settings.ct[i], 3);
}
}
gd.addNumericField("Local_density_radius", settings.densityRadius, 0, 6, "nm");
gd.addSlider("Min_neighbours", 0, 15, settings.minNeighbours);
correctionNames = SettingsManager.getNames((Object[]) Settings.specificCorrection);
gd.addChoice("Crosstalk_correction", correctionNames, correctionNames[settings.specificCorrectionIndex]);
for (int c = 1; c <= settings.channels; c++) {
gd.addSlider("Crosstalk_correction_cutoff_C" + c + " (%)", 0, 100, settings.specificCorrectionCutoff[c - 1]);
}
assignmentNames = SettingsManager.getNames((Object[]) Settings.nonSpecificCorrection);
gd.addChoice("Nonspecific_assigment", assignmentNames, assignmentNames[settings.nonSpecificCorrectionIndex]);
gd.addSlider("Nonspecific_assignment_cutoff (%)", 0, 100, settings.nonSpecificCorrectionCutoff);
}
resultsSettingsBuilder = SettingsManager.readResultsSettings(0).toBuilder();
ResultsManager.addImageResultsOptions(gd, resultsSettingsBuilder, ResultsManager.FLAG_IMAGE_NO_LUT);
final Checkbox previewCheckBox = gd.addAndGetCheckbox("Preview", false);
final String buttonLabel = "Draw loop";
gd.addMessage("Click '" + buttonLabel + "' to draw the current ROIs in a loop view");
gd.addAndGetButton(buttonLabel, this::actionPerformed);
magnificationChoice = gd.addAndGetChoice("Magnification", Settings.magnifications, settings.magnification);
gd.addDialogListener(this::dialogItemChanged);
gd.addOptionCollectedListener(event -> addWork(previewCheckBox.getState()));
gd.addHelp(HelpUrls.getUrl(helpKey));
gd.showDialog();
if (gd.wasCanceled()) {
return false;
}
// The dialog was OK'd so run if work was staged in the workflow.
if (workflow.isStaged()) {
workflow.runStaged();
}
// Record options for a macro since the NonBlockingDialog does not
if (Recorder.record) {
if (settings.channels > 1) {
// Suppress null warnings
if (correctionNames == null || assignmentNames == null) {
throw new IllegalStateException();
}
if (settings.channels == 2) {
Recorder.recordOption("Crosstalk_21", Double.toString(settings.ct[Settings.C21]));
Recorder.recordOption("Crosstalk_12", Double.toString(settings.ct[Settings.C12]));
} else {
for (int i = 0; i < Settings.ctNames.length; i++) {
Recorder.recordOption("Crosstalk_" + Settings.ctNames[i], Double.toString(settings.ct[i]));
}
}
Recorder.recordOption("Local_density_radius", Double.toString(settings.densityRadius));
Recorder.recordOption("Min_neighbours", Integer.toString(settings.minNeighbours));
Recorder.recordOption("Crosstalk_correction", correctionNames[settings.specificCorrectionIndex]);
for (int c = 1; c <= settings.channels; c++) {
Recorder.recordOption("Crosstalk_correction_cutoff_C" + c, Double.toString(settings.specificCorrectionCutoff[c - 1]));
}
Recorder.recordOption("Nonspecific_assigment", assignmentNames[settings.nonSpecificCorrectionIndex]);
Recorder.recordOption("Nonspecific_assignment_cutoff (%)", Double.toString(settings.nonSpecificCorrectionCutoff));
}
final ResultsImageSettings s = resultsSettingsBuilder.getResultsImageSettings();
Recorder.recordOption("Image", SettingsManager.getResultsImageTypeNames()[s.getImageTypeValue()]);
if (s.getWeighted()) {
Recorder.recordOption("Weighted");
}
if (s.getEqualised()) {
Recorder.recordOption("Equalised");
}
Recorder.recordOption("Image_Precision", Double.toString(s.getAveragePrecision()));
Recorder.recordOption("Image_Size_mode", SettingsManager.getResultsImageSizeModeNames()[s.getImageSizeModeValue()]);
Recorder.recordOption("Image_Scale", Double.toString(s.getScale()));
Recorder.recordOption("Image_Size", Integer.toString(s.getImageSize()));
Recorder.recordOption("Image_Pixel_size", Double.toString(s.getPixelSize()));
}
SettingsManager.writeSettings(resultsSettingsBuilder);
return true;
}
use of uk.ac.sussex.gdsc.core.ij.gui.NonBlockingExtendedGenericDialog in project GDSC-SMLM by aherbert.
the class PsfCreator method showDialog.
private int showDialog() {
final NonBlockingExtendedGenericDialog gd = new NonBlockingExtendedGenericDialog(TITLE);
gd.addHelp(HelpUrls.getUrl("psf-creator"));
settings = SettingsManager.readPsfCreatorSettings(0).toBuilder();
guessScale();
gd.addMessage("Produces an average PSF using selected diffraction limited spots.");
gd.addChoice("Mode", MODE, settings.getMode());
gd.addSlider("Radius (px)", 3, MathUtils.max(10, imp.getWidth(), imp.getHeight()) / 2.0, settings.getRadius());
gd.addCheckbox("Interactive_mode", settings.getInteractiveMode());
final InteractiveInputListener l = new InteractiveInputListener();
gd.addDialogListener(l);
gd.showDialog();
// Clear the bounding box
if (plotRadius != -1) {
imp.setOverlay(null);
}
SettingsManager.writeSettings(settings);
if (gd.wasCanceled()) {
return DONE;
}
// Check arguments
try {
ParameterUtils.isAbove("Radius", settings.getRadius(), 2);
} catch (final IllegalArgumentException ex) {
IJ.error(TITLE, ex.getMessage());
return DONE;
}
return FLAGS;
}
use of uk.ac.sussex.gdsc.core.ij.gui.NonBlockingExtendedGenericDialog in project GDSC-SMLM by aherbert.
the class Optics method showDialog.
private boolean showDialog(boolean isDbscan) {
logReferences(isDbscan);
final NonBlockingExtendedGenericDialog gd = new NonBlockingExtendedGenericDialog(pluginTitle);
gd.addHelp(HelpUrls.getUrl(isDbscan ? "dbscan" : "optics"));
ResultsManager.addInput(gd, inputSettings.getInputOption(), InputSource.MEMORY);
// globalSettings = SettingsManager.loadSettings();
// settings = globalSettings.getClusteringSettings();
gd.addCheckbox("Ignore_z (for 3D data)", inputSettings.getIgnoreZ());
if (isDbscan) {
gd.addMessage("--- Nearest-Neighbour Analysis ---");
} else {
gd.addMessage("--- " + pluginTitle + " ---");
}
gd.addNumericField("Min_points", inputSettings.getMinPoints(), 0);
if (isDbscan) {
// Add fields to auto-compute the clustering distance from the K-nearest neighbour distance
// profile
gd.addSlider("Noise (%)", 0, 50, inputSettings.getFractionNoise() * 100);
gd.addNumericField("Samples", inputSettings.getSamples(), 0);
gd.addSlider("Sample_fraction (%)", 0, 15, inputSettings.getSampleFraction() * 100);
} else {
final String[] opticsModes = SettingsManager.getNames((Object[]) OpticsMode.values());
gd.addChoice("OPTICS_mode", opticsModes, inputSettings.getOpticsMode(), new OptionListener<Integer>() {
@Override
public boolean collectOptions(Integer value) {
inputSettings.setOpticsMode(value);
final boolean result = collectOptions(false);
return result;
}
@Override
public boolean collectOptions() {
return collectOptions(true);
}
private boolean collectOptions(boolean silent) {
final OpticsMode mode = OpticsMode.get(inputSettings.getOpticsMode());
final ExtendedGenericDialog egd = new ExtendedGenericDialog(mode.toString() + " options");
final OpticsSettings oldSettings = inputSettings.build();
if (mode == OpticsMode.FAST_OPTICS) {
egd.addMessage(TextUtils.wrap("The number of splits to compute (if below 1 it will be auto-computed " + "using the size of the data)", 80));
egd.addNumericField("Number_of_splits", inputSettings.getNumberOfSplitSets(), 0);
if (extraOptions) {
egd.addCheckbox("Random_vectors", inputSettings.getUseRandomVectors());
egd.addCheckbox("Approx_sets", inputSettings.getSaveApproximateSets());
final String[] sampleModes = SettingsManager.getNames((Object[]) SampleMode.values());
egd.addChoice("Sample_mode", sampleModes, inputSettings.getSampleMode());
}
egd.setSilent(silent);
egd.showDialog(true, gd);
if (egd.wasCanceled()) {
return false;
}
inputSettings.setNumberOfSplitSets((int) Math.abs(egd.getNextNumber()));
if (extraOptions) {
inputSettings.setUseRandomVectors(egd.getNextBoolean());
inputSettings.setSaveApproximateSets(egd.getNextBoolean());
inputSettings.setSampleMode(egd.getNextChoiceIndex());
}
} else {
// OPTICS
egd.addNumericField("Generating_distance", inputSettings.getGeneratingDistance(), 2, 6, "nm");
egd.showDialog(true, gd);
if (egd.wasCanceled()) {
return false;
}
inputSettings.setGeneratingDistance(Math.abs(egd.getNextNumber()));
}
// Return true if new settings
return !inputSettings.build().equals(oldSettings);
}
});
}
gd.addMessage("--- Clustering ---");
if (isDbscan) {
gd.addNumericField("Clustering_distance", inputSettings.getClusteringDistance(), 2, 6, "nm");
gd.addCheckbox("Core_points", inputSettings.getCore());
} else {
final String[] clusteringModes = SettingsManager.getNames((Object[]) ClusteringMode.values());
gd.addChoice("Clustering_mode", clusteringModes, inputSettings.getClusteringMode(), new OptionListener<Integer>() {
@Override
public boolean collectOptions(Integer value) {
inputSettings.setClusteringMode(value);
return collectOptions(false);
}
@Override
public boolean collectOptions() {
return collectOptions(true);
}
private boolean collectOptions(boolean silent) {
final ClusteringMode mode = ClusteringMode.get(inputSettings.getClusteringMode());
final ExtendedGenericDialog egd = new ExtendedGenericDialog(mode.toString() + " options");
final OpticsSettings oldSettings = inputSettings.build();
if (mode == ClusteringMode.XI) {
egd.addMessage("Xi controls the change in reachability (profile steepness) to " + "define a cluster");
egd.addNumericField("Xi", inputSettings.getXi(), 4);
egd.addCheckbox("Top_clusters", inputSettings.getTopLevel());
egd.addNumericField("Upper_limit", inputSettings.getUpperLimit(), 4, 10, "nm");
egd.addNumericField("Lower_limit", inputSettings.getLowerLimit(), 4, 10, "nm");
egd.setSilent(silent);
egd.showDialog(true, gd);
if (egd.wasCanceled()) {
return false;
}
inputSettings.setXi(Math.abs(egd.getNextNumber()));
inputSettings.setTopLevel(egd.getNextBoolean());
inputSettings.setUpperLimit(Math.abs(egd.getNextNumber()));
inputSettings.setLowerLimit(Math.abs(egd.getNextNumber()));
} else {
// DBSCAN
egd.addMessage(ClusteringMode.DBSCAN.toString() + " options:");
egd.addNumericField("Clustering_distance", inputSettings.getClusteringDistance(), 4, 10, "nm");
egd.addCheckbox("Core_points", inputSettings.getCore());
egd.setSilent(silent);
egd.showDialog(true, gd);
if (egd.wasCanceled()) {
return false;
}
inputSettings.setClusteringDistance(Math.abs(egd.getNextNumber()));
inputSettings.setCore(egd.getNextBoolean());
}
// Return true if new settings
return !inputSettings.build().equals(oldSettings);
}
});
}
gd.addMessage("--- Table ---");
gd.addCheckbox("Show_table", inputSettings.getShowTable(), new OptionListener<Boolean>() {
@Override
public boolean collectOptions(Boolean value) {
inputSettings.setShowTable(value);
return collectOptions(false);
}
@Override
public boolean collectOptions() {
return collectOptions(true);
}
private boolean collectOptions(boolean silent) {
if (!inputSettings.getShowTable()) {
return false;
}
final ExtendedGenericDialog egd = new ExtendedGenericDialog("Table options");
final OpticsSettings oldSettings = inputSettings.build();
final String[] modes = SettingsManager.getNames((Object[]) TableSortMode.values());
egd.addChoice("Table_sort_mode", modes, inputSettings.getTableSortMode());
egd.addCheckbox("Table_reverse_sort", inputSettings.getTableReverseSort());
egd.setSilent(silent);
egd.showDialog(true, gd);
if (egd.wasCanceled()) {
return false;
}
inputSettings.setTableSortMode(egd.getNextChoiceIndex());
inputSettings.setTableReverseSort(egd.getNextBoolean());
// Return true if new settings
return !inputSettings.build().equals(oldSettings);
}
});
gd.addMessage("--- Image ---");
gd.addSlider("Image_scale", 0, 15, inputSettings.getImageScale());
final TreeSet<ImageMode> imageModeSet = new TreeSet<>();
imageModeSet.addAll(Arrays.asList(ImageMode.values()));
if (isDbscan) {
imageModeSet.remove(ImageMode.CLUSTER_DEPTH);
imageModeSet.remove(ImageMode.CLUSTER_ORDER);
}
imageModeArray = imageModeSet.toArray();
final String[] imageModes = SettingsManager.getNames(imageModeArray);
gd.addChoice("Image_mode", imageModes, ImageMode.get(inputSettings.getImageMode()).toString(), new OptionListener<Integer>() {
@Override
public boolean collectOptions(Integer value) {
inputSettings.setImageMode(((ImageMode) imageModeArray[value]).ordinal());
return collectOptions(false);
}
@Override
public boolean collectOptions() {
return collectOptions(true);
}
private boolean collectOptions(boolean silent) {
final ImageMode mode = ImageMode.get(inputSettings.getImageMode());
final ExtendedGenericDialog egd = new ExtendedGenericDialog(mode.toString() + " options");
if (mode.canBeWeighted()) {
egd.addCheckbox("Weighted", inputSettings.getWeighted());
egd.addCheckbox("Equalised", inputSettings.getEqualised());
}
if (mode == ImageMode.LOOP && extraOptions) {
egd.addNumericField("LoOP_lambda", inputSettings.getLambda(), 4);
}
if (!egd.hasFields()) {
return false;
}
egd.setSilent(silent);
egd.showDialog(true, gd);
if (egd.wasCanceled()) {
return false;
}
final OpticsSettings oldSettings = inputSettings.build();
if (mode.canBeWeighted()) {
inputSettings.setWeighted(egd.getNextBoolean());
inputSettings.setEqualised(egd.getNextBoolean());
}
if (mode == ImageMode.LOOP && extraOptions) {
inputSettings.setLambda(Math.abs(gd.getNextNumber()));
}
// Return true if new settings
return !inputSettings.build().equals(oldSettings);
}
});
final TreeSet<OutlineMode> outlineModeSet = new TreeSet<>();
outlineModeSet.addAll(Arrays.asList(OutlineMode.values()));
if (isDbscan) {
outlineModeSet.remove(OutlineMode.COLOURED_BY_DEPTH);
}
outlineModeArray = outlineModeSet.toArray();
final String[] outlineModes = SettingsManager.getNames(outlineModeArray);
gd.addChoice("Outline", outlineModes, OutlineMode.get(inputSettings.getOutlineMode()).toString(), new OptionListener<Integer>() {
@Override
public boolean collectOptions(Integer value) {
inputSettings.setOutlineMode(((OutlineMode) outlineModeArray[value]).ordinal());
return collectOptions(false);
}
@Override
public boolean collectOptions() {
return collectOptions(true);
}
private boolean collectOptions(boolean silent) {
final OutlineMode mode = OutlineMode.get(inputSettings.getOutlineMode());
final ExtendedGenericDialog egd = new ExtendedGenericDialog(mode.toString() + " options");
final int hullMode = inputSettings.getHullMode();
final boolean saveOutlines = inputSettings.getSaveOutlines();
final double diggingThreshold = inputSettings.getDiggingThreshold();
final String[] hullModes = SettingsManager.getNames((Object[]) HullMode.values());
egd.addChoice("Hull_algorithm", hullModes, hullMode);
egd.addCheckbox("Save_to_ROI_manager", saveOutlines);
egd.addMessage("For the digging concave hull algorithm");
egd.addNumericField("Digging_threshold", diggingThreshold, 2);
egd.setSilent(silent);
egd.showDialog(true, gd);
if (egd.wasCanceled()) {
return false;
}
inputSettings.setHullMode(egd.getNextChoiceIndex());
inputSettings.setSaveOutlines(egd.getNextBoolean());
inputSettings.setDiggingThreshold(ValidationUtils.checkStrictlyPositive(egd.getNextNumber(), "Digging_threshold"));
// Return true if new settings
return inputSettings.getHullMode() != hullMode || inputSettings.getSaveOutlines() != saveOutlines || (hullMode == HullMode.DIGGING_CONCAVE_HULL.ordinal() && inputSettings.getDiggingThreshold() != diggingThreshold);
}
});
if (!isDbscan) {
final String[] spanningTreeModes = SettingsManager.getNames((Object[]) SpanningTreeMode.values());
gd.addChoice("Spanning_tree", spanningTreeModes, inputSettings.getSpanningTreeMode());
gd.addMessage("--- Reachability Plot ---");
final String[] plotModes = SettingsManager.getNames((Object[]) PlotMode.values());
gd.addChoice("Plot_mode", plotModes, inputSettings.getPlotMode());
}
// Everything is done within the dialog listener
final BaseDialogListener listener = (isDbscan) ? new DbscanDialogListener(gd) : new OpticsDialogListener(gd);
gd.addDialogListener(listener);
gd.addOptionCollectedListener(listener);
// Start disabled so the user can choose settings to update
if (ImageJUtils.isShowGenericDialog()) {
gd.addCheckbox("Preview", false, listener);
} else {
gd.addCheckbox("Preview", false);
}
if (extraOptions) {
gd.addCheckbox("Debug", false);
}
gd.showDialog();
if (gd.wasCanceled()) {
return false;
}
// The dialog was OK'd so run if work was staged in the workflow.
if (workflow.isStaged()) {
workflow.runStaged();
}
// Record the options for macros since the NonBlocking dialog does not
if (Recorder.record) {
Recorder.recordOption("Min_points", Integer.toString(inputSettings.getMinPoints()));
if (isDbscan) {
// Add fields to auto-compute the clustering distance from the K-nearest neighbour distance
// profile
Recorder.recordOption("Noise", Double.toString(inputSettings.getFractionNoise() * 100));
Recorder.recordOption("Samples", Double.toString(inputSettings.getSamples()));
Recorder.recordOption("Sample_fraction", Double.toString(inputSettings.getSampleFraction() * 100));
Recorder.recordOption("Clustering_distance", Double.toString(inputSettings.getClusteringDistance()));
} else {
Recorder.recordOption("OPTICS_mode", OpticsMode.get(inputSettings.getOpticsMode()).toString());
Recorder.recordOption("Number_of_splits", Integer.toString(inputSettings.getNumberOfSplitSets()));
if (extraOptions) {
if (inputSettings.getUseRandomVectors()) {
Recorder.recordOption("Random_vectors");
}
if (inputSettings.getSaveApproximateSets()) {
Recorder.recordOption("Approx_sets");
}
Recorder.recordOption("Sample_mode", SampleMode.forOrdinal(inputSettings.getSampleMode()).toString());
}
Recorder.recordOption("Generating_distance", Double.toString(inputSettings.getGeneratingDistance()));
}
if (isDbscan) {
if (inputSettings.getCore()) {
Recorder.recordOption("Core_points");
}
} else {
Recorder.recordOption("Clustering_mode", ClusteringMode.get(inputSettings.getClusteringMode()).toString());
Recorder.recordOption("Xi", Double.toString(inputSettings.getXi()));
if (inputSettings.getTopLevel()) {
Recorder.recordOption("Top_clusters");
}
Recorder.recordOption("Upper_limit", Double.toString(inputSettings.getUpperLimit()));
Recorder.recordOption("Lower_limit", Double.toString(inputSettings.getLowerLimit()));
Recorder.recordOption("Clustering_distance", Double.toString(inputSettings.getClusteringDistance()));
if (inputSettings.getCore()) {
Recorder.recordOption("Core_points");
}
}
if (inputSettings.getShowTable()) {
Recorder.recordOption("Show_table");
Recorder.recordOption("Table_sort_mode", TableSortMode.get(inputSettings.getTableSortMode()).toString());
if (inputSettings.getTableReverseSort()) {
Recorder.recordOption("Table_reverse_sort");
}
}
Recorder.recordOption("Image_scale", Double.toString(inputSettings.getImageScale()));
Recorder.recordOption("Image_mode", ImageMode.get(inputSettings.getImageMode()).toString());
if (inputSettings.getWeighted()) {
Recorder.recordOption("Weighted");
}
if (inputSettings.getEqualised()) {
Recorder.recordOption("Equalised");
}
if (extraOptions) {
Recorder.recordOption("LoOP_lambda", Double.toString(inputSettings.getLambda()));
}
Recorder.recordOption("Outline", OutlineMode.get(inputSettings.getOutlineMode()).toString());
Recorder.recordOption("Hull_algorithm", HullMode.get(inputSettings.getHullMode()).toString());
if (inputSettings.getSaveOutlines()) {
Recorder.recordOption("Save_to_ROI_manager");
}
Recorder.recordOption("Digging_threshold", Double.toString(inputSettings.getDiggingThreshold()));
if (!isDbscan) {
Recorder.recordOption("Spanning_tree", SpanningTreeMode.get(inputSettings.getSpanningTreeMode()).toString());
Recorder.recordOption("Plot_mode", PlotMode.get(inputSettings.getPlotMode()).toString());
}
if (debug) {
Recorder.recordOption("Debug");
}
}
return true;
}
use of uk.ac.sussex.gdsc.core.ij.gui.NonBlockingExtendedGenericDialog in project GDSC-SMLM by aherbert.
the class FailCountManager method plotData.
/**
* Show an interactive plot of the fail count data.
*/
private void plotData() {
final LocalList<FailCountData> failCountData = failCountDataRef.get();
if (failCountData.isEmpty()) {
IJ.error(TITLE, "No fail count data in memory");
return;
}
// Find max fail count size
final int max = getMaxConsecutiveFailCount(failCountData);
final ConcurrentMonoStack<PlotData> stack = new ConcurrentMonoStack<>();
boolean clear = true;
try {
new Thread(new PlotWorker(stack, failCountData)).start();
final NonBlockingExtendedGenericDialog gd = new NonBlockingExtendedGenericDialog(TITLE);
gd.addSlider("Item", 1, failCountData.size(), settings.getPlotItem());
gd.addCheckbox("Fixed_x_axis", settings.getPlotFixedXAxis());
gd.addMessage("Rolling Window Fail Count");
gd.addSlider("Rolling_window", 1.0, 3.0 * max, settings.getPlotRollingWindow());
gd.addMessage("Weighted Fail Count");
gd.addSlider("Pass_weight", 1, 20, settings.getPlotPassWeight());
gd.addSlider("Fail_weight", 1, 20, settings.getPlotFailWeight());
gd.addMessage("Resetting Fail Count");
gd.addSlider("Reset_fraction", 0.05, 0.95, settings.getPlotResetFraction());
gd.addDialogListener((gd2, event) -> {
final int item = (int) gd2.getNextNumber();
final boolean fixedXAxis = gd2.getNextBoolean();
final int rollingWindow = (int) gd2.getNextNumber();
final int passWeight = (int) gd2.getNextNumber();
final int failWeight = (int) gd2.getNextNumber();
final double resetFraction = gd2.getNextNumber();
settings.setPlotItem(item);
settings.setPlotRollingWindow(rollingWindow);
settings.setPlotPassWeight(passWeight);
settings.setPlotFailWeight(failWeight);
settings.setPlotResetFraction(resetFraction);
stack.insert(new PlotData(item, fixedXAxis, rollingWindow, passWeight, failWeight, resetFraction));
return true;
});
gd.hideCancelButton();
gd.setOKLabel("Close");
gd.addHelp(HelpUrls.getUrl("fail-count-manager-plot"));
gd.showDialog();
clear = gd.wasCanceled();
} finally {
stack.close(clear);
}
}
Aggregations