@Override public void mouseDragged(final MouseEvent e) { e.consume(); updater.doUpdate(); }
void quit() { interrupt(); synchronized (this) { notify(); } }
@Override public void run() { while (!isInterrupted()) { try { final long r; synchronized (this) { r = request; } // Call update from this thread if (r > 0) refresh(); synchronized (this) { if (r == request) { request = 0; // reset wait(); } // else loop through to update again } } catch (final Exception e) { } } } }
/** * Refresh the output display with the current roi. This is done by sending a signal * to the Updater() thread. This method can be called from a script to force update * after the Roi has been changed with other means than the mouse */ public void update() { updater.doUpdate(); }
/** * Shut down the Dynamic reslice, that is, remove itself from the listener * list. */ public void shutdown() { updater.quit(); updater = null; imp.getCanvas().removeMouseMotionListener(this); imp.getWindow().removeWindowListener(this); dest_imp.getWindow().removeWindowListener(this); IJ.showStatus("Dynamic Reslice shut down."); }
void doUpdate() { if (isInterrupted()) return; synchronized (this) { request++; notify(); } }
Updater() { super("Dynamic Reslice updater"); setPriority(Thread.NORM_PRIORITY); start(); }