Hello,
Does anybody know the name of the macro or plugin or function called when the mouse is pressed on the "Freehand selection" button in the ImageJ toolbar ??? Please HELP .... Thanks Blandine |
>Hello,
> >Does anybody know the name of the macro or plugin or function called when >the mouse is pressed on the "Freehand selection" button in the ImageJ >toolbar ??? > Still searching on that? I've given up. I'm not sure, but I don't think anything happens when you press that button, what happens is described in ImageCanvas. Though I've got to disappoint you on that, I've studied the code, I've tried almost everything, but still nothing works. _________________________________________________________________ Gratis bloggen op MSN Spaces http://spaces.msn.com/?mkt=nl-be |
Hello,
the only thing that happens when one of those buttons is pressed is that the selected tool changes. It depends on the selected tool what happens when you click on an image afterwards. Volker Sabine De Vreese wrote: >> Hello, >> >> Does anybody know the name of the macro or plugin or function called >> when the mouse is pressed on the "Freehand selection" button in the >> ImageJ toolbar ??? >> > Still searching on that? I've given up. I'm not sure, but I don't > think anything happens when you press that button, what happens is > described in ImageCanvas. Though I've got to disappoint you on that, > I've studied the code, I've tried almost everything, but still nothing > works. > > _________________________________________________________________ > Gratis bloggen op MSN Spaces http://spaces.msn.com/?mkt=nl-be > -- passerelle antivirus du campus CNRS de Montpellier -- |
In reply to this post by Blandine Chanteloup
Finally,
I've defined a FreehandRoiBis classe inherited from the FreehandRoi one where the grow() method is public and not protected. And here is my code: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class JFrame_TestImageJROI extends javax.swing.JFrame implements MouseListener, MouseMotionListener { private ij.IJ myImageJ; private ij.ImagePlus myImagePlus; private ij.process.ImageProcessor myImageProcessor; private ij.gui.ImageCanvas myImageCanvas; private FreehandRoiBis roi; int xOrigROI; int yOrigROI; public static void main(String[] args) { JFrame_TestImageJROI inst = new JFrame_TestImageJROI(); inst.setVisible(true); } public JFrame_TestImageJROI() { super(); initGUI(); } private void initGUI() { try { setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setFocusable(false); pack(); setSize(400, 300); myImageJ = new ij.IJ(); myImageJ.open("image.bmp"); myImagePlus = myImageJ.getImage(); myImageProcessor = myImagePlus.getProcessor(); myImageProcessor.setColor(Color.yellow); myImageProcessor.setLineWidth(2); myImageCanvas = new ij.gui.ImageCanvas(myImagePlus); this.add(myImageCanvas); myImageCanvas.addMouseListener(this); myImageCanvas.addMouseMotionListener(this); } catch (Exception e) { e.printStackTrace(); } } public void mousePressed(MouseEvent evt) { xOrigROI = evt.getX(); yOrigROI = evt.getY(); roi = new FreehandRoiBis(evt.getX(), evt.getY(), myImagePlus); myImagePlus.setRoi(roi); roi.drawPixels(myImageProcessor); myImagePlus.setProcessor(null,myImageProcessor); myImageCanvas.repaint(); } public void mouseDragged(MouseEvent evt) { roi.grow(evt.getX(), evt.getY()); roi.drawPixels(myImageProcessor); myImagePlus.setProcessor(null,myImageProcessor); myImageCanvas.repaint(); } public void mouseReleased(MouseEvent evt) { roi.grow(xOrigROI,yOrigROI); roi.drawPixels(myImageProcessor); myImagePlus.setProcessor(null,myImageProcessor); myImageCanvas.repaint(); } public void mouseClicked(MouseEvent evt) {} public void mouseExited(MouseEvent evt) {} public void mouseEntered(MouseEvent evt) {} public void mouseMoved(MouseEvent evt) {} } Thanks everybody and especially Volker >Hello, > >Does anybody know the name of the macro or plugin or function called when >the mouse is pressed on the "Freehand selection" button in the ImageJ >toolbar ??? > >Please HELP .... > >Thanks > >Blandine |
Would you mind sharing the code of FreehandRoiBis? I'm still having
difficulties ... (e.g. for roi.drawPixels(myImageProcessor); I'm getting a compiler error (drawPixels() in ij.gui.Roi cannot be applied to (ij.process.ImageProcessor)). Thanks a lot! > >Finally, > >I've defined a FreehandRoiBis classe inherited from the FreehandRoi one >where the grow() method is public and not protected. >And here is my code: > >import java.awt.*; >import java.awt.event.*; >import javax.swing.*; > >public class JFrame_TestImageJROI extends javax.swing.JFrame > implements MouseListener, MouseMotionListener { > private ij.IJ myImageJ; > private ij.ImagePlus myImagePlus; > private ij.process.ImageProcessor myImageProcessor; > private ij.gui.ImageCanvas myImageCanvas; > > private FreehandRoiBis roi; > > int xOrigROI; > int yOrigROI; > > public static void main(String[] args) { > JFrame_TestImageJROI inst = new JFrame_TestImageJROI(); > inst.setVisible(true); > } > > public JFrame_TestImageJROI() { > super(); > initGUI(); > } > > private void initGUI() { > try { > >setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); > this.setFocusable(false); > pack(); > setSize(400, 300); > myImageJ = new ij.IJ(); > myImageJ.open("image.bmp"); > myImagePlus = myImageJ.getImage(); > myImageProcessor = myImagePlus.getProcessor(); > myImageProcessor.setColor(Color.yellow); > myImageProcessor.setLineWidth(2); > > myImageCanvas = new >ij.gui.ImageCanvas(myImagePlus); > this.add(myImageCanvas); > > myImageCanvas.addMouseListener(this); > myImageCanvas.addMouseMotionListener(this); > > } catch (Exception e) { > e.printStackTrace(); > } > } > public void mousePressed(MouseEvent evt) { > xOrigROI = evt.getX(); > yOrigROI = evt.getY(); > roi = new FreehandRoiBis(evt.getX(), evt.getY(), >myImagePlus); > myImagePlus.setRoi(roi); > roi.drawPixels(myImageProcessor); > myImagePlus.setProcessor(null,myImageProcessor); > myImageCanvas.repaint(); > } > public void mouseDragged(MouseEvent evt) { > roi.grow(evt.getX(), evt.getY()); > roi.drawPixels(myImageProcessor); > myImagePlus.setProcessor(null,myImageProcessor); > myImageCanvas.repaint(); > } > public void mouseReleased(MouseEvent evt) { > roi.grow(xOrigROI,yOrigROI); > roi.drawPixels(myImageProcessor); > myImagePlus.setProcessor(null,myImageProcessor); > myImageCanvas.repaint(); > } > public void mouseClicked(MouseEvent evt) {} > public void mouseExited(MouseEvent evt) {} > public void mouseEntered(MouseEvent evt) {} > public void mouseMoved(MouseEvent evt) {} >} > >Thanks everybody and especially Volker > > >>Hello, >> >>Does anybody know the name of the macro or plugin or function called when >>the mouse is pressed on the "Freehand selection" button in the ImageJ >>toolbar ??? >> >>Please HELP .... >> >>Thanks >> >>Blandine _________________________________________________________________ Bescherm je Inbox: Phishing - hoe te herkennen, rapporteren en voorkomen http://www.msn.be/security/phishing/ |
Here is the code of FreehandRoiBis :
import ij.*; import ij.gui.*; public class FreehandRoiBis extends FreehandRoi { public FreehandRoiBis(int x, int y, ImagePlus imp) { super(x, y, imp); } public void grow(int ox, int oy) { super.grow(ox, oy); } } Hope that will help you &;) >Would you mind sharing the code of FreehandRoiBis? I'm still having >difficulties ... >(e.g. for roi.drawPixels(myImageProcessor); I'm getting a compiler error >(drawPixels() in ij.gui.Roi cannot be applied to >(ij.process.ImageProcessor)). Thanks a lot! > > >> >>Finally, >> >>I've defined a FreehandRoiBis classe inherited from the FreehandRoi one >>where the grow() method is public and not protected. >>And here is my code: >> >>import java.awt.*; >>import java.awt.event.*; >>import javax.swing.*; >> >>public class JFrame_TestImageJROI extends javax.swing.JFrame >> implements MouseListener, MouseMotionListener { >> private ij.IJ myImageJ; >> private ij.ImagePlus myImagePlus; >> private ij.process.ImageProcessor myImageProcessor; >> private ij.gui.ImageCanvas myImageCanvas; >> >> private FreehandRoiBis roi; >> >> int xOrigROI; >> int yOrigROI; >> >> public static void main(String[] args) { >> JFrame_TestImageJROI inst = new JFrame_TestImageJROI(); >> inst.setVisible(true); >> } >> >> public JFrame_TestImageJROI() { >> super(); >> initGUI(); >> } >> >> private void initGUI() { >> try { >> >>setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); >> this.setFocusable(false); >> pack(); >> setSize(400, 300); >> myImageJ = new ij.IJ(); >> myImageJ.open("image.bmp"); >> myImagePlus = myImageJ.getImage(); >> myImageProcessor = myImagePlus.getProcessor(); >> myImageProcessor.setColor(Color.yellow); >> myImageProcessor.setLineWidth(2); >> >> myImageCanvas = new ij.gui.ImageCanvas(myImagePlus); >> this.add(myImageCanvas); >> >> myImageCanvas.addMouseListener(this); >> myImageCanvas.addMouseMotionListener(this); >> >> } catch (Exception e) { >> e.printStackTrace(); >> } >> } >> public void mousePressed(MouseEvent evt) { >> xOrigROI = evt.getX(); >> yOrigROI = evt.getY(); >> roi = new FreehandRoiBis(evt.getX(), evt.getY(), >> myImagePlus); >> myImagePlus.setRoi(roi); >> roi.drawPixels(myImageProcessor); >> myImagePlus.setProcessor(null,myImageProcessor); >> myImageCanvas.repaint(); >> } >> public void mouseDragged(MouseEvent evt) { >> roi.grow(evt.getX(), evt.getY()); >> roi.drawPixels(myImageProcessor); >> myImagePlus.setProcessor(null,myImageProcessor); >> myImageCanvas.repaint(); >> } >> public void mouseReleased(MouseEvent evt) { >> roi.grow(xOrigROI,yOrigROI); >> roi.drawPixels(myImageProcessor); >> myImagePlus.setProcessor(null,myImageProcessor); >> myImageCanvas.repaint(); >> } >> public void mouseClicked(MouseEvent evt) {} >> public void mouseExited(MouseEvent evt) {} >> public void mouseEntered(MouseEvent evt) {} >> public void mouseMoved(MouseEvent evt) {} >>} >> >>Thanks everybody and especially Volker >> >> >>>Hello, >>> >>>Does anybody know the name of the macro or plugin or function called >>>when the mouse is pressed on the "Freehand selection" button in the >>>ImageJ toolbar ??? >>> >>>Please HELP .... >>> >>>Thanks >>> >>>Blandine |
Free forum by Nabble | Edit this page |