TrakEM2 help on keyboard shortcuts

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

TrakEM2 help on keyboard shortcuts

Bohumil Maco
Dear Experts,

Please, can somebody help me with my following issue: I am using TrakEM2 to
proofreading and editing my neuronal network segmentation output and I am
using a graphical tablet and pen and I need very often to use area list
selection tool and paint brush tool....which is not very convenient using
table pen to select them from the TrakEM2 tools bar.

I was searching without any success to create and use keyboard short cuts
to quickly select them and to switch between them.

Is there a way to create a keyboard shortcuts to quickly select the
selection tool and paint brush in TrakEM2?

Any suggestions are welcome while it will save me a lot of time  and make
the error editing process faster.

Thank you very much for any advice.

Cheers,

Bohumil

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

Re: TrakEM2 help on keyboard shortcuts

Fco. Javier Diez Guerra
Hi Bohumil,

Have you tried the ActionBar plugin, from Jerome Mutterer and others?

Visit https://imagejdocu.tudor.lu/plugin/utilities/action_bar/start for
detailed info.

Good luck!

Javier


El 16/10/2020 a las 14:46, Bohumil Maco escribió:

> Dear Experts,
>
> Please, can somebody help me with my following issue: I am using TrakEM2 to
> proofreading and editing my neuronal network segmentation output and I am
> using a graphical tablet and pen and I need very often to use area list
> selection tool and paint brush tool....which is not very convenient using
> table pen to select them from the TrakEM2 tools bar.
>
> I was searching without any success to create and use keyboard short cuts
> to quickly select them and to switch between them.
>
> Is there a way to create a keyboard shortcuts to quickly select the
> selection tool and paint brush in TrakEM2?
>
> Any suggestions are welcome while it will save me a lot of time  and make
> the error editing process faster.
>
> Thank you very much for any advice.
>
> Cheers,
>
> Bohumil
>
> --
> 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: TrakEM2 help on keyboard shortcuts

Albert Cardona-2
In reply to this post by Bohumil Maco
Hi Bohumil,
I've looked into the TrakEM2 source code, and:

F11 selects the pen tool;
F12 selects the brush tool.

See:
https://github.com/trakem2/TrakEM2/blob/master/src/main/java/ini/trakem2/utils/ProjectToolbar.java#L267

If these aren't convenient, it's easy to create other ways to activate
the pen tool or the brush tool. For example, you could create a mouse
listener that recognizes a gesture, which could be e.g. moving back
and forth within a corner or a screen, or something similarly easy
such as moving your mouse to a corner of the screen. I.e., in jython:

```
from ini.trakem2.display import Display
from java.awt.event import MouseAdapter

class ToolToggle(MouseAdapter):
  def __init__(self):
    self.outside = True
  def mouseMoved(self, event):
    x, y = event.getXOnScreen(), event.getYOnScreen()
    if x < 100 and y < 100: # top left corner
      if self.outside: # only toggle if mouse was outside
        self.outside = False # prevent toggling until mouse is moved
outside and back in
        if ProjectToolbar.getToolId() == ProjectToolbar.PEN:
          ProjectToolbar.setTool(ProjectToolbar.BRUSH)
        else:
          ProjectToolbar.setTool(ProjectToolbar.PEN)
    else:
      self.outside = True

front = Display.getFront()
front.getCanvas().addMouseListener(ToolToggle())
```

Run the script from the Script Editor after opening TrakEM2, and your
upper left corner will be a toggle between both tools. All you have to
do is move the mouse there.

Haven't tested the above script, hopefully errors if any are obvious.

Hope this helps.

Albert

Missatge de Bohumil Maco <[hidden email]> del dia dv., 16
d’oct. 2020 a les 12:48:

>
> Dear Experts,
>
> Please, can somebody help me with my following issue: I am using TrakEM2 to
> proofreading and editing my neuronal network segmentation output and I am
> using a graphical tablet and pen and I need very often to use area list
> selection tool and paint brush tool....which is not very convenient using
> table pen to select them from the TrakEM2 tools bar.
>
> I was searching without any success to create and use keyboard short cuts
> to quickly select them and to switch between them.
>
> Is there a way to create a keyboard shortcuts to quickly select the
> selection tool and paint brush in TrakEM2?
>
> Any suggestions are welcome while it will save me a lot of time  and make
> the error editing process faster.
>
> Thank you very much for any advice.
>
> Cheers,
>
> Bohumil
>
> --
> 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: TrakEM2 help on keyboard shortcuts

Albert Cardona-2
The code of course had problems, as it wasn't tested: should have been
addMouseMotionListener, and also, no mouse movement is detected
outside the canvas itself. So the code would have to be adjusted for
that.

Missatge de Albert Cardona <[hidden email]> del dia dv., 16 d’oct.
2020 a les 14:01:

