Fiji grabs focus during long scripts

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Fiji grabs focus during long scripts

Aryeh Weiss
When I am running a script that takes some time, I do other things like
deal with email, use a text editor or LaTeX, etc. the problem is that
during the script, Fiji often grabs focus  ( presumably when it displays
an image window, or maybe also when it displays any window). When this
happens, whatever I have been typing  is picked up by Fiji as shortcut
keys, and it usually messes up whatever is running.

Can this behavior be prevented? Is there a way to prevent ImageJ form
grabbing focus during execution of a script?

Tnx in advance
--aryeh

--
Aryeh Weiss
Faculty of Engineering
Bar Ilan University
Ramat Gan 52900 Israel

Ph:  972-3-5317638
FAX: 972-3-7384051


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Fiji grabs focus during long scripts

Jan Eglinger
Hi Aryeh,

I'd recommend using 'setBatchMode(true)' in macros whenever possible to
prevent new windows from being opened.

Other than that, you can use any other supported scripting language
(e.g. Groovy or Jython) to interact directly with the Java API of
plugins, and work with objects headlessly instead of having to rely on
the active image window.

Cheers
Jan


On 22.06.20 16:20, Aryeh Weiss wrote:

> When I am running a script that takes some time, I do other things like
> deal with email, use a text editor or LaTeX, etc. the problem is that
> during the script, Fiji often grabs focus  ( presumably when it displays
> an image window, or maybe also when it displays any window). When this
> happens, whatever I have been typing  is picked up by Fiji as shortcut
> keys, and it usually messes up whatever is running.
>
> Can this behavior be prevented? Is there a way to prevent ImageJ form
> grabbing focus during execution of a script?
>
> Tnx in advance
> --aryeh
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Fiji grabs focus during long scripts

Aryeh Weiss
Hi Jan

Again thank you for your quick reply.

On 22/06/2020 18:30, Jan Eglinger wrote:

> Hi Aryeh,
>
> I'd recommend using 'setBatchMode(true)' in macros whenever possible
> to prevent new windows from being opened.
>
> Other than that, you can use any other supported scripting language
> (e.g. Groovy or Jython) to interact directly with the Java API of
> plugins, and work with objects headlessly instead of having to rely on
> the active image window.
>
I usually program in Jython. However, this problem occurs there also, I
assume that the trouble there occurs when I am using the IJ.run method,
since that opens image windows. I try to use the API calls, but
sometimes I use a  plugin that is much easier to run using IJ.run.

I found that when using the IJ.run method, is is often necessary to
first display an image (ie, to use the imp.show() method) before running
the command in IJ.run. I assume this happens for methods where the
ImagePlus is not passed as an argument, and they ge the image from teh
open and active ImageWindow.

Best regards

--aryeh


> Cheers
> Jan
>
>
> On 22.06.20 16:20, Aryeh Weiss wrote:
>> When I am running a script that takes some time, I do other things
>> like deal with email, use a text editor or LaTeX, etc. the problem is
>> that during the script, Fiji often grabs focus  ( presumably when it
>> displays an image window, or maybe also when it displays any window).
>> When this happens, whatever I have been typing  is picked up by Fiji
>> as shortcut keys, and it usually messes up whatever is running.
>>
>> Can this behavior be prevented? Is there a way to prevent ImageJ form
>> grabbing focus during execution of a script?
>>
>> Tnx in advance
>> --aryeh
>>

--
Aryeh Weiss
Faculty of Engineering
Bar Ilan University
Ramat Gan 52900 Israel

Ph:  972-3-5317638
FAX: 972-3-7384051

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Fiji grabs focus during long scripts

CARL Philippe (LBP)
Dear Aryeh,
I'm under Windows (= 7) OS and when I have similar issues to what you described, I just use the "Windows + m" keys combinaison in order to minimize all windows.
Following, I click then on the task bar the software(s) I want to use (you name them) which I need thus to be again maximized.
By doing so the ImageJ windows aren't anymore coming to the front.
My best regards,
Philippe

Philippe CARL
Laboratoire de Bioimagerie et Pathologies
UMR 7021 CNRS - Université de Strasbourg
Faculté de Pharmacie
74 route du Rhin
67401 ILLKIRCH
Tel : +33(0)3 68 85 42 89

----- Mail original -----
De: "aryeh" <[hidden email]>
À: "imagej" <[hidden email]>
Envoyé: Lundi 22 Juin 2020 18:07:48
Objet: Re: Fiji grabs focus during long scripts

Hi Jan

Again thank you for your quick reply.

On 22/06/2020 18:30, Jan Eglinger wrote:

