Search in sources :

Example 66 with ExtendedGenericDialog

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

the class CameraModelManager method runLoadFromDirectory.

private static void runLoadFromDirectory() {
    final ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
    gd.addMessage("Load camera models from a directory.");
    gd.addDirectoryField("Directory", directory.get());
    gd.addHelp(HelpUrls.getUrl("camera-model-manager-load-dir"));
    gd.showDialog();
    if (gd.wasCanceled()) {
        return;
    }
    final String dir = gd.getNextString();
    directory.set(dir);
    final File[] fileList = (new File(dir)).listFiles(File::isFile);
    if (!ArrayUtils.isEmpty(fileList)) {
        for (final File file : fileList) {
            loadFromFileAndSaveResource(file.getPath());
        }
    }
}
Also used : ExtendedGenericDialog(uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog) File(java.io.File)

Example 67 with ExtendedGenericDialog

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

the class CameraModelManager method runLoadFromFile.

private static void runLoadFromFile() {
    final ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
    gd.addMessage("Load a camera model from file.");
    gd.addFilenameField("Filename", filename.get());
    gd.addHelp(HelpUrls.getUrl("camera-model-manager-load-file"));
    gd.showDialog();
    if (gd.wasCanceled()) {
        return;
    }
    final String file = gd.getNextString();
    filename.set(file);
    loadFromFileAndSaveResource(file);
}
Also used : ExtendedGenericDialog(uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog)

Example 68 with ExtendedGenericDialog

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

the class CropResults method showCropDialog.

private boolean showCropDialog() {
    final ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
    gd.addHelp(HelpUrls.getUrl("crop-results"));
    final Rectangle bounds = results.getBounds(true);
    results.is3D();
    gd.addMessage(String.format("Current bounds: x=%d,y=%d,w=%d,h=%d", bounds.x, bounds.y, bounds.width, bounds.height));
    gd.addNumericField("Border", settings.getBorder(), 2);
    gd.addCheckbox("Select_region", settings.getSelectRegion());
    gd.addNumericField("X", settings.getX(), 2);
    gd.addNumericField("Y", settings.getY(), 2);
    gd.addNumericField("Width", settings.getWidth(), 2);
    gd.addNumericField("Height", settings.getHeight(), 2);
    if (!titles.isEmpty()) {
        gd.addCheckbox("Use_ROI", settings.getUseRoi());
        final String[] items = titles.toArray(new String[0]);
        gd.addChoice("Image", items, settings.getRoiImage());
    }
    addStandardFields(gd);
    gd.addCheckbox("Reset_origin", settings.getResetOrigin());
    gd.showDialog();
    if (gd.wasCanceled()) {
        return false;
    }
    settings.setBorder(Math.max(0, gd.getNextNumber()));
    settings.setSelectRegion(gd.getNextBoolean());
    settings.setX(gd.getNextNumber());
    settings.setY(gd.getNextNumber());
    settings.setWidth(Math.max(0, gd.getNextNumber()));
    settings.setHeight(Math.max(0, gd.getNextNumber()));
    if (!titles.isEmpty()) {
        myUseRoi = gd.getNextBoolean();
        settings.setUseRoi(myUseRoi);
        settings.setRoiImage(gd.getNextChoice());
    }
    readStandardFields(gd);
    settings.setResetOrigin(gd.getNextBoolean());
    gd.collectOptions();
    return validateOutputName();
}
Also used : Rectangle(java.awt.Rectangle) ExtendedGenericDialog(uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog)

Example 69 with ExtendedGenericDialog

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

the class CubicSplineManager method runLoadFromDirectory.

private static void runLoadFromDirectory() {
    final ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
    gd.addMessage("Load spline models from a directory.");
    gd.addDirectoryField("Directory", directory.get());
    gd.addHelp(HelpUrls.getUrl("cubic-spline-manager-load-dir"));
    gd.showDialog();
    if (gd.wasCanceled()) {
        return;
    }
    final String dir = gd.getNextString();
    directory.set(dir);
    final File[] fileList = (new File(dir)).listFiles(File::isFile);
    if (!ArrayUtils.isEmpty(fileList)) {
        for (final File file : fileList) {
            loadFromFileAndSaveResource(file.getPath());
        }
    }
}
Also used : NonBlockingExtendedGenericDialog(uk.ac.sussex.gdsc.core.ij.gui.NonBlockingExtendedGenericDialog) ExtendedGenericDialog(uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog) File(java.io.File)

Example 70 with ExtendedGenericDialog

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

the class CubicSplineManager method runLoadFromFile.

private static void runLoadFromFile() {
    final ExtendedGenericDialog gd = new ExtendedGenericDialog(TITLE);
    gd.addMessage("Load a spline model from file.");
    gd.addFilenameField("Filename", filename.get());
    gd.addHelp(HelpUrls.getUrl("cubic-spline-manager-load-file"));
    gd.showDialog();
    if (gd.wasCanceled()) {
        return;
    }
    final String file = gd.getNextString();
    filename.set(file);
    loadFromFileAndSaveResource(file);
}
Also used : NonBlockingExtendedGenericDialog(uk.ac.sussex.gdsc.core.ij.gui.NonBlockingExtendedGenericDialog) ExtendedGenericDialog(uk.ac.sussex.gdsc.core.ij.gui.ExtendedGenericDialog)

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