Re: Multiple ROI Display

Posted by David Webster on
URL: http://imagej.273.s1.nabble.com/Multiple-ROI-Display-tp3690458p3690463.html

Wayne,

I assume I can do that in Java as well!

FYI, I am using Windows XP/SP3, Jave 1.60_11, and Image J ver k (or daily
build). In any case, my test plugin does not show the same misbehavior as my
filter. I can zip up the code thta sows the misbehvior and send it to you if
you wish.

David Webtser

On Sat, Nov 14, 2009 at 9:45 PM, Wayne Rasband <[hidden email]> wrote:

>   Wayne,
>>
>> I tried  rm.runCommand("Show All") but am getting one/off buggy
>> behavior. Sometime my circles get displayed and sometimes not.
>> For example, if I turn on the macro recorder, then my circles seem
>> to be displayed. When it's off, I get nothing. There alos seems to
>> be some relationship to how many circles I try to display. Too few,
>> and I get nothing.
>>
>> David Webster
>>
>
> Try displaying the circles in an overlay. Here is a JavaScript example that
> displays 50 circular ROIs at random locations and in random colors as an
> overlay.
>
> -wayne
>
>  if (IJ.getVersion()<"1.43k")
>     IJ.error("Requires ImageJ 1.43k or later");
>  n = 50;
>  w = 1000, h = 700;
>  imp = IJ.createImage("Demo","8-bit Ramp",w,h,1);
>  imp.show();
>  ran = new Random();
>  list = new Vector();
>  size = w/10;
>  for (i=0; i<n; i++) {
>      x = ran.nextFloat()*(w-size);
>      y = ran.nextFloat()*(h-size);
>      roi = new OvalRoi(x,y,size,size);
>      color = new Color(ran.nextFloat(),ran.nextFloat(),ran.nextFloat());
>      roi.setStrokeColor(color);
>      roi.setStrokeWidth(2);
>      list.addElement(roi);
>  }
>  imp.setDisplayList(list);
>  IJ.wait(2000);
>  IJ.run(imp,"Hide Overlay","");
>  IJ.wait(2000);
>  for (i=0; i<n; i++)
>      list.get(i).setStrokeWidth(8);
>  IJ.run(imp,"Show Overlay","");
>