Trouble Performing Binary


We have developed a macro that performs a range of functions on this image. The raw image has been thresholded and binary has been performed once. Normally it is possible to perform binary again to make the image black and white, in order to skeletonize the image (then perform binary connectivity and anaylse histogram).

With recently redownloading ImageJ the program will not perform binary. Performing convert to mask (next image) appears to do this ok, see image and produces the same result. This is slightly concerning and i was wondering why it was necessary to make this change as if we hadn’t fallen upon the solution by chance I am not sure it would be possible to have worked it out?

Hi still having this issue, the three images show the progression from raw to image, to thresholded image and make binary performed, to white image after a second binary.

This second binary is the issue and will not perform, an issue for the macro.

Could you post the part of the macro that gives you the problem.
So we can reproduce the problem.

Also from your description I cannot clearly make out a problem.
The binary will not be created at all?


Hi Christopher,

Thank you for getting back.

The macro is developed for image analysis. The macro has been working until fiji was uninstalled then reinstalled and now does not work.

The process of normal functions are:

  • Image->adjust-> threshold,
  • Process -> binary -> make binary
  • Process -> binary -> make binary
  • Process -> binary -> skeletonise
  • Plugins -> morphology -> binary connectivity

The raw image, turns red and white after thresholding and one binary; and white after the second binary. This second binary is not working. The convert to mask function appears to sometimes work instead. This second binary (conversion to white image) is necessary for the binary connectivity plugin.

Below is the section of the macro that appears to be responsible. Although i suspect the issue is due to default settings around the make binary or thresholding of the image. The macro is a bit longer, if it’d be helpful to have more of it plz let me know, perhaps i can send it over email.

thresholdMethodNerveTerminal = getInfo("threshold.method");

setOption("BlackBackground", false);
run("Make Binary", "thresholded remaining black");
saveAs("Tiff", axonFilepath);


Hm when I execute the macro snippet in a fresh copy of Fiji (on ubuntu) I get a binary image with one of the samples images using the Huang threshold.

Maybe check your Fiji specific settings in:

Edit > Options > Colors

as well as:

Process > Binary > Options

could you post an image that gives you issues?

Above is a link with the image. The settings is a good thought and i will have to get in touch with my co-workers for the correct default settings.

Thanks for your help

Also with your image I have no problem.

I really think there is a mixup in the background foreground color settings either under Options or Binary options.
I usually have such issues due to changed settings there or some settings silently assumed by the macro.

If you want to make sure these settings are correct before performing the segmentation, just macro record these settings as well and then use them in the macro.

I think that is a good place to start, thanks for your help and we’ll have a look at standardising the settings.