Hi,
I just noticed that when zoomed in my mouse wheel scrolls the image vertically. That is great! I have lots of problems with the space bar zooming. For instance unless I remember to click on the image the space bar will push the last used button on my plugin. I tried all sorts of other keys (cntrl, shift, etc) to get the wheel to scroll horizontally but couldn't find one. Is there any way to get this functionality? Jon |
Hello, I have modified the plugin scrollable-stackwindow (by
Johannes Schindlin) to have a mouse wheel control of the current image/stack... it allows fast "zoom in - zoom out" in different zones of the image, I hope it helps to you... Leon //--------------------------------------------- import ij.IJ; import ij.ImagePlus; import ij.gui.ImageCanvas; import ij.gui.StackWindow; import ij.plugin.PlugIn; import ij.plugin.*; import java.awt.event.MouseWheelListener; import java.awt.event.MouseWheelEvent; public class Scrollable_Zoom implements PlugIn { public void run(String arg) { ImagePlus image = IJ.getImage(); image.setWindow(new Window(image, image.getCanvas())); } static class Window extends StackWindow implements MouseWheelListener { public Window(ImagePlus image, ImageCanvas canvas) { super(image, canvas); addMouseWheelListener(this); } public void mouseWheelMoved(MouseWheelEvent event) { synchronized(this) { int zoom = event.getWheelRotation(); if (zoom<0) IJ.run("In"); else IJ.run("Out"); } } } } //--------------------------------------------------------- Le 23 mai 07 à 00:16, Jon Harman a écrit : > Hi, > > I just noticed that when zoomed in my mouse wheel scrolls the image > vertically. That is great! I have lots of problems with the space > bar zooming. For instance unless I remember to click on the image > the space bar will push the last used button on my plugin. I tried > all sorts of other keys (cntrl, shift, etc) to get the wheel to > scroll horizontally but couldn't find one. Is there any way to get > this functionality? > > Jon > Leon Espinosa [hidden email] Laboratoire des Rickettsies du Pr. RAOULT UMR CNRS 6020 Fac. de Medecine de la Timone 27 Bd Jean Moulin 13005 Marseille tel 04 91 38 55 17 fax 04 91 38 77 72 portable 06 79 25 97 40 |
Hi,
Thanks! That shows me how to implement my own MouseWheelListener and it gave me a clue of where to search the IJ code for the scrolling behavior. I see that horizontal scrolling requires the space bar be down. Below is my solution which avoids the space key. Questions How do I disable the default spacebar behavior in my panel. IJ.spaceBarDown() doesn't appear to work in my action listener that gets the button clicks. Why does IJ use the space bar instead of (say) the ctrl or shift key? Shift or ctrl is typically used as a modification key, the space bar is not. Why no IJ.ctrlKeyDown()? I guess the ctrl key must be handled differently. Jon /* implement mw zoom and pan */ public void mouseWheelMoved(MouseWheelEvent event) { synchronized(this) { int rotation = event.getWheelRotation(); int width = imp.getWidth(); int height = imp.getHeight(); Rectangle srcRect = ic.getSrcRect(); int xstart = srcRect.x; int ystart = srcRect.y; if(IJ.altKeyDown()){ srcRect.y += rotation*Math.max(height/200, 1); if (srcRect.y<0) srcRect.y = 0; if (srcRect.y+srcRect.height>height) srcRect.y = height-srcRect.height; if (srcRect.x!=xstart || srcRect.y!=ystart) ic.repaint(); } else if(IJ.shiftKeyDown()){ srcRect.x += rotation*Math.max(width/200, 1); if (srcRect.x<0) srcRect.x = 0; if (srcRect.x+srcRect.width>width) srcRect.x = width-srcRect.width; if (srcRect.x!=xstart || srcRect.y!=ystart) ic.repaint(); } else { if (rotation<0) IJ.run("In"); else IJ.run("Out"); } } } Leon Espinosa wrote: > Hello, I have modified the plugin scrollable-stackwindow (by Johannes > Schindlin) to have a mouse wheel control of the current image/stack... > it allows fast "zoom in - zoom out" in different zones of the image, I > hope it helps to you... > > Leon > > //--------------------------------------------- > > import ij.IJ; > import ij.ImagePlus; > import ij.gui.ImageCanvas; > import ij.gui.StackWindow; > import ij.plugin.PlugIn; > import ij.plugin.*; > > import java.awt.event.MouseWheelListener; > import java.awt.event.MouseWheelEvent; > > public class Scrollable_Zoom implements PlugIn { > public void run(String arg) { > ImagePlus image = IJ.getImage(); > image.setWindow(new Window(image, image.getCanvas())); > } > > static class Window extends StackWindow implements > MouseWheelListener { > public Window(ImagePlus image, ImageCanvas canvas) { > super(image, canvas); > addMouseWheelListener(this); > } > > public void mouseWheelMoved(MouseWheelEvent event) { > synchronized(this) { > int zoom = event.getWheelRotation(); > if (zoom<0) IJ.run("In"); > else IJ.run("Out"); > } > } > } > } > > //--------------------------------------------------------- > > > Le 23 mai 07 à 00:16, Jon Harman a écrit : > >> Hi, >> >> I just noticed that when zoomed in my mouse wheel scrolls the image >> vertically. That is great! I have lots of problems with the space >> bar zooming. For instance unless I remember to click on the image >> the space bar will push the last used button on my plugin. I tried >> all sorts of other keys (cntrl, shift, etc) to get the wheel to >> scroll horizontally but couldn't find one. Is there any way to get >> this functionality? >> >> Jon >> > > Leon Espinosa > [hidden email] > > Laboratoire des Rickettsies du Pr. RAOULT > UMR CNRS 6020 > Fac. de Medecine de la Timone > 27 Bd Jean Moulin > 13005 Marseille > > tel 04 91 38 55 17 > fax 04 91 38 77 72 > > portable 06 79 25 97 40 > |
Hi Jon,
the spacebar is used for panning by many programs, such as Photoshop, gimp, some CAD programs and others. I like the idea of having the same shortcuts/modifiers in Photoshop and ImageJ, even though ImageJ, as it is getting better and better, takes over many tasks that I did in Photoshop previously. Michael ________________________________________________________________ On 23 May 2007, at 18:46, Jon Harman wrote: > Why does IJ use the space bar instead of (say) the ctrl or shift > key? Shift or ctrl is typically used as a modification key, the > space bar is not. |
In reply to this post by Jon Harman
> ------------------------------------------------------------------------------
> --------- > > > Dear list member, We actually want to use imageJ with LEICA system contructing on Macrozoom The software provided by constructor is not a usefull tool and is not working on Mac.... Someone use mac with ImageJ and aquire live image... Regards Dr. Damien PIETRIN -Department of Anaesthesia and Critical Care University Hospital, Pôle Mère-Enfants Spécialités 4, Rue Larrey F49033 Angers CEDEX France Mail : [hidden email] Tel: (33)241353637 Poste 42598 Dr. Damien PIETRIN -Laboratory of Experimental Anaesthesiology, Neurobiology, Neuropharmacology and Transgenesis UPRES EA 3143. Bâtiment Montéclaire 4, Rue Larrey F49033 Angers CEDEX France mail: [hidden email] Tel (33)241353637 Poste 42598 |
In reply to this post by Jon Harman
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 > Why does IJ use the space bar instead of (say) the ctrl or shift key? > Shift or ctrl is typically used as a modification key, the space bar is > not. Beware that the ctrl-mouse-wheel triggers a zoom into the desktop on MacOS X. It might be possible to turn this off, but maybe avoid ctrl (or use Cmd or Shift on Macs). > I just noticed that when zoomed in my mouse wheel scrolls the image > vertically. That is great! Only if you are not in a stack (where the mouse wheel controls the slice number). Personnally I am not very fond of using the (1D) mouse-wheel to scroll around (using it for Z-scrolling and/or zooming in/out seems a more intuitive job for a 1D device), I prefer Space-bar+mouse-dragging. But tastes/preferences vary. Note that the "panning bug while defining a ROI" (which I mentioned in the concurrent thread "zoom with scroll bars") appears in a slightly modified form with mouse-wheel panning: If you pan horizontally (space+mouse-wheel) while defining a rectangular ROI and by mistake move the mouse (space+mouse-move: pan by dragging), the image jumps to an entirely different location. While mouse-wheel-panning (vertically or horizontally) the active ROI corner does not stick to the mouse cursor, but that is only a minor bug: it will jump to the cursor once you let go the space key and move the mouse. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGVVeZUKl/wQSyHWgRAv4hAJ4hcPlhM9gHOpxi25Kr3kGKCXBBQQCffPnf fM+SedkyZmZuFV6o+62jTYA= =XH2s -----END PGP SIGNATURE----- |
Free forum by Nabble | Edit this page |