Posted by
Michael Schmid on
Oct 07, 2019; 9:16am
URL: http://imagej.273.s1.nabble.com/JAVA-notification-that-slice-changes-in-Stack-tp5022491p5022495.html
Hi Kenneth,
concerning stopping the animation ('play') of a stack:
You can simply use the Macro Recorder in 'Java' mode, it says:
IJ.run("Stop Animation", "");
As for all IJ.run commands, it also has a version where you can specify
the ImagePlus:
IJ.run(imp, "Stop Animation", "");
Another way to stop animation is the setAnimage(boolean) method of
StackWindow.
StackWindow also has a setSlidersEnabled(boolean) method, which can be
used to disable the sliders. Nevertheless, the user can still change the
slice by various menu commands, with Image>Stacks>Set Slice being the
most obvious. Note that also many commands where it is not obvious
change the slice (e.g. the ROI Manager's More>>Multi Measure).
If you need to disable that all, you have to lock the image, but then
also your code can't change the slice.
Michael
________________________________________________________________
On 05.10.19 17:45, Kenneth Sloan wrote:
> Thanks - ImageListener worked fine.
>
> Now, for part b) - is it possible to turn off the autoscroll? I like the idea of allowing
> the user to hit the "play" button, and it's not too much trouble to ask the user to turn
> it off when done - but I'd like to also be able to turn it off if the user uses a cursor
> in another window to change the current slice.
>
> Context: 2 stack windows (same dimensions, different data) and 2 single-image windows showing top-down
> views of the stack. The user controls a global cursor from any window (very much like Orthogonal_Views).
> So, moving in y in one of the top-down, single-image views will change the slice in both stacks.
> What I'd like to do is to STOP an ongoing animation when the user changes the slice in one of the top-down views.
> Orthogonal_Views appears to do this, but I can't decipher the methods used.
>
> What happens now is that when the user starts an animation, both stacks scroll together, and the global cursor is
> updated to indicate the current slice/y-coordinate. If the user changes the y-coordinate in a top-down view, the stacks are momentarily updated to reflect that change, but the animation (still running) then proceeds to bring the two stacks back
> to where the animation wants it. I'd like to be able to stop that.
>
> Not a big deal - just trying to understand all the corner cases and have as much control as possible. It's certainly usable as-is.
>
> One final piece of trivia - what is the difference between ImagePlus/getCurrentSlice() and ImagePlus/getSlice()? They appear to
> do the same thing. The documentation has an extra notation that getCurrentSlice() returns a 1-based index. There is no such
> comment on getSlice() - but it also seems to return a 1-based index. Is this a compatibility issue, or am I confused?
>
> --
> Kenneth Sloan
>
[hidden email]
> Vision is the art of seeing what is invisible to others.
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html