Nearest Neighbor Calculations

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Nearest Neighbor Calculations

Shawn Mikula-2
hi,
Does anyone know how to perform nearest neighbor distance computations for
particles in binary images?  In other programs, like Matlab, this can be
done using Delaunay triangulations and KDTrees, but I haven't found any
simple way to do this in ImageJ.  Anyone have any ideas?
thanks!
Shawn


--
Shawn Mikula, Ph.D.,
Postdoctoral Scholar
Center for Neuroscience
University of California-Davis,
1544 Newton Court,
Davis, CA 95618,
Phone: 530-754-9209
Fax: 530-754-9136
mail: [hidden email]
web: http://brainmaps.org
 
Reply | Threaded
Open this post in threaded view
|

Re: Nearest Neighbor Calculations

Shawn Mikula-2
thanks for the reply, Jim; unfortunately it's not clear to me how to extract
nearest neighbor distances from binary images with particles using frequency
or phase components of the FFT.
cheers,
Shawn

----- Original Message -----
From: "Jim Quinn" <[hidden email]>
To: <[hidden email]>
Sent: Thursday, August 30, 2007 9:18 AM
Subject: Re: Nearest Neighbor Calculations


> FFT is related to the diffraction pattern.
> Hence, you can extract that information from the pattern.
>
> JQ
>
>
> > From [hidden email]  Thu Aug 30 11:40:14 2007
> > Approved-By: [hidden email]
> > X-IronPortListener: NON_CES-Inbound
> > X-SBRS: 3.9
> > X-IronPort-Anti-Spam-Filtered: true
> > X-IronPort-Anti-Spam-Result: AgAAAIOA1kaAeCAfi2dsb2JhbACHboYVAQEJBAYNGg
> > MIME-Version: 1.0
> > Content-Type: text/plain; format=flowed; charset="iso-8859-1";
> >               reply-type=original
> > Content-Transfer-Encoding: 7bit
> > X-Priority: 3
> > X-MSMail-Priority: Normal
> > X-Mailer: Microsoft Outlook Express 6.00.2900.3028
> > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028
> > X-Scanned-By: MIMEDefang 2.57 on 128.120.32.31
> > Date:         Thu, 30 Aug 2007 08:36:28 -0700
> > Reply-To: ImageJ Interest Group <[hidden email]>
> > Sender: ImageJ Interest Group <[hidden email]>
> > From: Shawn Mikula <[hidden email]>
> > Subject: Nearest Neighbor Calculations
> > To: [hidden email]
> > Precedence: list
> > List-Help: <http://list.nih.gov/cgi-bin/wa?LIST=IMAGEJ>,
> >            <mailto:[hidden email]?body=INFO IMAGEJ>
> > List-Unsubscribe: <mailto:[hidden email]>
> > List-Subscribe: <mailto:[hidden email]>
> > List-Owner: <mailto:[hidden email]>
> > List-Archive: <http://list.nih.gov/cgi-bin/wa?LIST=IMAGEJ>
> >
> > hi,
> > Does anyone know how to perform nearest neighbor distance computations
> > for
> > particles in binary images?  In other programs, like Matlab, this can be
> > done using Delaunay triangulations and KDTrees, but I haven't found any
> > simple way to do this in ImageJ.  Anyone have any ideas?
> > thanks!
> > Shawn
> >
> >
> > --
> > Shawn Mikula, Ph.D.,
> > Postdoctoral Scholar
> > Center for Neuroscience
> > University of California-Davis,
> > 1544 Newton Court,
> > Davis, CA 95618,
> > Phone: 530-754-9209
> > Fax: 530-754-9136
> > mail: [hidden email]
> > web: http://brainmaps.org
> >
> >
Reply | Threaded
Open this post in threaded view
|

Re: Nearest Neighbor Calculations

Gabriel Landini
> Does anyone know how to perform nearest neighbor distance computations

This was discussed in this list not long ago, perhaps it would be useful to
look in the mailing list.

If doing from the particle centroids you need to:
for each particle compute the distance to all other particles using Pythagoras
theorem and keep the nearest (for the nearest neighbour).

If doing it from the particle surface, you will need to repeat this for all
points in the perimeter for each particle to all points in the perimeter for
all other particles.

I hope it helps

G.
Reply | Threaded
Open this post in threaded view
|

