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());
}
Aggregations