Macro recording of autothreshold

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

Macro recording of autothreshold

Krs5
Dear Wayne and list,

I just noticed after a question from one of the users that if I record autothreshold in the macro recorder it records a minimum and maximum value. However, this is depending on the image. For the blobs image I get in the recorder:

setAutoThreshold("Default");
//run("Threshold...");
setThreshold(126, 255);
setOption("BlackBackground", false);
run("Convert to Mask");

When this code is used in a macro you obviously get the wrong threshold when using a different image.
I would expect something like:

setAutoThreshold("Default");
//run("Threshold...");
run("Convert to Mask");

Is this a bug or intended behaviour? I use ImageJ 1.48v in Fiji.

Best wishes

Kees


Dr Ir K.R. Straatman
Senior Experimental Officer
Advanced Imaging Facility
Centre for Core Biotechnology Services
University of Leicester
http://www2.le.ac.uk/colleges/medbiopsych/facilities-and-services/cbs/lite/aif

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Macro recording of autothreshold

Rasband, Wayne (NIH/NIMH) [E]
On May 13, 2014, at 9:12 AM, Straatman, Kees (Dr.) wrote:

> Dear Wayne and list,
>
> I just noticed after a question from one of the users that if I record autothreshold in the macro recorder it records a minimum and maximum value. However, this is depending on the image. For the blobs image I get in the recorder:
>
> setAutoThreshold("Default");
> //run("Threshold...");
> setThreshold(126, 255);
> setOption("BlackBackground", false);
> run("Convert to Mask");
>
> When this code is used in a macro you obviously get the wrong threshold when using a different image.
> I would expect something like:
>
> setAutoThreshold("Default");
> //run("Threshold...");
> run("Convert to Mask");
>
> Is this a bug or intended behaviour? I use ImageJ 1.48v in Fiji.

This is a bug that is fixed in the latest daily build (1.49a21). This is what is now recorded when you use Image>Adjust>Threshold and Process>Binary>Convert to Mask on the Blobs sample image:

  setAutoThreshold("Default");
  //run("Threshold...");
  //setThreshold(126, 255);
  setOption("BlackBackground", true);
  run("Convert to Mask");

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