Re: selectImage(title) is slow in Java 8
Posted by
Wayne Rasband-2 on
URL: http://imagej.273.s1.nabble.com/selectImage-title-is-slow-in-Java-8-tp5018076p5018080.html
> On Feb 10, 2017, at 5:58 AM, Norbert Vischer <
[hidden email]> wrote:
>
> Hi all,
>
> the macro below shows that "selectImage(title)" often has a 2000 ms wait time.
> I did not observe this in Java 6. Is there an easy fix?
The latest ImageJ daily build (1.51k5) reduces the selectImage() timeout to 250 ms when ImageJ is running on OS X and Java 8. The timeout is the amount of time selectImage() waits for the image window to be activated. On OS X and Java 8, the window activated event sometimes does not occur after selectImage() calls toFront() on the image window.
-wayne
> ImageJ 1.51k4; Java 1.8.0_101 [64-bit]; Mac OS X 10.11.3; 37MB of 7000MB (<1%)
>
> //--- macro begin
> run("Close All");
> for(num=1; num <=6; num++){
> title = "Img_" + num;
> newImage(title, "8-bit ramp", 800, 600, 1);
>
> }
> print("\\Clear");
> for(loop = 1; loop <= 3; loop++){
> print(loop);
> for(num=1; num <=6; num++){
> title = "Img_" + num;
> time = getTime;
> selectImage(title);
> print(title, "time[ms]: ", getTime-time);
> }
> }
> //--- macro end
>
> output:
> =======
> 1
> Img_1 time[ms]: 13
> Img_2 time[ms]: 11
> Img_3 time[ms]: 2004
> Img_4 time[ms]: 11
> Img_5 time[ms]: 21
> Img_6 time[ms]: 13
> 2
> Img_1 time[ms]: 10
> Img_2 time[ms]: 10
> Img_3 time[ms]: 2002
> Img_4 time[ms]: 13
> Img_5 time[ms]: 10
> Img_6 time[ms]: 2007
> 3
> Img_1 time[ms]: 20
> Img_2 time[ms]: 10
> Img_3 time[ms]: 11
> Img_4 time[ms]: 2013
> Img_5 time[ms]: 11
> Img_6 time[ms]: 13
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html