Re: Nearest Neighbor Calculations

Shawn Mikula-2
thanks Gabriel,
yes, your inter-particle distance enumeration algo definitely works though
it may hang for thousands of particles.  I was hoping that there was a
plugin that did this to save me the time/effort of coding this up in ImageJ
and reinventing a wheel that someone probably already made.  I googled
around online but got overwhelmed by the number of ImageJ plugins, and in
the end, I wasn't able to find a plugin that did this computation.  I'll
check over the archives too.
Cheers.
Shawn

----- Original Message -----
From: "Gabriel Landini" <[hidden email]>
To: <[hidden email]>
Sent: Thursday, August 30, 2007 10:53 AM
Subject: Re: Nearest Neighbor Calculations


>> Does anyone know how to perform nearest neighbor distance computations
>
> This was discussed in this list not long ago, perhaps it would be useful
> to
> look in the mailing list.
>
> If doing from the particle centroids you need to:
> for each particle compute the distance to all other particles using
> Pythagoras
> theorem and keep the nearest (for the nearest neighbour).
>
> If doing it from the particle surface, you will need to repeat this for
> all
> points in the perimeter for each particle to all points in the perimeter
> for
> all other particles.
>
> I hope it helps
>
> G.
Reply | Threaded
Open this post in threaded view
|

Re: Nearest Neighbor Calculations

Shawn Mikula-2
In reply to this post by Gabriel Landini
thanks again, Gabriel.  Just wanted to say that I searched the archives and
found the recent post you were referring to at
https://list.nih.gov/cgi-bin/wa?A2=ind0611&L=IMAGEJ&P=R2550&I=-3 .  Sorry
for the redundant posting.  It seems that Mike Miller has coded some plugins
that may do the nearest neighbor analysis on binary images of particles.
I'll have to check it out.  If that doesn't work, I'll export the centroids
from the particle analysis and run the enumeration algo you suggested in a
programming enviro that I'm more familiar with.
Cheers.
Shawn



----- Original Message -----
From: "Gabriel Landini" <[hidden email]>
To: <[hidden email]>
Sent: Thursday, August 30, 2007 10:53 AM
Subject: Re: Nearest Neighbor Calculations


>> Does anyone know how to perform nearest neighbor distance computations
>
> This was discussed in this list not long ago, perhaps it would be useful
> to
> look in the mailing list.
>
> If doing from the particle centroids you need to:
> for each particle compute the distance to all other particles using
> Pythagoras
> theorem and keep the nearest (for the nearest neighbour).
>
> If doing it from the particle surface, you will need to repeat this for
> all
> points in the perimeter for each particle to all points in the perimeter
> for
> all other particles.
>
> I hope it helps
>
> G.
Reply | Threaded
Open this post in threaded view
|

Re: Nearest Neighbor Calculations

Michael Schmid
In reply to this post by Shawn Mikula-2
Hi Shawn,

if you only want the distribution of distances between the
particle centers for a large number of particles, you can
have a look at my previous post
   https://list.nih.gov/cgi-bin/wa?A2=ind0705&L=IMAGEJ&P=R7214&I=-3

There you find how to get the radial distribution function.

Michael
________________________________________________________________


On 30 Aug 2007, at 19:14, Shawn Mikula wrote:

> thanks for the reply, Jim; unfortunately it's not clear to me how  
> to extract nearest neighbor distances from binary images with  
> particles using frequency or phase components of the FFT.
> cheers,
> Shawn
>
> ----- Original Message ----- From: "Jim Quinn"  
> <[hidden email]>
> To: <[hidden email]>
> Sent: Thursday, August 30, 2007 9:18 AM
> Subject: Re: Nearest Neighbor Calculations
>
>
>> FFT is related to the diffraction pattern.
>> Hence, you can extract that information from the pattern.
>>
>> JQ
>>
>> >
>> > hi,
>> > Does anyone know how to perform nearest neighbor distance  
>> computations > for
>> > particles in binary images?  In other programs, like Matlab,  
>> this can be
>> > done using Delaunay triangulations and KDTrees, but I haven't  
>> found any
>> > simple way to do this in ImageJ.  Anyone have any ideas?
>> > thanks!
>> > Shawn
Reply | Threaded
Open this post in threaded view
|

Re: Nearest Neighbor Calculations

