Search in sources :

Example 31 with Bureaucrat

use of ini.trakem2.utils.Bureaucrat in project TrakEM2 by trakem2.

the class DistortionCorrectionTask method correctDistortionFromSelectionTask.

public static final Bureaucrat correctDistortionFromSelectionTask(final Selection selection) {
    final Worker worker = new Worker("Distortion Correction", false, true) {

        @Override
        public void run() {
            startedWorking();
            try {
                correctDistortionFromSelection(selection);
                Display.repaint(selection.getLayer());
            } catch (final Throwable e) {
                IJError.print(e);
            } finally {
                finishedWorking();
            }
        }

        @Override
        public void cleanup() {
            if (!selection.isEmpty())
                selection.getLayer().getParent().undoOneStep();
        }
    };
    return Bureaucrat.createAndStart(worker, selection.getProject());
}
Also used : Worker(ini.trakem2.utils.Worker)

Aggregations

Worker (ini.trakem2.utils.Worker)26 ArrayList (java.util.ArrayList)12 GenericDialog (ij.gui.GenericDialog)11 File (java.io.File)11 ImagePlus (ij.ImagePlus)10 Bureaucrat (ini.trakem2.utils.Bureaucrat)8 Rectangle (java.awt.Rectangle)8 Patch (ini.trakem2.display.Patch)7 NoninvertibleTransformException (java.awt.geom.NoninvertibleTransformException)7 IOException (java.io.IOException)7 HashSet (java.util.HashSet)7 Project (ini.trakem2.Project)6 FormatException (loci.formats.FormatException)6 DirectoryChooser (ij.io.DirectoryChooser)5 Layer (ini.trakem2.display.Layer)5 Point (java.awt.Point)5 TreeMap (java.util.TreeMap)5 Future (java.util.concurrent.Future)5 Displayable (ini.trakem2.display.Displayable)4 DBObject (ini.trakem2.persistence.DBObject)4