>
> Hi Bohumil,
> I've looked into the TrakEM2 source code, and:
>
> F11 selects the pen tool;
> F12 selects the brush tool.
>
> See:
> https://github.com/trakem2/TrakEM2/blob/master/src/main/java/ini/trakem2/utils/ProjectToolbar.java#L267
>
> If these aren't convenient, it's easy to create other ways to activate
> the pen tool or the brush tool. For example, you could create a mouse
> listener that recognizes a gesture, which could be e.g. moving back
> and forth within a corner or a screen, or something similarly easy
> such as moving your mouse to a corner of the screen. I.e., in jython:
>
> ```
> from ini.trakem2.display import Display
> from java.awt.event import MouseAdapter
>
> class ToolToggle(MouseAdapter):
>   def __init__(self):
>     self.outside = True
>   def mouseMoved(self, event):
>     x, y = event.getXOnScreen(), event.getYOnScreen()
>     if x < 100 and y < 100: # top left corner
>       if self.outside: # only toggle if mouse was outside
>         self.outside = False # prevent toggling until mouse is moved
> outside and back in
>         if ProjectToolbar.getToolId() == ProjectToolbar.PEN:
>           ProjectToolbar.setTool(ProjectToolbar.BRUSH)
>         else:
>           ProjectToolbar.setTool(ProjectToolbar.PEN)
>     else:
>       self.outside = True
>
> front = Display.getFront()
> front.getCanvas().addMouseListener(ToolToggle())
> ```
>
> Run the script from the Script Editor after opening TrakEM2, and your
> upper left corner will be a toggle between both tools. All you have to
> do is move the mouse there.
>
> Haven't tested the above script, hopefully errors if any are obvious.
>
> Hope this helps.
>
> Albert
>
> Missatge de Bohumil Maco <[hidden email]> del dia dv., 16
> d’oct. 2020 a les 12:48:
> >
> > Dear Experts,
> >
> > Please, can somebody help me with my following issue: I am using TrakEM2 to
> > proofreading and editing my neuronal network segmentation output and I am
> > using a graphical tablet and pen and I need very often to use area list
> > selection tool and paint brush tool....which is not very convenient using
> > table pen to select them from the TrakEM2 tools bar.
> >
> > I was searching without any success to create and use keyboard short cuts
> > to quickly select them and to switch between them.
> >
> > Is there a way to create a keyboard shortcuts to quickly select the
> > selection tool and paint brush in TrakEM2?
> >
> > Any suggestions are welcome while it will save me a lot of time  and make
> > the error editing process faster.
> >
> > Thank you very much for any advice.
> >
> > Cheers,
> >
> > Bohumil
> >
> > --
> > 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: TrakEM2 help on keyboard shortcuts

Bohumil Maco
Hi Albert,

You are the rock!!!!! F11 and F12 work perfectly!!!!! this is exactly I
needed.

Thanks a lot!!!!

The second solution is not really a good one... I will be in the same
situation I was until your e-mail arrived: imagine you are checking an area
list on the right side of your screen and you need edit few times several
area lists close by....any time you want to paint, you need to go to the
selection tool which in TrakEM2 is fixed to the left side, and then paint
brush.....

Anyway, F11 and F12 key suggestions are great.

Thank you so much!!!!!

Bohumil

PS: Hope you and your family are OK during these strange times.....

On Fri, Oct 16, 2020 at 4:35 PM Albert Cardona <[hidden email]> wrote:

> The code of course had problems, as it wasn't tested: should have been
> addMouseMotionListener, and also, no mouse movement is detected
> outside the canvas itself. So the code would have to be adjusted for
> that.
>
> Missatge de Albert Cardona <[hidden email]> del dia dv., 16 d’oct.
> 2020 a les 14:01:
> >
> > Hi Bohumil,
> > I've looked into the TrakEM2 source code, and:
> >
> > F11 selects the pen tool;
> > F12 selects the brush tool.
> >
> > See:
> >
> https://github.com/trakem2/TrakEM2/blob/master/src/main/java/ini/trakem2/utils/ProjectToolbar.java#L267
> >
> > If these aren't convenient, it's easy to create other ways to activate
> > the pen tool or the brush tool. For example, you could create a mouse
> > listener that recognizes a gesture, which could be e.g. moving back
> > and forth within a corner or a screen, or something similarly easy
> > such as moving your mouse to a corner of the screen. I.e., in jython:
> >
> > ```
> > from ini.trakem2.display import Display
> > from java.awt.event import MouseAdapter
> >
> > class ToolToggle(MouseAdapter):
> >   def __init__(self):
> >     self.outside = True
> >   def mouseMoved(self, event):
> >     x, y = event.getXOnScreen(), event.getYOnScreen()
> >     if x < 100 and y < 100: # top left corner
> >       if self.outside: # only toggle if mouse was outside
> >         self.outside = False # prevent toggling until mouse is moved
> > outside and back in
> >         if ProjectToolbar.getToolId() == ProjectToolbar.PEN:
> >           ProjectToolbar.setTool(ProjectToolbar.BRUSH)
> >         else:
> >           ProjectToolbar.setTool(ProjectToolbar.PEN)
> >     else:
> >       self.outside = True
> >
> > front = Display.getFront()
> > front.getCanvas().addMouseListener(ToolToggle())
> > ```
> >
> > Run the script from the Script Editor after opening TrakEM2, and your
> > upper left corner will be a toggle between both tools. All you have to
> > do is move the mouse there.
> >
> > Haven't tested the above script, hopefully errors if any are obvious.
> >
> > Hope this helps.
> >
> > Albert
> >
> > Missatge de Bohumil Maco <[hidden email]> del dia dv., 16
> > d’oct. 2020 a les 12:48:
> > >
> > > Dear Experts,
> > >
> > > Please, can somebody help me with my following issue: I am using
> TrakEM2 to
> > > proofreading and editing my neuronal network segmentation output and I
> am
> > > using a graphical tablet and pen and I need very often to use area list
> > > selection tool and paint brush tool....which is not very convenient
> using
> > > table pen to select them from the TrakEM2 tools bar.
> > >
> > > I was searching without any success to create and use keyboard short
> cuts
> > > to quickly select them and to switch between them.
> > >
> > > Is there a way to create a keyboard shortcuts to quickly select the
> > > selection tool and paint brush in TrakEM2?
> > >
> > > Any suggestions are welcome while it will save me a lot of time  and
> make
> > > the error editing process faster.
> > >
> > > Thank you very much for any advice.
> > >
> > > Cheers,
> > >
> > > Bohumil
> > >
> > > --
> > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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