Login  Register

Re: Count intersection lines

Posted by Gabriel Landini on Sep 06, 2014; 8:35am
URL: http://imagej.273.s1.nabble.com/Count-intersection-lines-tp5009504p5009538.html

On Friday 05 Sep 2014 18:30:59 you wrote:
> for example, an histology of lung alveoli.
> if i wanted to see how many alveolar membranes the line intersected with

I do not have the exact code, but here is an idea:
If the membranes are stained unequivocally, then take they profile of the
line. That profile should be bright where there is "air" and dark when it is a
stained membrane.
So counting the number of "regional minima" of at least a certain size (so you
do not get spurious ones) should be the number you are after.

Something like:
run("Tree Rings (48K)");
//setTool("line");
makeLine(929, 62, 1169, 64);
run("Plot Profile");

You get 9 regional minima. Since you can get the pixel values of the profile
into an array (there was a posting in the last few weeks exactly on this) then
you can compute the number of minima in the array.
You might also want to apply a running average to the array (or on the image)
to smooth out small perturbances (like the last one on the right generated
from the code above, which looks like a double valley.
Hope it helps.

Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html