Request for assistance in determining pipeline to threshold a low contrast image (attached)

I wrote a macro to analyze isolated nano particles with the assistance of the volunteers here. This has proven unable to threshold images such as the 8-bit tiff I have attached. I need direction as to what combination of plugins I can reach for in an attempt to successfully obtain a particle distribution from these images to the degree this is feasible. I have worked with adjusting the image contrast/brightness, background subtraction and several Fiji filtering processes yet, remain unsuccessful. In general, I am using plugins that do not feature edge effects. For example, I am using the median filter because, it is know to preserve edges.

Please let me know if you can offer guidance.

Thank you.

Np-400k.tif (4.3 MB)

This is a little outside my wheelhouse, but have you considered filters to enhance the edges? For example, this shows using a standard deviation filter, then adding that to the original image, and then applying a median filter. I didn’t play with the filter sizes long enough to get an optimal result, but maybe it will help by giving you a possible direction.


Original->Standard Dev-> median filter+threshold

Looks like a TEM image. Could you use a smaller objective aperture or a lower accelerating voltage to get more contrast? In my experience at Kodak Analytical Sciences I always got the best results when I optimized image contrast in the SEM, TEM, or light microscope. I thought your example undersegmented the nanoparticles; mine tended to be a bit on the high end. Higher contrast would fix this…

I tried some noise removal approaches and am including a groovy script that illustrates the problem. The contrast is really low and it is hard to get good segmentation.

This is the best I got

The script included below uses script parameters. I am attaching a screen shot of the parameters I entered

Here is the script. I hope the comments are sufficient…

@String(label="Image Directory", style="") img_dir
@String(label="Input Image Name", style="") in_img_base_name
@String(label="Intermediate Image Name", style="") int_img_base_name
@String(label="Output Image Name", style="") out_img_base_name

/*
 * proc_np_img.groovy
 * 
 * J. R. Minter 2019-06-06
 * 
 * Demonstrate the problems in processing low contrast
 * TEM image of nanoparticles
 * 
 * See the screen shot for how to set the script parameters
 *
 */

import ij.*
import ij.plugin.*

IJ.run("Close All")

str_inp_tif = img_dir + "/" + in_img_base_name + ".tif"
str_int_tif = img_dir + "/" + int_img_base_name + ".tif"
str_out_png = img_dir + "/" + out_img_base_name + ".png"

println(str_inp_tif)
println(str_int_tif)
println(str_out_png)

imp = IJ.openImage(str_inp_tif)
imp.show()
imp_new = new Duplicator().run(imp)
imp_new.setTitle("work")
/* I tried ROF denoising which required a 32 bit image */
IJ.run(imp_new, "32-bit", "");
IJ.run(imp_new, "ROF Denoise", "theta=70")
/* The use a median filter */
IJ.run(imp_new, "Median...", "radius=2")
/* Convert back to 8 bits per pc*/
IJ.run(imp_new, "8-bit", "")
IJ.saveAs(imp_new, "TIFF", str_int_tif)
/* I had trouble with the recorder here, so had to split the analysis */
IJ.run("Close All")
imp_load = IJ.openImage(str_int_tif)
imp_load.show()
IJ.run(imp_load, "Auto Threshold", "method=Default")
/* Clean up the binary image before running a watershed*/
IJ.run(imp_load, "Erode", "")
IJ.run(imp_load, "Dilate", "")
IJ.run(imp_load, "Open", "")
IJ.run(imp_load, "Close-", "")
IJ.run(imp_load, "Watershed", "")
/* Define the measurements for the particle analysis*/
IJ.run("Set Measurements...", "area perimeter fit shape display redirect=None decimal=3")
IJ.run(imp_load, "Analyze Particles...", "size=20-Infinity pixel circularity=0.50-1.00 show=Overlay display exclude clear add");
imp_load.show()
/* Save the output as a PNG...*/
IJ.saveAs(imp_load, "PNG", str_out_png )

I had one other thought: you could try Trainable Weka Segmentation. Ellen Arena steps through an analysis in the video on segmentation.

In general, I have always tried to optimize image contrast before trying to use image processing techniques to “beat the pixels into submission” :slight_smile: , Hope one of these approaches works for you…

@Research_Associate - Yes, I tried the Variance filter and liked what it provided me with yet, I had not considered adding this to a subsequent filter such as the median. This is the voice of experience. Filtering is a dense topic and I think I have only scratched the surface in working over a week on this. I am continuing with your suggestion to see how well I can optimize each filter and the net result of both.

@John_Minter - Yes, a better image is best. Unfortunately, our TEM is currently down. We are waiting for Joe Bricker to arrive sometime in July. These were challenging images to capture in that the samples were utilizing fatty acids and this particular surfactant proved to be very “electron beam phobic.” As you noted, an objective aperture or lower accelerating voltage should improve upon the existing images. I was also given the suggestion to try low dose mode but, realized this would take time to configure for the desired result. I will have to add that to my schedule when time permits. I will give your groovy script some effort of my own to see what comes from this. Trainable Weka Segmentation has been on my to do list for some time…the list only expands. However, I had not learned of Ellen Arena’s analysis so, I will review it this weekend.

Thank you both for your effort and suggestions.

I located this discussion earlier this morning. It reads well so, I may add this approach to the list as well.