问题
I'm trying to make an ImageJ plugin that generates a stack of masks based on a selection in each frame in an active stack.
To do that, I need to clear the mask and save it when the frame in the stack changed. I don't see any event options available on the API for ImageStack; how would I trigger a sequence of steps when the stack frame is changed? Is there an event to do this?
回答1:
The event options are implemented in the ImagePlus
class, not in the ImageStack
.
Your plugin should implement the ImageListener interface. In its imageUpdated()
method, you should be able to get the current slice number and react accordingly.
Use the static method ImagePlus.addImageListener(this)
to add your plugin as an ImageListener
.
来源:https://stackoverflow.com/questions/21791105/imagej-trigger-event-when-frame-in-imagestack-is-changed