> Hi Aryeh,
>
> I'd recommend using 'setBatchMode(true)' in macros whenever possible
> to prevent new windows from being opened.
>
> Other than that, you can use any other supported scripting language
> (e.g. Groovy or Jython) to interact directly with the Java API of
> plugins, and work with objects headlessly instead of having to rely on
> the active image window.
>
I usually program in Jython. However, this problem occurs there also, I
assume that the trouble there occurs when I am using the IJ.run method,
since that opens image windows. I try to use the API calls, but
sometimes I use a  plugin that is much easier to run using IJ.run.

I found that when using the IJ.run method, is is often necessary to
first display an image (ie, to use the imp.show() method) before running
the command in IJ.run. I assume this happens for methods where the
ImagePlus is not passed as an argument, and they ge the image from teh
open and active ImageWindow.

Best regards

--aryeh


> Cheers
> Jan
>
>
> On 22.06.20 16:20, Aryeh Weiss wrote:
>> When I am running a script that takes some time, I do other things
>> like deal with email, use a text editor or LaTeX, etc. the problem is
>> that during the script, Fiji often grabs focus  ( presumably when it
>> displays an image window, or maybe also when it displays any window).
>> When this happens, whatever I have been typing  is picked up by Fiji
>> as shortcut keys, and it usually messes up whatever is running.
>>
>> Can this behavior be prevented? Is there a way to prevent ImageJ form
>> grabbing focus during execution of a script?
>>
>> Tnx in advance
>> --aryeh
>>

--
Aryeh Weiss
Faculty of Engineering
Bar Ilan University
Ramat Gan 52900 Israel

Ph:  972-3-5317638
FAX: 972-3-7384051

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

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Fiji grabs focus during long scripts

Aryeh Weiss
Dear Philippe,

Thanks for your reply. I am not sure I can do the same on my Linux
machine, but I may be able to do it with workspaces.

Best regards
--aryeh

On 22/06/2020 19:49, CARL Philippe (LBP) wrote:

> Dear Aryeh,
> I'm under Windows (= 7) OS and when I have similar issues to what you described, I just use the "Windows + m" keys combinaison in order to minimize all windows.
> Following, I click then on the task bar the software(s) I want to use (you name them) which I need thus to be again maximized.
> By doing so the ImageJ windows aren't anymore coming to the front.
> My best regards,
> Philippe
>
> Philippe CARL
> Laboratoire de Bioimagerie et Pathologies
> UMR 7021 CNRS - Université de Strasbourg
> Faculté de Pharmacie
> 74 route du Rhin
> 67401 ILLKIRCH
> Tel : +33(0)3 68 85 42 89
>
> ----- Mail original -----
> De: "aryeh" <[hidden email]>
> À: "imagej" <[hidden email]>
> Envoyé: Lundi 22 Juin 2020 18:07:48
> Objet: Re: Fiji grabs focus during long scripts
>
> Hi Jan
>
> Again thank you for your quick reply.
>
> On 22/06/2020 18:30, Jan Eglinger wrote:
>> Hi Aryeh,
>>
>> I'd recommend using 'setBatchMode(true)' in macros whenever possible
>> to prevent new windows from being opened.
>>
>> Other than that, you can use any other supported scripting language
>> (e.g. Groovy or Jython) to interact directly with the Java API of
>> plugins, and work with objects headlessly instead of having to rely on
>> the active image window.
>>
> I usually program in Jython. However, this problem occurs there also, I
> assume that the trouble there occurs when I am using the IJ.run method,
> since that opens image windows. I try to use the API calls, but
> sometimes I use a  plugin that is much easier to run using IJ.run.
>
> I found that when using the IJ.run method, is is often necessary to
> first display an image (ie, to use the imp.show() method) before running
> the command in IJ.run. I assume this happens for methods where the
> ImagePlus is not passed as an argument, and they ge the image from teh
> open and active ImageWindow.
>
> Best regards
>
> --aryeh
>
>
>> Cheers
>> Jan
>>
>>
>> On 22.06.20 16:20, Aryeh Weiss wrote:
>>> When I am running a script that takes some time, I do other things
>>> like deal with email, use a text editor or LaTeX, etc. the problem is
>>> that during the script, Fiji often grabs focus  ( presumably when it
>>> displays an image window, or maybe also when it displays any window).
>>> When this happens, whatever I have been typing  is picked up by Fiji
>>> as shortcut keys, and it usually messes up whatever is running.
>>>
>>> Can this behavior be prevented? Is there a way to prevent ImageJ form
>>> grabbing focus during execution of a script?
>>>
>>> Tnx in advance
>>> --aryeh
>>>

--
Aryeh Weiss
Faculty of Engineering
Bar Ilan University
Ramat Gan 52900 Israel

Ph:  972-3-5317638
FAX: 972-3-7384051

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