Login  Register

Re: The runMacro command doesn't "see" the ROI manager

Posted by Avital Steinberg on Jul 16, 2015; 4:46am
URL: http://imagej.273.s1.nabble.com/The-runMacro-command-doesn-t-see-the-ROI-manager-tp5013572p5013585.html

Hi Wayne,
Thank you - I was also looking for a solution and solved it right before I
got your email. I solved it in a different way. I noticed that for some
reason, my macro drew overlays on multiple images, instead of just the one
I selected. So I thought that closing all other images would solve it and
it did. I'm not sure why when I selected one image to draw overlays on, it
drew them on more than one image.

I don't have a problem with it, though, because I closed the other images.

Thanks,
Avital

On Wed, Jul 15, 2015 at 10:04 PM, Rasband, Wayne (NIH/NIMH) [E] <
[hidden email]> wrote:

> > On Jul 15, 2015, at 10:42 AM, Avital Steinberg <
> [hidden email]> wrote:
> >
> > Hi,
> > I'm running a program which has to run in batch mode, and I am using an
> > additional macro by calling runMacro. The problem is that within the
> macro,
> > the number of ROIs in the ROI manager is zero, while before and after
> > running the macro, there are ROIs in the ROI manager. The problem is that
> > the macro doesn't "see" the ROI manager.
> >
> > This happens only in the batch mode, but when I try to set the batch mode
> > to false only for this part of the program, it doesn't solve the
> problem. I
> > tried explicitly opening the image with the ROIs and using the command
> > "from ROI manager" to solve this problem, but the problem wasn't solved.
> >
> > Does anyone have any idea how to solve this problem?
>
> You can work around this problem by opening the ROI Manager before
> entering batch mode. For example, this macro
>
>  run("ROI Manager...");
>  setBatchMode(true);
>  run("Blobs (25K)");
>  setAutoThreshold("Default");
>  roiManager("reset");
>  run("Analyze Particles...", "add");
>  print("count1="+roiManager("count"));
>  runMacro("ShowCount.ijm");
>
> outputs
>
>  count1=64
>  count2=64
>
> but it outputs
>
>  count1=64
>  count2=0
>
> if you close the ROI Manager, remove the first line [run("ROI Manager…”)]
> and run it again.
>
> wayne
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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