Search in sources :

Example 46 with ExtendedGenericDialog

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;
}
Also used : MemoryPeakResults(gdsc.smlm.results.MemoryPeakResults) ExtendedGenericDialog(ij.gui.ExtendedGenericDialog)

Example 47 with ExtendedGenericDialog

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;
}
Also used : ExtendedGenericDialog(ij.gui.ExtendedGenericDialog)

Example 48 with ExtendedGenericDialog

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;
}
Also used : ExtendedGenericDialog(ij.gui.ExtendedGenericDialog)

Example 49 with ExtendedGenericDialog

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);
}
Also used : Checkbox(java.awt.Checkbox) GlobalSettings(gdsc.smlm.ij.settings.GlobalSettings) ExtendedGenericDialog(ij.gui.ExtendedGenericDialog)

Example 50 with ExtendedGenericDialog

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");
    }
}
Also used : Filter(gdsc.smlm.results.filter.Filter) OrFilter(gdsc.smlm.results.filter.OrFilter) AndFilter(gdsc.smlm.results.filter.AndFilter) EShiftFilter(gdsc.smlm.results.filter.EShiftFilter) ShiftFilter(gdsc.smlm.results.filter.ShiftFilter) SignalFilter(gdsc.smlm.results.filter.SignalFilter) MultiFilter(gdsc.smlm.results.filter.MultiFilter) SBRFilter(gdsc.smlm.results.filter.SBRFilter) CoordinateFilter(gdsc.smlm.results.filter.CoordinateFilter) WidthFilter(gdsc.smlm.results.filter.WidthFilter) ANRFilter(gdsc.smlm.results.filter.ANRFilter) MultiHysteresisFilter(gdsc.smlm.results.filter.MultiHysteresisFilter) SNRFilter(gdsc.smlm.results.filter.SNRFilter) PrecisionHysteresisFilter(gdsc.smlm.results.filter.PrecisionHysteresisFilter) TraceFilter(gdsc.smlm.results.filter.TraceFilter) PrecisionFilter(gdsc.smlm.results.filter.PrecisionFilter) SNRHysteresisFilter(gdsc.smlm.results.filter.SNRHysteresisFilter) MemoryPeakResults(gdsc.smlm.results.MemoryPeakResults) ExtendedGenericDialog(ij.gui.ExtendedGenericDialog)

Aggregations

ExtendedGenericDialog (ij.gui.ExtendedGenericDialog)60 ImagePlus (ij.ImagePlus)11 NonBlockingExtendedGenericDialog (ij.gui.NonBlockingExtendedGenericDialog)8 FitEngineConfiguration (gdsc.smlm.engine.FitEngineConfiguration)6 GlobalSettings (gdsc.smlm.ij.settings.GlobalSettings)6 MemoryPeakResults (gdsc.smlm.results.MemoryPeakResults)6 Calibration (gdsc.smlm.results.Calibration)5 ClusterPoint (gdsc.core.clustering.ClusterPoint)4 FitConfiguration (gdsc.smlm.fitting.FitConfiguration)4 PeakResult (gdsc.smlm.results.PeakResult)4 Rectangle (java.awt.Rectangle)4 LinkedList (java.util.LinkedList)4 ArrayList (java.util.ArrayList)3 WeightedObservedPoint (org.apache.commons.math3.fitting.WeightedObservedPoint)3 IJImageSource (gdsc.smlm.ij.IJImageSource)2 IJTablePeakResults (gdsc.smlm.ij.results.IJTablePeakResults)2 ResultsSettings (gdsc.smlm.ij.settings.ResultsSettings)2 ImageSource (gdsc.smlm.results.ImageSource)2 Trace (gdsc.smlm.results.Trace)2 Filter (gdsc.smlm.results.filter.Filter)2