Re: Programatic(Java) zooming issue(s)

Posted by Herbie on
URL: http://imagej.273.s1.nabble.com/Programatic-Java-zooming-issue-s-tp5024578p5024582.html

Dear Fred,

since long I successfully use

if ( imp.getRoi() != null )
   new Zoom().run( "to" );

and have never ever encountered any of the described effects.

Regards

Herbie

::::::::::::::::::::::::::::::::::::::::
Am 01.04.21 um 04:09 schrieb Fred Damen:

> Greetings,
>
> Resizing image windows thru the GUI seems to always work as expected.
> Resizing the windows from within a Java plugin seem to work undesirably
> about 40% of the time.  The undesirable effects tend to be consistent,
> e.g., the second,third, and fifth windows exhibit the same effect each
> time the plugin is run.  I suspect that the issue is some sort of a race
> condition between ImageJ and Java/System GUI proper, as the symptoms vary
> somewhat with load and computer.
>
> The symptoms include:
> Window has slightly wrong size and image appears to be the correct
> magnification.
> Window has correct size and the image is original size.
>
> Both these statements produce these results:
> IJ.run("In [+]", "");
> IJ.run("Set... ", "zoom=200");
>
> I have found that after show(ing) all the windows if I ...
>        Dimension ws = imps[0].getWindow().getSize();
>        for(ImagePlus imp : imps)
>           imp.getWindow().setSize(ws.width,ws.height);
>        for(ImagePlus imp : imps)
>           imp.getWindow().getCanvas().fitToWindow();
> This seems to adjust the window and image sizes appropriately most of the
> time.
>
> Is there a recommended way to zoom a window programmatically that works
> consistently and correctly like it does from Image>Zoom>... ?
>
> Thanks in advance,
>
> Fred
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html