Using Enlarge function with very large ROI sets

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

Using Enlarge function with very large ROI sets

Jia-Ren_Lin
Dear experts,

I'm trying to quantify timelapse images with nuclear fluorescent marker for
segmentation and also take cytoplasmic measurements by enlarging ROIs.
However, because of very large ROI sets (>50,000), my macro ran very slow.

counts=roiManager("count");
for(i=0; i<counts; i++) {
    roiManager(&quot;Select&quot;, i);
    run(&quot;Measure&quot;);
    run(&quot;Enlarge...&quot;, &quot;enlarge=4&quot;);
    run(&quot;Measure&quot;);
}</b>


I've already setBatchMode("true").  It helps a little (save about half
time),  but I was wondering if there is a way to speed up my macro.

Thanks,
Jerry
Reply | Threaded
Open this post in threaded view
|

Re: Using Enlarge function with very large ROI sets

Rasband, Wayne (NIH/NIMH) [E]
On Sep 26, 2014, at 1:39 PM, Jia-Ren_Lin wrote:

> Dear experts,
>
> I'm trying to quantify timelapse images with nuclear fluorescent marker for
> segmentation and also take cytoplasmic measurements by enlarging ROIs.
> However, because of* very large ROI sets (>50,000)*, my macro ran very slow.
>
> /*counts=roiManager("count");
> for(i=0; i<counts; i++) {
>    roiManager(&amp;quot;Select&amp;quot;, i);
>    run(&amp;quot;Measure&amp;quot;);
>    run(&amp;quot;Enlarge...&amp;quot;, &amp;quot;enlarge=4&amp;quot;);
>    run(&amp;quot;Measure&amp;quot;);
> }&lt;/b>/
>
> I've already setBatchMode("true").  It helps a little (save about half
> time),  but I was wondering if there is a way to speed up my macro.

I get 280ms/ROI when I run your macro on the blobs sample image. If the macro switches to batch mode after running the particle analyzer (the image and ROI Manager are displayed), it takes 22ms/ROI, 13 times faster. If the macro switches to batch mode before running the particle analyzer (the image and ROI Manager are not displayed), the macro takes 5ms/ROI, 46 times faster. At 5ms/ROI, the macro would take  about 4 minutes to process 50,000 ROIs. The following is what the fastest version of the test macro I used looks like.

-wayne

  setBatchMode(true);
  run("Blobs (25K)");
  setAutoThreshold("Default");
  run("Analyze Particles...", "display exclude add");
  t0 = getTime;
  counts=roiManager("count");
  for(i=0; i<counts; i++) {
     roiManager("Select", i);
     run("Measure");
     run("Enlarge...", "enlarge=4");
     run("Measure");
  }
  print((getTime-t0)/counts);


> --
> View this message in context: http://imagej.1557.x6.nabble.com/Using-Enlarge-function-with-very-large-ROI-sets-tp5009786.html
> Sent from the ImageJ mailing list archive at Nabble.com.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Using Enlarge function with very large ROI sets

Jia-Ren_Lin
Hi Wayne,

Thanks so much for your reply.  I've turn on the batch mode in the begin of my script, and it processes at the similar speed as your test script.  However, I tried to process a huge amount of images from time-lapse microscopy, with average 50000-100000 ROIs per movie and 60 movies per experiment.  I was wondering if there is a way to enlarge all ROIs at once (not through a for loop)?  Or is it better to create a ring-shape selection?  Thanks again for all the suggestions,

Best,
Jerry