Login  Register

For (..){..} Loop does not wait until Measurement finished

Posted by Frank Scigalla on Apr 07, 2009; 9:37pm
URL: http://imagej.273.s1.nabble.com/For-Loop-does-not-wait-until-Measurement-finished-tp3693053.html

Hello,

I am currently working at a Macro which performs MultiMeasurements of
Stack-files,
each with a separate (given) ROI-Set.
The filenames of stack and tiff are stored in an string-array which is
looped

macro "listmeasure [l]" {
  tmp = "C:\\Programme\\ImageJ\\filelist.txt";          
  str = File.openAsString(tmp);
  liste = newArray("");
  liste = split(str, "\n");
 
  n = nResults;
  g = 0;
  for (g=0; g<(liste.length-1); g=g+2) {
        open(liste[g]);              // opens stack
        open(liste[g+1]);         // opens ROI-Set.zip to RoiManager
        run("Multimeasure_and_Save [6]"); // Performs measurement in
special order and saves measurement results
        run("RoiReset [r]");      // "resets" roi Manager, closes picture
    }
 
My problem is that this script imports the 2nd ROI-Set while the first
is still being measured (causes exception).
Can I force the script to wait until sub-functions are finished?

Frank