Login  Register

Re: Set Measurement failed in macro

Posted by Wayne Rasband-2 on Oct 06, 2017; 3:27pm
URL: http://imagej.273.s1.nabble.com/ImageJ-Reslice-command-Image-Stacks-Reslice-tp5019450p5019513.html

> On Oct 5, 2017, at 3:50 PM, Straatman, Kees (Dr.) <[hidden email]> wrote:
>
> Dear list
>
> I noticed some strange behaviour when using different Set Measurements together with the ROI manager in a macro.
>
> example code
>
> run("Blobs (25K)");
> setAutoThreshold("Default");
> setOption("BlackBackground", false);
> run("Convert to Mask");
> run("Set Measurements...", "display redirect=None decimal=0");
> run("Analyze Particles...", "size=1-Infinity summarize add");
> run("Set Measurements...", "feret's display redirect=None decimal=3");
> roiManager("Measure");
>
> As soon as the second Set Measurements runs area data is already displayed in the Results window, even before anything is measured, labelled as blobs.gif. The last line adds a second series of data to the Results table now labelled as ROIs but still the results are for area and not feret's data. Strangely enough the first few times the values for area were the correct values but after I moved some code around they now show zeros.
>
> Also hitting "Measure" in the ROI menu after running the macro still gives the same result. Checking the settings under Analyze > Set Measurements shows however that Feret's diameter is selected and not Area.
>
> I have tested it on several PCs, all Windows 7 using the latest updated version of Fiji.
>
> So it seems to be that there is somewhere a bug.


Dear Kees,

This bug is fixed in the latest ImageJ daily build (1.51r18). Or work around it by adding

    run("Clear Results”);

after running the particle analyzer, as in this version of your test macro:

  run("Blobs (25K)");
  setAutoThreshold("Default");
  setOption("BlackBackground", false);
  run("Convert to Mask");
  run("Set Measurements...", "display redirect=None decimal=0");
  run("Analyze Particles...", "size=1-Infinity summarize add");
  run("Clear Results");
  run("Set Measurements...", "feret's display redirect=None decimal=3");
  roiManager("Measure”);

-wayne

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