Login  Register

Re: Fast Overlay Fill Region

Posted by Rasband, Wayne (NIH/NIMH) [E] on Aug 11, 2011; 4:22pm
URL: http://imagej.273.s1.nabble.com/Fast-Overlay-Fill-Region-tp3683539p3683540.html

On Aug 11, 2011, at 4:00 AM, Thorsten Sy wrote:

> Hi,
>
> I just recognized the new macro commands Overlay.* which allow a much fast overlay drawing than the "old" makeLine-Add Selection scheme. But what I missed, is the possibility to fill a region like makePolygon-Add Selection, fill…, which is really slow. Is there a similar possibility with the new commands?

Use batch mode. The following test macro runs 300 times faster in batch mode.

   start = getTime;
   setBatchMode(true);
   newImage("Untitled", "RGB Black", 512, 512, 1);
   n = 500;
   for (i=0; i<n; i++) {
      showProgress(i, n);
      makePolygon(52,73,103,41,158,62,142,111,68,128);
      run("Add Selection...", "fill=#77ff0000");
   }
   setBatchMode(false);
   print((getTime-start)/1000+" seconds");

-wayne