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();Read the ImageJ documentation for more details about plugins:
if (manager == null){
manager = new RoiManager();
}
manager.addRoi(polRoi);
}
}
http://imagej.nih.gov/ij/docs/guide/146-16.html#toc-Section-16
http://imagej.1557.x6.nabble.com/add-a-set-of-point-coordinates-to-ROI-manager-tp5009232p5009412.htmlIf you reply to this email, your message will be added to the discussion below:
Free forum by Nabble | Disable Popup Ads | Edit this page |