Login  Register

Re: How to avoid updating the image

Posted by Avital Steinberg on Oct 15, 2014; 2:26pm
URL: http://imagej.273.s1.nabble.com/How-to-avoid-updating-the-image-tp5010025p5010066.html

Thank you for your answer - I wrote 'true' instead of true. I didn't get a
syntax error but the command didn't do anything,

Avital

On Tue, Oct 14, 2014 at 9:34 PM, Rasband, Wayne (NIH/NIMH) [E] <
[hidden email]> wrote:

> On Oct 14, 2014, at 4:30 AM, Avital Steinberg wrote:
>
> > Hi,
> > I have loops that move an ROI around my image and uses getStatistics to
> > measure some parameters.
> >
> > My problem is that my image is updated thousands of times - each time the
> > ROI is moved. How can I cancel the display of the moving ROI? (needless
> to
> > say, it's slow)
>
> Try running the macro in batch mode. The following test macro, which
> creates and measures one million ROIs, runs in 10 seconds in batch mode and
> in 16 seconds when not in batch mode.
>
> -wayne
>
>  setBatchMode(true);
>  run("Clear Results");
>  run("AuPbSn 40 (56K)");
>  t0 = getTime;
>  n = 1000000;
>  size=25;
>  for (i=0; i<n; i++) {
>      showProgress(i, n);
>      x = round(random()*(getWidth-size));
>      y = round(random()*(getHeight-size));
>      makeRectangle(x, y, size, size);
>      getStatistics(area, mean);
>      setResult("X", i, x);
>      setResult("Y", i, y);
>      setResult("Mean", i, mean);
>  }
>  updateResults;
>  print((getTime-t0)/1000+" seconds");
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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