Re: Change PointROI properties with Java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Change PointROI properties with Java

Rasband, Wayne (NIH/NIMH) [E]
> On Jan 8, 2016, at 12:25 PM, ArtemisUser <[hidden email]> wrote:
>
> Hi there,
>
> when I add a Point to a ROI Manger, I have the possibility to change in
> "properties" point typ and size.
> I'm writing a plugin and I have to change point typ and size of a point that
> is added to a ROI manager, but without doing it myself, because in my plugin
> the manager is not visible to the user.

Your plugin can set the color, type and size of the point, or set of points, before adding it to the ROI Manager. The following JavaScript example adds two sets of points to a hidden ROI Manager. Each set of points has a different color, type and size.

-wayne

  hybrid=0; crosshair=1; dot=2; circle=3;
  tiny=0; small=1; medium=2; large=3; xlarge=4;
  hidden = true;
  rm = new RoiManager(hidden);
  poly = new Polygon();
  poly.addPoint(50,50);
  poly.addPoint(100,100);
  poly.addPoint(200,200);
  points1 = new PointRoi(poly);
  points1.setStrokeColor(Color.yellow);
  points1.setPointType(dot);
  points1.setSize(large);
  rm.addRoi(points1);
  poly = new Polygon();
  poly.addPoint(150,400);
  poly.addPoint(270,270);
  poly.addPoint(400,150);
  points2 = new PointRoi(poly);
  points2.setStrokeColor(Color.cyan);
  points2.setPointType(hybrid);
  points2.setSize(xlarge);
  rm.addRoi(points2);
  img = IJ.createImage("Untitled", "8-bit black", 500, 500, 1);
  img.show();
  for (i=0; i<5; i++) {
     rm.select(0);
     IJ.wait(1000);
     rm.select(1);
     IJ.wait(1000);
 }


> --
> View this message in context: http://imagej.1557.x6.nabble.com/Change-PointROI-properties-with-Java-tp5015349.html
> Sent from the ImageJ mailing list archive at Nabble.com.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html