Keyboard shortcuts for the selection tools

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Keyboard shortcuts for the selection tools

Ruszkai Ákos
Hello,

This might be the most trivial question, but I couldn't find the answer in
the documentation, or on the mailing list. Are there any keyboard shortcuts
for the area selection tools and the magnifying glass tool? In some post
I've found that F10 selects magnifying glass, but it didn't work for me
(version: 1.43o). I know I can zoom in/out with the arrow keys or +/-, or
with mouse + ALT modifier, but I still haven't find a way to change tools
with a simple keystroke. I've found it a bit annoying to hit enter to raise
the main window, select the tool I want to use, and click back to my image
every time I need to change a ROI.
Thank you in advance.

Regards,

Ákos
Reply | Threaded
Open this post in threaded view
|

Re: Keyboard shortcuts for the selection tools

Rasband, Wayne (NIH/NIMH) [E]
On Feb 13, 2010, at 3:58 PM, Ákos Ruszkai wrote:

> Hello,
>
> This might be the most trivial question, but I couldn't find the answer in
> the documentation, or on the mailing list. Are there any keyboard shortcuts
> for the area selection tools and the magnifying glass tool? In some post
> I've found that F10 selects magnifying glass, but it didn't work for me
> (version: 1.43o). I know I can zoom in/out with the arrow keys or +/-, or
> with mouse + ALT modifier, but I still haven't find a way to change tools
> with a simple keystroke. I've found it a bit annoying to hit enter to raise
> the main window, select the tool I want to use, and click back to my image
> every time I need to change a ROI.
> Thank you in advance.

You can assign function keys to tools using simple macros like these:

   macro 'Rectangle [f1]' {setTool('rectangle')}
   macro 'Oval [f2]' {setTool('elliptical')}
   macro 'Polygon [f3]' {setTool('brush')}
   macro 'Freehand [f4]' {setTool('polygon')}
   macro 'Straight Line [f5]' {setTool('freehand')}
   macro 'Segmented Line [f6]' {setTool('line')}
   macro 'Angle [f7]' {setTool('freeline')}
   macro 'Crosshair [f8]' {setTool('arrow')}
   macro 'Wand [f9]' {setTool('angle')}
   macro 'Text [f10]' {setTool('multipoint')}
   macro 'Magnifying Glass [f11]' {setTool('wand')}
   macro 'Freeline [f12]' {setTool('zoom')}

Add them to ImageJ/macros/StartupMacros.txt and they will be automatically installed when ImageJ starts.

-wayne
Reply | Threaded
Open this post in threaded view
|

Re: Keyboard shortcuts for the selection tools

Ruszkai Ákos
On 13 February 2010 22:44, Rasband, Wayne (NIH/NIMH) [E] <
[hidden email]> wrote:

> On Feb 13, 2010, at 3:58 PM, Ákos Ruszkai wrote:
>
>
>   macro 'Rectangle [f1]' {setTool('rectangle')}
>   macro 'Oval [f2]' {setTool('elliptical')}
>   macro 'Polygon [f3]' {setTool('brush')}
>   macro 'Freehand [f4]' {setTool('polygon')}
>   macro 'Straight Line [f5]' {setTool('freehand')}
>   macro 'Segmented Line [f6]' {setTool('line')}
>   macro 'Angle [f7]' {setTool('freeline')}
>   macro 'Crosshair [f8]' {setTool('arrow')}
>   macro 'Wand [f9]' {setTool('angle')}
>   macro 'Text [f10]' {setTool('multipoint')}
>   macro 'Magnifying Glass [f11]' {setTool('wand')}
>   macro 'Freeline [f12]' {setTool('zoom')}
>
> Add them to ImageJ/macros/StartupMacros.txt and they will be automatically
> installed when ImageJ starts.
>
> -wayne
>

Thank you very much! It work's like charm, though I had to change some of
the code.
What do you know: following the documentation about macros, I've found the
example of Shortcuts.txt. I've opened my mouth too early again. Now I feel
really dumb.
Another idea comes to my mind: so given with these macros, would be be
possible to create a shortcut, that rebinds itself after getting triggered?
Eg. if I press the button once, it changes to tool x, on the second press it
changes to y, etc. etc. ?

Regards,

Ákos
Reply | Threaded
Open this post in threaded view
|

Re: Keyboard shortcuts for the selection tools

Rasband, Wayne (NIH/NIMH) [E]
On Feb 13, 2010, at 5:11 PM, Ákos Ruszkai wrote:

> On 13 February 2010 22:44, Rasband, Wayne (NIH/NIMH) [E] <
> [hidden email]> wrote:
>
>> On Feb 13, 2010, at 3:58 PM, Ákos Ruszkai wrote:
>>
>>
>>  macro 'Rectangle [f1]' {setTool('rectangle')}
>>  macro 'Oval [f2]' {setTool('elliptical')}
>>  macro 'Polygon [f3]' {setTool('brush')}
>>  macro 'Freehand [f4]' {setTool('polygon')}
>>  macro 'Straight Line [f5]' {setTool('freehand')}
>>  macro 'Segmented Line [f6]' {setTool('line')}
>>  macro 'Angle [f7]' {setTool('freeline')}
>>  macro 'Crosshair [f8]' {setTool('arrow')}
>>  macro 'Wand [f9]' {setTool('angle')}
>>  macro 'Text [f10]' {setTool('multipoint')}
>>  macro 'Magnifying Glass [f11]' {setTool('wand')}
>>  macro 'Freeline [f12]' {setTool('zoom')}
>>
>> Add them to ImageJ/macros/StartupMacros.txt and they will be automatically
>> installed when ImageJ starts.
>>
>> -wayne
>>
>
> Thank you very much! It work's like charm, though I had to change some of
> the code.
> What do you know: following the documentation about macros, I've found the
> example of Shortcuts.txt. I've opened my mouth too early again. Now I feel
> really dumb.
> Another idea comes to my mind: so given with these macros, would be be
> possible to create a shortcut, that rebinds itself after getting triggered?
> Eg. if I press the button once, it changes to tool x, on the second press it
> changes to y, etc. etc. ?

Here is a macro that switches to another tool each time you press F1:

  var index = 0;
  var tools = newArray('rectangle','elliptical','brush','polygon',
     'freehand','line','polyline','freeline','arrow','angle','point',
     'multipoint','wand','text','zoom','hand','dropper');

  macro 'Switch Tools [f1]' {
     setTool(tools[index]);
     index++;
     if (index==tools.length) index = 0;
  }

-wayne