Search in sources :

Example 16 with ExtendedGenericDialog

use of uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog in project GDSC-SMLM by aherbert.

the class PeakFit method showMaximaDialog.

private boolean showMaximaDialog() {
    final int size = MemoryPeakResults.countMemorySize();
    if (size == 0) {
        IJ.error(TITLE, "There are no fitting results in memory");
        return false;
    }
    settings = Settings.load();
    final ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
    gd.addHelp(HelpUrls.getUrl("fit-maxima"));
    gd.addMessage("Select identified maxima for fitting");
    ResultsManager.addInput(gd, settings.inputOption, InputSource.MEMORY);
    gd.addCheckbox("Fit_across_all_frames", settings.fitAcrossAllFrames);
    gd.showDialog();
    if (gd.wasCanceled()) {
        return false;
    }
    settings.inputOption = ResultsManager.getInputSource(gd);
    settings.fitAcrossAllFrames = gd.getNextBoolean();
    settings.save();
    return true;
}
Also used : ExtendedGenericDialog(uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog)

Example 17 with ExtendedGenericDialog

use of uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog in project GDSC-SMLM by aherbert.

the class TraceExporter method showDialog.

private boolean showDialog() {
    settings = Settings.load();
    final ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
    gd.addMessage("Export traces to a directory");
    gd.addDirectoryField("Directory", settings.directory, 30);
    gd.addNumericField("Min_length", settings.minLength, 0);
    gd.addNumericField("Max_length", settings.maxLength, 0);
    gd.addMessage("Specify the maximum jump allowed within a trace.\n" + "Traces with larger jumps will be split.");
    gd.addNumericField("Max_jump", settings.maxJump, 0);
    gd.addMessage("Specify localistion precision (wobble) to add");
    gd.addNumericField("Wobble", settings.wobble, 0, 6, "nm");
    gd.addChoice("Format", Settings.formatNames, settings.format);
    gd.addCheckbox("Histogram_trace_lengths", settings.showTraceLengths);
    gd.addHelp(HelpUrls.getUrl("trace-exporter"));
    gd.showDialog();
    if (gd.wasCanceled()) {
        return false;
    }
    settings.directory = gd.getNextString();
    settings.minLength = Math.max(0, (int) gd.getNextNumber());
    settings.maxLength = Math.max(0, (int) gd.getNextNumber());
    settings.maxJump = Math.max(0, (int) gd.getNextNumber());
    settings.wobble = Math.max(0, gd.getNextNumber());
    settings.format = gd.getNextChoiceIndex();
    settings.showTraceLengths = gd.getNextBoolean();
    settings.save();
    return true;
}
Also used : ExtendedGenericDialog(uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog)

Example 18 with ExtendedGenericDialog

use of uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog in project GDSC-SMLM by aherbert.

the class TcPalmAnalysis method showLoopSettingsDialog.

/**
 * Show a dialog to change the loop settings.
 *
 * @param event the event
 */
private void showLoopSettingsDialog(ActionEvent event) {
    final ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
    // Require results settings to use the standard ResultsManager image options
    final ResultsSettings.Builder tmp = ResultsSettings.newBuilder();
    tmp.setResultsImageSettings(settings.getLoopImageSettingsBuilder());
    final int flags = ResultsManager.FLAG_NO_SECTION_HEADER;
    ResultsManager.addImageResultsOptions(gd, tmp, flags);
    gd.addHelp(HelpUrls.getUrl("tc-palm-analysis"));
    gd.showDialog();
    if (gd.wasCanceled()) {
        return;
    }
    final ResultsImageSettings.Builder newImgSettings = tmp.getResultsImageSettingsBuilder();
    newImgSettings.setImageTypeValue(gd.getNextChoiceIndex());
    settings.setLoopImageSettings(newImgSettings);
    SettingsManager.writeSettings(settings);
    addWork(previous.roi);
}
Also used : NonBlockingExtendedGenericDialog(uk.ac.sussex.gdsc.core.ij.gui.NonBlockingExtendedGenericDialog) ExtendedGenericDialog(uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog) ResultsSettings(uk.ac.sussex.gdsc.smlm.data.config.ResultsProtos.ResultsSettings) ResultsImageSettings(uk.ac.sussex.gdsc.smlm.data.config.ResultsProtos.ResultsImageSettings) Point(java.awt.Point)

Example 19 with ExtendedGenericDialog

use of uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog in project GDSC-SMLM by aherbert.

the class PulseActivationAnalysis method showCrossTalkAnalysisDialog.

