0

I am facing a challange in my field and I would need some advices.

I have an image with tree rings.

To see a photo I want to work with, you can check it from my dropbox: https://dl.dropboxusercontent.com/u/65873264/Sample.jpg

I would like to write a macro/task... in which program will recognize each ring and mark it as ROI. I was trying to make this task using some plugins: Template Matching, Feature Finder and Visual grap. But those rings could be extremely variable.

What I need is something like that: With Analyze particles function program recognize all vessels (objects) on a thresholded image. Second step is fun: for each particle, it check if there is a particle around in a range of 0.5 mm. If it is, it creates an ROI including both particles and searches for next particle in the range of 0.5 mm...

There is a smillar method [http://imagej.1557.x6.nabble.com/combine-particles-in-ROI-manager-automatically-td3692844.html] But here macro at first calculates differences between two serial particles, but I need to include all particles in range of 0.5 mm.

JerryTheForester
  • 456
  • 1
  • 9
  • 26
  • Did you try using some [morphological operator](http://imagej.nih.gov/ij/docs/guide/146-29.html#toc-Subsection-29.8) on your binary image? _Dilating_ by a number of pixels smaller than the ring distance might help; or try _opening_ to get the desired large scale objects representing the rings. – Jan Eglinger Mar 12 '14 at 12:09
  • Thank you. I was a little bit experimenting, but I don't know how to make ROIs out of particles using morphological operators... – JerryTheForester Mar 12 '14 at 16:03

1 Answers1

1

The following ImageJ macro code makes use of the Maximum and Minimum filters in ImageJ to perform a morphological closing operation on the particles in your sample image, and it then uses the Particle Analyzer to create ROIs from those:

open("https://dl.dropboxusercontent.com/u/65873264/Sample.jpg");
run("Duplicate...", "title=[Temporary Copy]");
run("8-bit");
setAutoThreshold("Default");
run("Analyze Particles...", "size=100-Infinity show=Masks clear include in_situ");
run("Maximum...", "radius=70");
run("Minimum...", "radius=70");
run("Analyze Particles...", "size=100-Infinity clear add");
selectWindow("Sample.jpg");
roiManager("Show All with labels");
roiManager("Show All");
Jan Eglinger
  • 3,995
  • 1
  • 25
  • 51
  • Thank you very much. Works perfectly. In the following week I am going to try to add an option; in which macro will automatically rename all ROIs (rings) into appropriate year. So, first ring is 2013, next 2012... – JerryTheForester Mar 13 '14 at 18:34