MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / run

Method run

ij/src/main/java/ij/plugin/Animator.java:29–90  ·  view source on GitHub ↗

Set 'arg' to "set" to display a dialog that allows the user to specify the animation speed. Set it to "start" to start animating the current stack. Set it to "stop" to stop animation. Set it to "next" or "previous" to stop any animation and display the next or previous frame.

(String arg)

Source from the content-addressed store, hash-verified

27 to stop any animation and display the next or previous frame.
28 */
29 @AstroImageJ(reason = "Moved startAnimation off thread, makes the pause button more responsive.", modified = true)
30 public void run(String arg) {
31 imp = IJ.getImage();
32 nSlices = imp.getStackSize();
33 if (nSlices<2)
34 {IJ.error("Stack required."); return;}
35 if (imp.isLocked())
36 {IJ.beep(); IJ.showStatus("Image is locked: \""+imp.getTitle()+"\""); return;}
37 ImageWindow win = imp.getWindow();
38 if ((win==null || !(win instanceof StackWindow)) && !arg.equals("options")) {
39 if (arg.equals("next"))
40 imp.setSlice(imp.getCurrentSlice()+1);
41 else if (arg.equals("previous"))
42 imp.setSlice(imp.getCurrentSlice()-1);
43 if (win!=null) imp.updateStatusbarValue();
44 return;
45 }
46 swin = (StackWindow)win;
47 ImageStack stack = imp.getStack();
48 slice = imp.getCurrentSlice();
49 IJ.register(Animator.class);
50
51 if (arg.equals("options")) {
52 doOptions();
53 return;
54 }
55
56 if (arg.equals("start")) {
57 Thread t = new Thread(this::startAnimation);
58 t.start();
59 return;
60 }
61
62 //if (swin.getAnimate()) // "stop", "next" and "previous" all stop animation
63 // stopAnimation();
64
65 if (arg.equals("stop")) {
66 stopAnimation();
67 return;
68 }
69
70 if (arg.equals("next")) {
71 if (Prefs.reverseNextPreviousOrder)
72 changeSlice(1);
73 else
74 nextSlice();
75 return;
76 }
77
78 if (arg.equals("previous")) {
79 if (Prefs.reverseNextPreviousOrder)
80 changeSlice(-1);
81 else
82 previousSlice();
83 return;
84 }
85
86 if (arg.equals("set")) {

Callers

nothing calls this directly

Calls 15

getImageMethod · 0.95
errorMethod · 0.95
beepMethod · 0.95
showStatusMethod · 0.95
setSliceMethod · 0.95
registerMethod · 0.95
doOptionsMethod · 0.95
stopAnimationMethod · 0.95
changeSliceMethod · 0.95
nextSliceMethod · 0.95
previousSliceMethod · 0.95
getCurrentSliceMethod · 0.80

Tested by

no test coverage detected