Login  Register

Re: Distance Between Lines, a plugin for ImageJ

Posted by Michael Cammer on Aug 19, 2006; 1:52pm
URL: http://imagej.273.s1.nabble.com/Distance-Between-Lines-a-plugin-for-ImageJ-tp3701802p3701804.html

A while back (using NIH-Image) I wrote a macro to find the minimum
distances between the edges of multiple irregular shaped objects by taking
all the edge points of each object and using (x1 - x0) ^ 2 + (y1 - y0) ^ 2
for every pair of points.  It worked fine and computers are fast, so even
in NIH-Image it only took seconds for a lot of objects.
-mc


> On Thursday 17 August 2006 08:54, Birger Retterstøl Olaisen wrote:
>> I have written a small plugin for ImageJ for measuring the average
>> distance between two lines (which do not have to be straight).
>
> Hi,
>
> I haven't run the plugin, so apologies if the next part is not pertinent.
> By looking at the source code, I think that there is another - perhaps
> better - algorithm for this (I do not understand why one needs orthogonal
> points) and it should work for lines in any orientation without the need
> of a
> reference.
>
> Get all the coordinates of line 1
> Get all the coordinates of line 2
> For each point in line 1{
>  Calculate (using Pythagoras theorem) the distance to every point in line
> 2
>  Keep the minimum of those distances in an array.
> }
>
> The Minimum of those minima is the minimum thickness.
> The Maximum of those minima is the maximum thickness.
> The Average of those minima is the average thickness.
>
> One can speed that up by using the squares of the distances, thus saving
> one
> square root (which tends to be slow) per test and calculating the square
> root
> the the minimum after each cycle (i.e. the one you keep).
>
> I hope it helps.
>
> Gabriel
>


_________________________________________
Michael Cammer
Analytical Imaging Facility and
Dept. ASB Biophotonics Innovation Laboratory
Albert Einstein College of Medicine
1300 Morris Park Avenue, Bronx, NY  10461
718-430-2890  Fax 718-430-8996
work:  http://www.aecom.yu.edu/aif/
personal:  http://coxcammer.com/