Hi everybody,
I have written a plugin with a GUI containing a button that allows the user to display an image. If the user clicks on the button the image is shown by calling its show() method. On the first click this works well, but if the user manually closes the window, it is no longer possible to redisplay the image again. On clicking the button again simply nothing happens. I searched the list and found corresponding items where it is stated that the setIgnoreFlush(true) method should fix this behaviour. Unfortunately it does not seem to work correctly - or I am doing something wrong. I wrote a piece of code for illustrating my problem: ImagePlus imp = NewImage.createFloatImage("Test", 100,100,1, NewImage.FILL_BLACK); imp.setIgnoreFlush(true); imp.show(); while (imp.isVisible()) { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } System.out.println("Displaying image again..."); imp.show(); Initially the image is displayed to the user by the first call of show(). As soon as the user closes the window manually, I would expect that the while-loop terminates and the image - as 'ignoreFlush' is set to 'true' - is displayed again in a (new) window. Indeed, if the user closes the window the while-loop terminates and the program continues, however, no window opens and the image is not shown again. It seems as if the setIgnoreFlush(true) method has no effect if the user closes the window manually. Is that true, and if so does anyone know the reason for this? Moreover, is there any other option or workaround to redisplay an image to the user that was closed manually before? I guess that keeping a copy of the image for later redisplay would solve the problem, but is that the only way to achieve the desired behaviour? Thanks, Birgit -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Sep 11, 2012, at 7:52 AM, Birgit Möller wrote:
> Hi everybody, > I have written a plugin with a GUI containing a button that allows the user to display an image. If the user clicks on the button the image is shown by calling its show() method. On the first click this works well, but if the user manually closes the window, it is no longer possible to redisplay the image again. On clicking the button again simply nothing happens. I searched the list and found corresponding items where it is stated that the setIgnoreFlush(true) method should fix this behaviour. Unfortunately it does not seem to work correctly - or I am doing something wrong. > I wrote a piece of code for illustrating my problem: This bug is fixed in the ImageJ 1.47d daily build. Here is a JavaScript version of the test code: imp = IJ.createImage("Test", "32-bit", 256, 256, 1); imp.setIgnoreFlush(true); imp.show(); while (imp.isVisible()) IJ.wait(1000); IJ.log("Displaying image again..."); imp.show(); -wayne > > ImagePlus imp = NewImage.createFloatImage("Test", 100,100,1, NewImage.FILL_BLACK); > imp.setIgnoreFlush(true); > imp.show(); > while (imp.isVisible()) { > try { > Thread.sleep(1000); > } catch (InterruptedException e) { > e.printStackTrace(); > } > } > System.out.println("Displaying image again..."); > imp.show(); > > Initially the image is displayed to the user by the first call of show(). As soon as the user closes the window manually, I would expect that the while-loop terminates and the image - as 'ignoreFlush' is set to 'true' - is displayed again in a (new) window. Indeed, if the user closes the window the while-loop terminates and the program continues, however, no window opens and the image is not shown again. It seems as if the setIgnoreFlush(true) method has no effect if the user closes the window manually. Is that true, and if so does anyone know the reason for this? Moreover, is there any other option or workaround to redisplay an image to the user that was closed manually before? I guess that keeping a copy of the image for later redisplay would solve the problem, but is that the only way to achieve the desired behaviour? > Thanks, > > Birgit -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Birgit Möller
Hi Wayne,
thanks for the bugfix! I did not check the JavaScript version, but in Java it is working now and our problem is solved. Cheers, Birgit On Tue, 11 Sep 2012 13:03:05 -0400, Rasband, Wayne (NIH/NIMH) [E] <[hidden email]> wrote: >On Sep 11, 2012, at 7:52 AM, Birgit M�ller wrote: > >> Hi everybody, >> I have written a plugin with a GUI containing a button that allows the user to display an image. If the user clicks on the button the image is shown by calling its show() method. On the first click this works well, but if the user manually closes the window, it is no longer possible to redisplay the image again. On clicking the button again simply nothing happens. I searched the list and found corresponding items where it is stated that the setIgnoreFlush(true) method should fix this behaviour. Unfortunately it does not seem to work correctly - or I am doing something wrong. >> I wrote a piece of code for illustrating my problem: > >This bug is fixed in the ImageJ 1.47d daily build. Here is a JavaScript version of the test code: > > imp = IJ.createImage("Test", "32-bit", 256, 256, 1); > imp.setIgnoreFlush(true); > imp.show(); > while (imp.isVisible()) > IJ.wait(1000); > IJ.log("Displaying image again..."); > imp.show(); > >-wayne > >> >> ImagePlus imp = NewImage.createFloatImage("Test", 100,100,1, NewImage.FILL_BLACK); >> imp.setIgnoreFlush(true); >> imp.show(); >> while (imp.isVisible()) { >> try { >> Thread.sleep(1000); >> } catch (InterruptedException e) { >> e.printStackTrace(); >> } >> } >> System.out.println("Displaying image again..."); >> imp.show(); >> >> Initially the image is displayed to the user by the first call of show(). As soon as the user closes the window manually, I would expect that the while-loop terminates and the image - as 'ignoreFlush' is set to 'true' - is displayed again in a (new) window. Indeed, if the user closes the window the while-loop terminates and the program continues, however, no window opens and the image is not shown again. It seems as if the setIgnoreFlush(true) method has no effect if the user closes the window manually. Is that true, and if so does anyone know the reason for this? Moreover, is there any other option or workaround to redisplay an image to the user that was closed manually before? I guess that keeping a copy of the image for later redisplay would solve the problem, but is that the only way to achieve the desired behaviour? >> Thanks, >> >> Birgit > >-- >ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |