Hi I have a stack of images with well defined spots that move from one frame to the next. I am able to use the "Find maxima" function to easily mark each spot with a point, but i was wondering if there is a way to automatically draw lines between each point and it's closest neighbours (i.e. the closest 3-6 neighbours).
Does anyone know of a way of doing this with ImageJ or with other software? Cheers |
Good evening,
i thought a short moment about your problem. First of all: Is a pixel equal to a point? Or do you mean points on subpixlair niveau? If it is a pixel, than you have to think about the problematic of 4- or 8- chain-code. Than a big question would be, how many points to you have on one picture (if there are only a few points on a picture you can try to use a slow working algorithm and measure the distance between all points and than choose only the shortest.) Maybe you could use somethink like a inversion of the gras-fire-algorithm. yours sincerly, mats 2011/5/4 mattbenton123 <[hidden email]> > Hi I have a stack of images with well defined spots that move from one > frame > to the next. I am able to use the "Find maxima" function to easily mark > each > spot with a point, but i was wondering if there is a way to automatically > draw lines between each point and it's closest neighbours (i.e. the closest > 3-6 neighbours). > > Does anyone know of a way of doing this with ImageJ or with other software? > > Cheers > > -- > View this message in context: > http://imagej.588099.n2.nabble.com/How-to-automatically-draw-lines-between-a-point-and-it-s-nearest-neighbours-tp6331539p6331539.html > Sent from the ImageJ mailing list archive at Nabble.com. > |
In reply to this post by mattbenton123
If you already have the xy coordinates of each point's nearest neighbors,
then hoe about using the "*drawLine(x1, y1, x2, y2)" *macro functon. Note, this function should/will be applied to the currently active image. David Wewbtser On Wed, May 4, 2011 at 9:35 AM, mattbenton123 <[hidden email]>wrote: > Hi I have a stack of images with well defined spots that move from one > frame > to the next. I am able to use the "Find maxima" function to easily mark > each > spot with a point, but i was wondering if there is a way to automatically > draw lines between each point and it's closest neighbours (i.e. the closest > 3-6 neighbours). > > Does anyone know of a way of doing this with ImageJ or with other software? > > Cheers > > -- > View this message in context: > http://imagej.588099.n2.nabble.com/How-to-automatically-draw-lines-between-a-point-and-it-s-nearest-neighbours-tp6331539p6331539.html > Sent from the ImageJ mailing list archive at Nabble.com. > |
In reply to this post by mattbenton123
Hi,
On May 4, 2011, at 12:35 PM, mattbenton123 wrote: > Hi I have a stack of images with well defined spots that move from > one frame > to the next. I am able to use the "Find maxima" function to easily > mark each > spot with a point, but i was wondering if there is a way to > automatically > draw lines between each point and it's closest neighbours (i.e. the > closest > 3-6 neighbours). > > Does anyone know of a way of doing this with ImageJ or with other > software? The Graph_ plugin will create lists of nearest neighbors based upon some maximum separation distance that you define. It is set up for 2d, but you could easily adapted it for 3d. http://rsb.info.nih.gov/ij/plugins/graph/index.html Cheers, Ben |
In reply to this post by David Webster
Hi,
I had wrote a macro that can be used to measure distances between one point and its surrounding points. It will also draw overlay lines to connect that point and its surrounding points. Maybe you can modify the macro to suit your needs. The macro is attached below. To run this macro, copy it into a blank macro window and run it. //open an example image run("Blobs (25K)"); run("Find Maxima...", "noise=25 output=[Point Selection]"); run("ROI Manager..."); roiManager("Add"); function length (x1, y1, x2, y2) { sum_difference_squared = pow((x2 - x1),2) + pow((y2 - y1),2); output = pow(sum_difference_squared, 0.5); return output; } ROI=1; //To select the point / ROI run("Remove Overlay"); getVoxelSize(width, height, depth, unit); run("Clear Results"); run("Set Measurements...", " centroid display redirect=None decimal=3"); roiManager("Deselect"); roiManager("Measure"); r=nResults(); Label=newArray(r); X=newArray(r); Y=newArray(r); for(i=0;i<r;i++) { Label[i]=getResultLabel(i); X[i]=getResult("X",i)/width; //convert to pixel for use with makeLine Y[i]=getResult("Y",i)/width; //convert to pixel for use with makeLine } //Draw overlay line for(i=0;i<r;i++) { makeLine(X[ROI-1], Y[ROI-1], X[i], Y[i], 1); run("Add Selection...", "stroke=white width=2"); } run("Select None"); d=newArray(r); for(i=0;i<r;i++) { d[i]=length(X[ROI-1],Y[ROI-1],X[i],Y[i]); //index starts at 0 setResult(Label[ROI-1], i, d[i]); //index starts at 0 } Best Regards, John Lim ________________________________________ From: ImageJ Interest Group [[hidden email]] On Behalf Of David Webster [[hidden email]] Sent: Friday, May 06, 2011 5:33 AM To: [hidden email] Subject: Re: How to automatically draw lines between a point and it's nearest neighbours If you already have the xy coordinates of each point's nearest neighbors, then hoe about using the "*drawLine(x1, y1, x2, y2)" *macro functon. Note, this function should/will be applied to the currently active image. David Wewbtser On Wed, May 4, 2011 at 9:35 AM, mattbenton123 <[hidden email]>wrote: > Hi I have a stack of images with well defined spots that move from one > frame > to the next. I am able to use the "Find maxima" function to easily mark > each > spot with a point, but i was wondering if there is a way to automatically > draw lines between each point and it's closest neighbours (i.e. the closest > 3-6 neighbours). > > Does anyone know of a way of doing this with ImageJ or with other software? > > Cheers > > -- > View this message in context: > http://imagej.588099.n2.nabble.com/How-to-automatically-draw-lines-between-a-point-and-it-s-nearest-neighbours-tp6331539p6331539.html > Sent from the ImageJ mailing list archive at Nabble.com. > |
in my case for example i used: find maxima and then with this plug-in http://
wbgn013.biozentrum.uni-wuerzburg.de/ImageJ/delaunay.html i obtained the Delaunay triangulation between each point. a question: is it possible in some way to map with different colours each point or each traingle to show how many first neighbors for each point are present? a way map and show how ordererd could be my system. Thank you Gianpaolo |
Free forum by Nabble | Edit this page |