Can I use [Auto local threshold] (Niblack) prior to [Median]?

Hi, all

I’m new with ImageJ, and I have a question.

Can I can use [Auto Local threshold] (Nibalck Method) prior to [Median]?

Generally, it is said that Image analysis consists of five stages (, p45),
1: Image Acquisiton
2: Image Preparation
3: Filtering Methods (Mean, Median, Gaussian… etc.)
4:Threshold Methods (Bernsen, Niblack, Otsu… etc.)
5: Refinement. (Erode, Dilate).

I have a 8-bit grayscale image as below, and I want to extract only the white ring.


Therefore, I tried running the macro as follows.

run("Auto Local Threshold", "method=Niblack radius=50 parameter_1=0 parameter_2=0 white");
run("Median...", "radius=10");
for(i = 0; i < 3; i ++){
for(i = 0; i < 3; i ++){

The output image seems to be fine.

However, I executed [Auto Local Threshold] first, and [Median] next.
This is the opposite order of the above algorithm of image analysis.

Is my macro OK theoretically?
If not, should I use pre-processing filter such as [Gaussian], followed by [Auto Local Threshold]?

I look forward to hearing from you, and I’m sorry for my poor English.

Best regards,

Hi Yohei,

im principle yes, on a binary image a median filter would act similar to a morphological operation such as erosion and dilation. Depending on the radius of the filter it would remove smaller “particles”. Here is a discussion about that:

Since it uses the median value the binary image is preserved.

The question for me would be, what do you really want to measure in your images.
Maybe there is another way to get to that.



Dear Christopher,

I read the discussion,
It was a good resource.

I set the radius of median filter as 10, so it may be a little large…
I’m trying another way, too.

Thank you for giving me good adivice!