/** * Returns the number of time points. * * @return */ public int size() { if (univ.getContents().size() == 0) return 0; return univ.getEndTime() - univ.getStartTime(); }
/** * Display previous timepoint. */ public void previous() { if (univ.getContents().size() == 0) return; final int curr = univ.getCurrentTimepoint(); if (curr == univ.getStartTime()) return; univ.showTimepoint(curr - 1); }
@Override public void run() { int inc = +1; shouldPause = false; while (!shouldPause) { int next = univ.getCurrentTimepoint() + inc; if (next > univ.getEndTime()) { if (bounceback) { inc = -inc; continue; } next = univ.getStartTime(); } else if (next < univ.getStartTime()) { inc = -inc; continue; } univ.showTimepoint(next); try { Thread.sleep(delay); } catch (final Exception e) { shouldPause = true; } } shouldPause = false; playing = null; } });
/** * Display first timepoint. */ public void first() { if (univ.getContents().size() == 0) return; final int first = univ.getStartTime(); if (univ.getCurrentTimepoint() == first) return; univ.showTimepoint(first); }
final int min = timeline.getUniverse().getStartTime(); final int max = timeline.getUniverse().getEndTime() + 1; final int cur = timeline.getUniverse().getCurrentTimepoint();
public ImagePlus record() { pause(); final int s = univ.getStartTime(); final int e = univ.getEndTime(); univ.showTimepoint(s); try { Thread.sleep(100); } catch (final InterruptedException ex) {} final ImagePlus imp = univ.takeSnapshot(); final ImageStack stack = new ImageStack(imp.getWidth(), imp.getHeight()); stack.addSlice("", imp.getProcessor()); for (int i = s + 1; i <= e; i++) { univ.showTimepoint(i); try { Thread.sleep(100); } catch (final InterruptedException ex) {} stack.addSlice("", univ.takeSnapshot().getProcessor()); } return new ImagePlus("Movie", stack); }