Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
3 posts
|
This post was updated on Aug 15, 2014; 12:50pm.
I have a set of point (I have their x,y pixel coordinates) that I would like to add to the ROI manager. how do I do that?
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
91 posts
|
Here is a small code snippet:
************************************** ImagePlus imp = IJ.getImage(); /*Create a Polygon ROI!*/ int[] xp = { 5, 50, 100, 150, 200, 250, 300 }; int[] yp = { 100, 200, 200, 200, 200, 100 }; PolygonRoi polRoi = new PolygonRoi(xp, yp, 6, Roi.POLYGON); imp.setRoi(polRoi); /*Add the ROI to the ROI Manager!*/ RoiManager manager = RoiManager.getInstance(); if (manager == null) { manager = new RoiManager(); } manager.addRoi(polRoi); ************************************* For different ROI types see: http://rsbweb.nih.gov/ij/developer/api/ij/gui/Roi.html |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
3 posts
|
Hi, So sorry but I'm a newbie... where do I put this code? 2014-08-18 9:55 GMT+03:00 Bio7 [via ImageJ] <[hidden email]>:
Here is a small code snippet: ... [show rest of quote] |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
91 posts
|
Hello,
1. Start ImageJ and create a new Java Plugin: Plugins->New->Plugin 2. Paste the code below in the ImageJ editor (overwrite the default code) 3. Save the file in the ImageJ plugins directory 4. Open an example image 5. Compile and run the plugin from the text editor: File->Compile and Run import ij.IJ; import ij.ImagePlus; import ij.gui.PolygonRoi; import ij.gui.Roi; import ij.plugin.PlugIn; import ij.plugin.frame.RoiManager; public class My_Plugin implements PlugIn { public void run(String arg) { ImagePlus imp = IJ.getImage(); int[] xp = { 5, 50, 100, 150, 200, 250, 300 }; int[] yp = { 100, 200, 200, 200, 200, 100 }; PolygonRoi polRoi = new PolygonRoi(xp, yp, 6, Roi.POLYGON); imp.setRoi(polRoi); RoiManager manager = RoiManager.getInstance(); if (manager == null){ manager = new RoiManager(); } manager.addRoi(polRoi); } } Read the ImageJ documentation for more details about plugins: http://imagej.nih.gov/ij/docs/guide/146-16.html#toc-Section-16 |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
3 posts
|
nice! thanks it works :) 2014-08-29 9:57 GMT+03:00 Bio7 [via ImageJ] <[hidden email]>:
Hello, ... [show rest of quote] |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
1 post
|
In reply to this post by Marcel
Hello,
i tried to run the code but i get an Macro error saying there is an undefinded variable in line 1 (import ij.IJ; ) How can I fix this? Thank you |
Free forum by Nabble | Disable Popup Ads | Edit this page |