Login  Register

Re: help! macro no longer works if setBatchMode = true

Posted by Rasband, Wayne (NIH/NIMH) [E] on Nov 18, 2010; 12:27am
URL: http://imagej.273.s1.nabble.com/help-macro-no-longer-works-if-setBatchMode-true-tp3686407p3686408.html

On Nov 16, 2010, at 7:54 AM, Crowell Elizabeth wrote:

> Hello ImageJ community,
>
> I have a macro that works perfectly when batch mode is set to false.  
> However, as soon as I set batch mode to true, the macro no longer
> functions (attached).  I have searched all the list archives, and I
> cannot find a solution for this problem.  I have tried debugging the
> code to localize the problem:
>
> - When setBatchMode=false, the variable length1 in the function GetROIs
> is read correctly, and corresponds to the number of ROIs in the manager.
>
> - When setBatchMode=true, the variable length1 is read only for the
> first file processed, afterwards it is always read as equalling zero,
> although I can see the ROI manager being filled.
>
> - When setBatchMode=true, if I comment out the call to the function
> "MeasureROIs", the variable length1 is properly read, and everything
> works correctly (although of course I do not get my output, which comes
> from MeasureROIs).
>
> I cannot find what my error might be.  I have reproduced the problem on
> two different Macs.  A simpler code ("ImageJTest.txt", attached) used on
> the blobs sample image works fine in batch mode.
> I am quite lost and cannot find what is causing the problem.  Would
> anyone have a moment to help me?  I can post a sample image set for
> testing if it is needed.

The ImageJ 1.44k daily build fixes a bug that caused batch mode macros like this one to fail. The bug occurs in macros that use the particle analyzer with the "Add to Manager" option and also use a command that is implemented in macro code, such as Edit>Selection>Enlarge.

-wayne