Marcel
In reply to this post by Shawn Mikula-2
Hello,

About 4 weeks ago i released an application (application for ecology) capable to do this. It implements an ImageJ version
and the statistical tool R. In R you can use the library spatstat to perform a nearest neighbour analysis,
voronoi, delauney etc.
It is quite fast and i tested it with 100000 particles (nearest neighbour analysis!). I've released also a Flash tutorial how to perform this.
http://www.uni-bielefeld.de/biologie/Oekosystembiologie/bio7app/index.html
Look at-> Flash Tutorials:"Transfer precise values from a particle analysis to R" and "A point pattern example"
Maybe it is also applicable for you problem.
The application is, at the moment, only available for Windows. It uses ImageJ 1.35.
If you need a higher version number:in about one week i will release a new version bundled with an improved version of ImageJ 1.39d.

With kind regards

Marcel
Reply | Threaded
Open this post in threaded view
|

Re: Nearest Neighbor Calculations

Dimiter Prodanov
In reply to this post by Shawn Mikula-2
Hi,

You can take the distance map of the image.
Then you can calculate the distances from a given
extremum to all other extrema; then you take the minimal distance.
The number of iterations is n*(n-1)/2 due to symetry.

Regards

Dimiter Prodanov
Reply | Threaded
Open this post in threaded view
|

compile and run problem

Aryeh Weiss
In reply to this post by Marcel
I am running ImageJ using the Jrockit JDK, in order to be able to use over 2GB
of RAM. However, I cannot use the compile and run function. I verified that
javac.exe exists, and the tools.jar is in the lib directory. It still reports
that the JVM does not include the javac compiler.

Any ideas as to how to solve this problem will be much appreciated.

--aryeh
--
Aryeh Weiss
School of Engineering
Bar Ilan University
Ramat Gan 52900 Israel

Ph:  972-3-5317638
FAX: 972-3-7384050
Reply | Threaded
Open this post in threaded view
|

Re: compile and run problem

ctrueden
Hi Aryeh,

ImageJ's compiler class (ij.plugin.Compiler) uses the undocumented,
deprecated sun.tools.javac.Main class to call the compiler, which I'm
guessing is not supported by JRockit, as the sun.tools.javac package
is not an official part of the Java specification. There is a new,
official Java compiler interface, javax.tools.JavaCompiler, that was
added in 1.6. It looks like JRockit works with 1.6 as of a few months
ago, so it would probably be possible to make ImageJ's Compiler use
javax.tools.JavaCompiler via reflection if available, and fall back to
the deprecated interface if not, resulting in a working "Compile and
Run" option with JRockit.

-Curtis

On 9/3/07, Aryeh Weiss <[hidden email]> wrote:

> I am running ImageJ using the Jrockit JDK, in order to be able to use over 2GB
> of RAM. However, I cannot use the compile and run function. I verified that
> javac.exe exists, and the tools.jar is in the lib directory. It still reports
> that the JVM does not include the javac compiler.
>
> Any ideas as to how to solve this problem will be much appreciated.
>
> --aryeh
> --
> Aryeh Weiss
> School of Engineering
> Bar Ilan University
> Ramat Gan 52900 Israel
>
> Ph:  972-3-5317638
> FAX: 972-3-7384050
>
Reply | Threaded
Open this post in threaded view
|

Re: compile and run problem

Wayne Rasband
In reply to this post by Aryeh Weiss
The Plugins>Compile and Run command command requires that the tools.jar
file be in one of the Java extensions folders (e.g., jre/lib/ext). The
Windows version of ImageJ bundled with Java has tools.jar in
ImageJ\jre\lib\ext. The value of the "java.ext.dirs" property, shown in
the output of the Plugins>utilities>ImageJ Properties command, is a
list of the Java extension folders.

-wayne

> I am running ImageJ using the Jrockit JDK, in order to be able to use
> over 2GB
> of RAM. However, I cannot use the compile and run function. I verified
> that
> javac.exe exists, and the tools.jar is in the lib directory. It still
> reports
> that the JVM does not include the javac compiler.
>
> Any ideas as to how to solve this problem will be much appreciated.
>
> --aryeh
> --
> Aryeh Weiss
> School of Engineering
> Bar Ilan University
> Ramat Gan 52900 Israel
>
> Ph:  972-3-5317638
> FAX: 972-3-7384050
>