http://imagej.273.s1.nabble.com/Adding-keyboard-shortcut-to-toggle-visibility-of-patches-in-TrakEM2-tp5016099p5016102.html
window canvas, and react upon its keyPressed KeyEvent.
The canvas element you can get from Display.getFront().getCanvas().
...
> Dear List,
> I'm using TrakEM2 to analyze huge multi-channel confocal reconstructions.
> I'm
> importing the channels as separate 8-bit patches with the antigen specified
> within the patch name, apply a LUT with "adjust image filters" and set the
> composite mode to Add.
> To switch on and off a channel I'm using the "select all that match
> function". Nonetheless, this method is very slow, and it would be much
> better if one could define keyboard shortcuts for that.
> I wrote this simple script to toggle visibility of patches based on their
> names, but I can't figure out how I could call it from a keyboard shortcut
> inside TraKEM2.
>
> Any hint will be greatly appreciated
> Thank you very much!
>
> Federico
>
> Here is an example of the script:
>
> from ini.trakem2.display import *
>
> for layer in Display.getFront().getLayerSet().getLayers():
> patches = layer.getDisplayables(Patch)
> for patch in patches:
> if "DCX" in patch.title:
> if patch.visible == True:
> patch.visible = False
> else:
> patch.visible = True
>
>
>
> --
> Federico Luzzati, PhD
> Assistant Professor
> University of Turin,
> Dept. LIfe Sciences and Systems Biology (DBIOS)
> Via Accademia Albertina, 13 - 10123 Torino - IT
>
> Researcher at
> Neuroscience Institute Cavalieri Ottolenghi (NICO)
> Regione Gonzole, 10 - 10043 Orbassano (To) - IT
>
> tel. +39-0116704683/ -6631
>
http://www.nico.ottolenghi.unito.it/index.php/it/adult-neurogenesis>
> Sostieni con il tuo 5xmille il NICO e la ricerca sulle malattie
> neurodegenerative
> Firma nel riquadro "Finanziamento della ricerca scientifica e
> dell'Università"
> CF 97564560015
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>