ROIs Make band / Time consuming

Dear All,

I´m trying to determine if particles are surrounden of pixel values 0 or 255. I ahve two mask 1- coresponding at “Matrix” 2- Particles or “pores”

my Macro containing this:

nr=roiManager(“count”); this correspond to an anterior step: count particles and add to RM

for (i = 0; i < nr; i++) {

** roiManager(“select”, i);**
** run(“Make Band…”, “band=2”);**
** roiManager(“Update”);**
}

These comands works but when particles are thousands or more the step “create band” is really slow. Just this step increase quantification time infinitely…

Any idea how to solve it or depend only in pc performance?
Many Thanks!!!

Happy Quarantine!!!

Try running your macro in batch mode. This test macro runs 7 times faster in batch mode:

  setBatchMode(true);
  t0 = getTime;
  run("Blobs (25K)");
  setAutoThreshold("Default");
  run("Analyze Particles...", "clear add");
  nr=roiManager("count");
  for (i=0; i < nr; i++) {
     roiManager("select", i);
     run("Make Band...", "band=2");
     roiManager("Update");
  }
  print("time="+(getTime-t0)+" ms");
  setBatchMode(false);
1 Like

Many thanks!!! I will try