MultiMeasure prompts user to click ok

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

MultiMeasure prompts user to click ok

Sarah W.
Hi all,

i am working on a macro that (consecutively) opens several folders, stacks the contained images and measures several rois throughout the stack.
i use the multimeasure tool and it works fine for the first folder/stack. however, from the second folder on, before measuring it prompts me to confirm that i want to "measure all slices" and obtain "one row per slice" in the results table.
i tried the macro recorder but it shows no way to set options to the roiManager("Multi Measure") command nor does it seem to pick up on my clicking "ok".
is it possible to set the options of multimeasure in a way that accepts the settings of "measure all slices" and "one row per slice"?
or, is it possible to avoid prompting altogether (perferrably disable it before saving the measurements and enabling it again afterwards)?
any suggestions appreciated!
thanks!

sarah

here is the code i used:

DIR=getDirectory("Choose Directory");

u=1;
while (File.exists(DIR+"DS"+u+"\\")) {

        DIR_DS=DIR+"DS"+u+"\\";
        SLICES=getFileList(DIR_DS);

        for (i=0; i<SLICES.length; i++) {
                open(DIR_DS+SLICES[i]);
        }

        run("Images to Stack", "title=i0 keep");

        run("ROI Manager...");
        roiManager("Open", "C:\\temp\\myRoiSet.zip");
        run("Set Measurements...", "area mean standard modal min median redirect=None decimal=3");
        roiManager("Multi Measure");

        selectWindow("ROI Manager");
        run("Close");


        String.copyResults();
        selectWindow("Results");
                datei=DIR+"DS"+u+".xls";
        saveAs("Measurements", datei);
       
        selectWindow("Results");
        run("Close");
       
        run("Close All Without Saving");

        u++;
               
}

Reply | Threaded
Open this post in threaded view
|

Re: MultiMeasure prompts user to click ok

dpoburko
Hi Sarah,

   If you run your script in BatchMode, it should suppress the
multi-measure prompt. Also, it's probably unneccessay to open and close
the ROI manager with each loop of the macro. You can simple delete all
the ROIs if you need to load a new set of ROIs.

Cheers,
Damon


On 6/24/2010 4:06 AM, Sarah W. wrote:

> Hi all,
>
> i am working on a macro that (consecutively) opens several folders, stacks
> the contained images and measures several rois throughout the stack.
> i use the multimeasure tool and it works fine for the first folder/stack.
> however, from the second folder on, before measuring it prompts me to
> confirm that i want to "measure all slices" and obtain "one row per slice"
> in the results table.
> i tried the macro recorder but it shows no way to set options to the
> roiManager("Multi Measure") command nor does it seem to pick up on my
> clicking "ok".
> is it possible to set the options of multimeasure in a way that accepts the
> settings of "measure all slices" and "one row per slice"?
> or, is it possible to avoid prompting altogether (perferrably disable it
> before saving the measurements and enabling it again afterwards)?
> any suggestions appreciated!
> thanks!
>
> sarah
>
> here is the code i used:
>
> DIR=getDirectory("Choose Directory");
>
> u=1;
> while (File.exists(DIR+"DS"+u+"\\")) {
>
> DIR_DS=DIR+"DS"+u+"\\";
> SLICES=getFileList(DIR_DS);
>
> for (i=0; i<SLICES.length; i++) {
> open(DIR_DS+SLICES[i]);
> }
>
> run("Images to Stack", "title=i0 keep");
>
> run("ROI Manager...");
> roiManager("Open", "C:\\temp\\myRoiSet.zip");
> run("Set Measurements...", "area mean standard modal min median
> redirect=None decimal=3");
> roiManager("Multi Measure");
>
> selectWindow("ROI Manager");
> run("Close");
>
>
> String.copyResults();
> selectWindow("Results");
> datei=DIR+"DS"+u+".xls";
> saveAs("Measurements", datei);
>
> selectWindow("Results");
> run("Close");
>
> run("Close All Without Saving");
>
> u++;
>
> }
>
>
>    
Reply | Threaded
Open this post in threaded view
|

Re: MultiMeasure prompts user to click ok

Sarah W.
Hi Damon,

thanks for the advice! leaving the roi manager open as well as running the script in batch mode dramatically increased the speed of my script :)
but: it still prompts me to hit "ok"

