Pattern Recognition with Fiji

I am not yet that experienced with the imageJ macro language and Im looking for a convenient way to write a macro that will find circular structures, i.e. rings or circles with holes. For a normal particle i could use particle analysis, yet due to the hollow inside this does not work. moreover, often the ring-like structures are touching each other and they are not always closed, therefore the tracking becomes even more complicated…I have tried to dilate and open the structures to close all rings perfectly and then use the ‘fill holes’ option which would enable me then to do particle analysis, however this does not work perfectly, as not all rings close and sometimes 3 rings lying next to each other close and become one gigantic particle… I tried to use the shape filter plugin, but couldnt find good explanations on what this plugin can do. I got the feeling that it cannot differentiate shapes in the way i want it to. does anyone have a good idea on how to do that? I would be very glad to hear any suggestions :slight_smile: thanks a lot!

Hello @Cleo,

It would help if you could upload here a representative image, so people in the forum can better understand your problem and play around with it.

That being said, have you tried separating your objects using the Trainable Weka Segmentation? There are also tools to fill holes and separate touching objects in grayscale 2D/3D image in the MorphoLibJ library.


Hello @iarganda, thanks a lot for your quick reply and your help! That would be a representable picture when I zoom in. These ring-like cell structures should only be quantified when they form a ring, thats why I would ideally work with a ring and not by seperating the cells and quantifying them seperately. I was thinking about the trainable weka segmentation, but I thought it doesnt generate a code that I can use afterwards in my macro for quantifying many more pictures? I will have a look at MorphoLibJ, and see how that suits my demands :slight_smile: thanks!

Hello again @Cleo,

I’m glad I can help.

Can you upload a larger version of it? This one is too small to see the borders between the cells.[quote=“Cleo, post:3, topic:928”]
I was thinking about the trainable weka segmentation, but I thought it doesnt generate a code that I can use afterwards in my macro for quantifying many more pictures?
The Trainable Weka Segmentation is macro-recordable, so you should be able to call parts of it from a macro, or even better, from a script.

Hallo @iarganda


for your help again! here s a larger version of a better example, the one yesterday was not my own work.

1 Like

What about a macro like this (you need to have MorphoLibJ and Elllipse split installed)?

selectWindow("64_F480_1op500_31 aug 2015.jpg");
run("Enhance Local Contrast (CLAHE)", "blocksize=127 histogram=256 maximum=3 mask=*None* fast_(less_accurate)");
run("Fill Holes (Binary/Gray)");
setAutoThreshold("Default dark");
//setThreshold(180, 255);
setOption("BlackBackground", false);
run("Convert to Mask");
run("Area Opening", "pixel=100");
run("Ellipse Split", "binary=[Use standard watershed] add_to_manager add_to_results_table merge_when_relativ_overlap_larger_than_threshold overlap=25 major=0-Infinity minor=0-Infinity aspect=1-3");

Thats a nice idea. The i didnt know ellipse split! However, I hoped to find a feature finder that detects ring-like structures, ie. hollow circles. I think the ellipse split works better than the watershedding on circles, yet it will miss some of the structures. Thanks a lot for your inspiring input!

Ive tried it on the picture and when I erase the run(“close”) Ill get a picture with fitted ellipses. but no precise detection of the ring-like DABstained structures…