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 (http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.323.7747&rep=rep1&type=pdf, 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.

sample

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 ++){
 	run("Erode");
}
for(i = 0; i < 3; i ++){
 	run("Dilate");
}

The output image seems to be fine.
sample-2

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,
Yohei

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: https://stackoverflow.com/questions/32305504/median-filter-vs-morphological-operators-on-binary-images-to-reduce-noise

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.

Cheers,
Christopher

2 Likes

Dear Christopher,

I read the discussion, https://stackoverflow.com/questions/32305504/median-filter-vs-morphological-operators-on-binary-images-to-reduce-noise.
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!