i tried inserting "setBatchMode(true);" at the very beginning of the macro, as well as running it from the command line as "imagej -batch -my_macro.txt". both ways had no influence on the prompting. do i maybe need to run only part of the script in batch mode?

thanks,

sarah


<quote author="dpoburko">
Hi Sarah,

   If you run your script in BatchMode, it should suppress the
multi-measure prompt. Also, it's probably unneccessay to open and close
the ROI manager with each loop of the macro. You can simple delete all
the ROIs if you need to load a new set of ROIs.

Cheers,
Damon
Reply | Threaded
Open this post in threaded view
|

Re: MultiMeasure prompts user to click ok

dpoburko
Sorry for the long delay in replying. I'm on vacation and not checking
email too much. Did you ever solve your Multi-measure prompting problem?
I have all kinds of macros that use multi-measure, and they don't have
the prompt problem. Could you post your script? Also, what OS and IJ
version are you running?

Cheers,
Damon

On 6/25/2010 2:06 AM, Sarah W. wrote:

> Hi Damon,
>
> thanks for the advice! leaving the roi manager open as well as running the
> script in batch mode dramatically increased the speed of my script :)
> but: it still prompts me to hit "ok"
>
> i tried inserting "setBatchMode(true);" at the very beginning of the macro,
> as well as running it from the command line as "imagej -batch
> -my_macro.txt". both ways had no influence on the prompting. do i maybe need
> to run only part of the script in batch mode?
>
> thanks,
>
> sarah
>
>
>
> Hi Sarah,
>
>     If you run your script in BatchMode, it should suppress the
> multi-measure prompt. Also, it's probably unneccessay to open and close
> the ROI manager with each loop of the macro. You can simple delete all
> the ROIs if you need to load a new set of ROIs.
>
> Cheers,
> Damon
>    
Reply | Threaded
Open this post in threaded view
|

Re: MultiMeasure prompts user to click ok

Sarah W.
hi damon,

no worries i was on vacation myself..
i updated to ImageJ 1.44d just now (running on windows vista) - without getting rid of the prompts though!
you can find my code in the first post
cheers,

sarah


<quote author="dpoburko">
Sorry for the long delay in replying. I'm on vacation and not checking
email too much. Did you ever solve your Multi-measure prompting problem?
I have all kinds of macros that use multi-measure, and they don't have
the prompt problem. Could you post your script? Also, what OS and IJ
version are you running?

Cheers,
Damon
Reply | Threaded
Open this post in threaded view
|

Re: MultiMeasure prompts user to click ok

Sarah W.
Hi All,

just letting you know that i have detected (and defeated) the troublemaker in my multi measure macro. what was causing the prompt was the use of the "Close All Without Saving" plugin!

while the following script:

>>>>>>>>>>>>>>>>>>>
i=1;
while (i<4) {
  for(j=1; j<6; j++) {
 newImage("Gray"+j, "8-bit Ramp", 512, 512, 1);
  }
 
  run("Images to Stack", "title=Gray keep");
 
  makeRectangle(61, 73, 85, 72);
  roiManager("Add");
 
  roiManager("Multi Measure");
  selectWindow("Results");
  saveAs("Measurements", "C:\\temp\\ij_test"+i+".xls");
 
  roiManager("Delete");
 
  run("Close All Without Saving");
 
  i++;
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>

causes the prompt, replacing the line  

>>>
  run("Close All Without Saving");
>>>

with a simple loop:

>>>
 for (j=1; j<6; j++) {
  selectWindow("Gray"+j);
  run("Close");
  }
>>>

gives me the peace and quiet i was looking for while the macro does all the work :)
thanks heaps for your input!

cheers

sarah