private boolean showCrossTalkAnalysisDialog() {
    final ExtendedGenericDialog gd = new ExtendedGenericDialog(title);
    gd.addMessage(TextUtils.wrap("Crosstalk analysis requires a sample singly labelled with only one photo-switchable" + " probe and imaged with the full pulse lifecycle. The probe should be activated by" + " the pulse in the target channel. Activations from the pulse in other channels" + " is crosstalk.", 80));
    final String[] ch = new String[settings.channels];
    for (int i = 0; i < ch.length; i++) {
        ch[i] = "Channel " + (i + 1);
    }
    gd.addChoice("Target", ch, "Channel " + settings.targetChannel);
    gd.addHelp(HelpUrls.getUrl(helpKey));
    gd.showDialog();
    if (gd.wasCanceled()) {
        return false;
    }
    settings.targetChannel = gd.getNextChoiceIndex() + 1;
    return true;
}
Also used : NonBlockingExtendedGenericDialog(uk.ac.sussex.gdsc.core.ij.gui.NonBlockingExtendedGenericDialog) ExtendedGenericDialog(uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog)

Example 20 with ExtendedGenericDialog

use of uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog in project GDSC-SMLM by aherbert.

the class ShowResultsHeader method run.

@Override
public void run(String arg) {
    SmlmUsageTracker.recordPlugin(this.getClass(), arg);
    final Settings settings = Settings.load();
    final ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
    gd.addMessage("Show the results header in the ImageJ log");
    gd.addFilenameField("Filename", settings.inputFilename, 30);
    gd.addCheckbox("Raw", settings.raw);
    gd.addHelp(HelpUrls.getUrl("show-results-header"));
    gd.showDialog();
    if (gd.wasCanceled()) {
        return;
    }
    settings.inputFilename = gd.getNextString();
    settings.raw = gd.getNextBoolean();
    settings.save();
    final PeakResultsReader reader = new PeakResultsReader(settings.inputFilename);
    final String header = reader.getHeader();
    if (header == null) {
        IJ.error(TITLE, "No header found in file: " + settings.inputFilename);
        return;
    }
    if (settings.raw) {
        // The ImageJ TextPanel class correctly stores lines with tab characters.
        // However when it is drawn in ij.text.TextCanvas using java.awt.Graphics.drawChars(...)
        // the instance of this class is sun.java2d.SunGraphics2D which omits '\t' chars.
        // This may be a problem specific to the Linux JRE.
        // TODO - Find out if this is a Linux specific bug.
        // Output the raw text. This preserves the tabs in the Cut/Copy commands.
        IJ.log(header);
        // IJ.log(header.replace("\t", " "));
        return;
    }
    // Output what information we can extract
    boolean found = false;
    found |= show("Format", reader.getFormat().toString());
    found |= show("Name", reader.getName());
    found |= show("Bounds", reader.getBounds());
    found |= show("Source", reader.getSource());
    found |= show("Calibration", reader.getCalibration());
    found |= show("PSF", reader.getPsf());
    found |= show("Configuration", reader.getConfiguration());
    if (!found) {
        IJ.error(TITLE, "No header information found in file: " + settings.inputFilename);
    }
}
Also used : ExtendedGenericDialog(uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog) PeakResultsReader(uk.ac.sussex.gdsc.smlm.results.PeakResultsReader)

Aggregations

ExtendedGenericDialog (uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog)151 NonBlockingExtendedGenericDialog (uk.ac.sussex.gdsc.core.ij.gui.NonBlockingExtendedGenericDialog)38 CalibrationWriter (uk.ac.sussex.gdsc.smlm.data.config.CalibrationWriter)21 MemoryPeakResults (uk.ac.sussex.gdsc.smlm.results.MemoryPeakResults)14 Checkbox (java.awt.Checkbox)13 ImagePlus (ij.ImagePlus)12 File (java.io.File)11 Rectangle (java.awt.Rectangle)10 TextField (java.awt.TextField)10 ResultsImageSettings (uk.ac.sussex.gdsc.smlm.data.config.ResultsProtos.ResultsImageSettings)10 FitConfiguration (uk.ac.sussex.gdsc.smlm.engine.FitConfiguration)10 Choice (java.awt.Choice)9 ArrayList (java.util.ArrayList)9 DistanceUnit (uk.ac.sussex.gdsc.smlm.data.config.UnitProtos.DistanceUnit)9 LocalList (uk.ac.sussex.gdsc.core.utils.LocalList)8 CalibrationReader (uk.ac.sussex.gdsc.smlm.data.config.CalibrationReader)7 ResultsSettings (uk.ac.sussex.gdsc.smlm.data.config.ResultsProtos.ResultsSettings)7 ResultsTableSettings (uk.ac.sussex.gdsc.smlm.data.config.ResultsProtos.ResultsTableSettings)7 IJ (ij.IJ)6 GenericDialog (ij.gui.GenericDialog)5