Login  Register

Re: distance between adjacent particles

Posted by Dan Batzel on May 12, 2007; 10:30pm
URL: http://imagej.273.s1.nabble.com/distance-between-adjacent-particles-tp3699485p3699490.html

Some concepts that may be thought provoking, "moves to crowding" and
"distance to regularity", attributed to J. N. Perry & M. Hewitt (1991)
and R. Alston (1994), are described in a document deposited here:

http://www.rothamsted.ac.uk/pie/sadie/reprints/perry1995a_jae.pdf



Dan Batzel, PhD
Research Scientist
Gentex Corporation
Carbondale, PA

 
 

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
Girault France
Sent: Thursday, May 10, 2007 11:30 AM
To: [hidden email]
Subject: Re: distance between adjacent particles

Dear all,
Thanks for all the replies,

Following your advices, I've been trying some techniques to get
distances between particles. Here I try to get the shortest distance
between each particle and its closest neightbor as suggested by G.
Landini. First I have to assess the distance between the particle and
each of the other particle, avoiding the value "0" for the distance:
(see below)

With this macro I still get the value 0 in some cases and I don't know
how to get rid of it. Maybe there also is an easier way to get those
values?

Secondly I just saw the last reply about taking 6 closest neighbors
which would exactly fit with I want to do (4 closest neighbors rather
than 6), but I don't really see how I can get this right now with what
I've done. Any ideas on how to do this? Creating a second array and
store the 4 smallest values and average them at the end?


Many thanks,

France

var dist1;
var dist;
        for (i=0; i<nResults; i++) {
                XM=getResult("XM", i);
                YM=getResult("YM",i);
                a=nResults;
                a1 = newArray(a);
                for (b=0; b<nResults; b++){
                        XM2=getResult("XM", b);
                        YM2=getResult("YM",b);
                        dist1=dist;
       
dist=sqrt(((XM2-XM)*(XM2-XM))+((YM2-YM)*(YM2-YM)));
                        a1[b] = dist;
                }
                for (b=0;b<a;b++){
                        dist=a1[b];
                        if(dist==0){dist=10000;}
                        if (dist>dist1) {dist=dist1;}
                        dist1=dist;
                }
                print(dist1);
                setResult("shortest_dist", i, dist1);
        }

        updateResults();
 


-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
Jeffrey C Hanson
Sent: jeudi, 10. mai 2007 17:13
To: [hidden email]
Subject: Re: distance between adjacent particles


        Ok.  If you're not really looking for "closest neighbor"
distance
but the "average distance among the closest neighbors"...
        You'll need to decide how many of the closest neighbors you want

to include in the average.  Depending on what you expect the
distribution
might be like, you could use from 3-6 neighbors.  Then, you could do the

"brute force" calculation suggested below, except instead of keeping the

shortest distance in an array, you would keep the "n" shortest distances

in an array.  When you were done scanning all of the points, you would
find the average of those "n" points.  I like using "6" points, because
that's how many neighbors an object would have if it was in a tightly
packed hexagonal pattern.

        In other applications, I've been interested finding areas of
different "densities" of objects and I've used the following steps:
- threshold the objects
- reduce the objects to their ultimate center points
- run a large scale blur (scale dependent on how far away you want to
include neighbors)
- this image will have it's highest intensities in the areas where you
have the closest packing of objects
        This represents more of a "texture" measure.  The advantage of
this technique is that it doesn't require any extra java programming,
just
image processing steps.  The problem with this technique is that it's a
lot harder to try to describe what the results mean.

good luck,
Jeff




Gabriel Landini <[hidden email]>
Sent by: ImageJ Interest Group <[hidden email]>
05/09/2007 05:36 PM
Please respond to
ImageJ Interest Group <[hidden email]>


To
[hidden email]
cc

Subject
Re: distance between adjacent particles






On Wednesday 09 May 2007 21:30:10 Michael Schmid wrote:
> > I have an image with many particles, distributed randomly. I'm
> > trying to get the average distance between a particle with all its
> > closest neighbors but not all of the particles on the image.
> > Is there an easy way to do or an existing plugin that allows such
> > measurement?

To do this using brute-force would be quite easy with a macro:

get the coordinates of all the points or centroids in arrays x() and
y(),
for each point calculate using pythagoras, the distance to all other
points
and keep the shortest one in another array.
Now look at the distribution of shortest distances.

Cheers,

G.