Write plugin to apply to entire ImageJ instance, so applies to all images open when plugin is run

I’m writing a plugin that should apply to all open images, even images that are opened while the plugin is being run. To accomplish this, I created start and close methods that are run from ImageListener events (imageOpened and imageClosed, respectively). However, it doesn’t seem the plugin applies to images opened after the plugin is applied, so imageOpened is never fired (and neither is imageClosed).

Help appreciated. Here’s my code: https://sr.ht/H5hf.txt

Dear @MaxLeiter,

I cannot observe this behavior on Ubuntu 16.04.2 with an up-to-date Fiji (using the bundled JVM). Everything works as expected, neglecting the fact that calling start() in imageOpened() triggers an infinite loop.

Which operating system are you running and which ImageJ version? Is it vanilla ImageJ or Fiji? Please provide detailed information so that we can try to reproduce the issue.

Also, please provide (e.g. put on GitHub) a minimal, complete, and verifiable example (MCVE). A good starting point for this (that’s actually what I have done) is the following project:

Best,
Stefan

PS: You can use https://gist.github.com for code snippets (and you/we will get code highlight and the possibility to comment for free)

1 Like