Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Hi.
We have a large object with a bunch of puncta inside it. We want to calculate the shortest distance from each dot to the major axis. Getting the major axis is simple and drawing it on the image is easy thanks to Wayne's macro. Question: Given this line and each x, y, location of a dot, there must be a simple formula to calculate the shortest distance to the line (a perpendicular). Any help greatly appreciated. Thank you!! ========================================================================= Michael Cammer, Microscopy Core & Skirball Institute, NYU Langone Medical Center Cell: 914-309-3270 ** MY OFFICE HAS MOVED TO SKIRBALL 2nd FLOOR, Back right ** http://ocs.med.nyu.edu/microscopy & http://microscopynotes.com/ -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
http://www.intmath.com/plane-analytic-geometry/perpendicular-distance-point-line.php
-- Kenneth Sloan [hidden email] Vision is the art of seeing what is invisible to others. > On May 22, 2015, at 17:08 , Cammer, Michael <[hidden email]> wrote: > > Hi. > > We have a large object with a bunch of puncta inside it. We want to calculate the shortest distance from each dot to the major axis. Getting the major axis is simple and drawing it on the image is easy thanks to Wayne's macro. > > Question: Given this line and each x, y, location of a dot, there must be a simple formula to calculate the shortest distance to the line (a perpendicular). > > Any help greatly appreciated. > > Thank you!! > > ========================================================================= > Michael Cammer, Microscopy Core & Skirball Institute, NYU Langone Medical Center > Cell: 914-309-3270 ** MY OFFICE HAS MOVED TO SKIRBALL 2nd FLOOR, Back right ** > http://ocs.med.nyu.edu/microscopy & http://microscopynotes.com/ > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html ... [show rest of quote] -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
In reply to this post by Cammer, Michael
From this <http://rsb.info.nih.gov/ij/macros/ToothRootToCrownRatio.txt> (
http://rsb.info.nih.gov/ij/macros/ToothRootToCrownRatio.txt) IJ macro, function distance(x1, y1, x2, y2, px, py) { dx=x2-x1; dy=y2-y1; dd = sqrt(dx*dx+dy*dy); tx=dx/dd; ty=dy/dd; nx=-ty; ny=tx; acx = px-x1; acy=py-y1; return abs(acx*nx+acy*ny); } Quickly looking over the code, I believe the inputs are a line segment with endpoints at x1,y1 and x2,y2, and a point at px,py. On Fri, May 22, 2015 at 5:08 PM, Cammer, Michael <[hidden email] > wrote: > Hi. > > We have a large object with a bunch of puncta inside it. We want to > calculate the shortest distance from each dot to the major axis. Getting > the major axis is simple and drawing it on the image is easy thanks to > Wayne's macro. > > Question: Given this line and each x, y, location of a dot, there must be > a simple formula to calculate the shortest distance to the line (a > perpendicular). > > Any help greatly appreciated. > > Thank you!! > > ========================================================================= > Michael Cammer, Microscopy Core & Skirball Institute, NYU Langone Medical > Center > Cell: 914-309-3270 ** MY OFFICE HAS MOVED TO > SKIRBALL 2nd FLOOR, Back right ** > http://ocs.med.nyu.edu/microscopy & http://microscopynotes.com/ > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > ... [show rest of quote] *-- Jim Passmore* Research Associate Sealed Air Corporation -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
This was perfect. Thank you!!
_________________________________________ Michael Cammer, Optical Microscopy Specialist http://ocs.med.nyu.edu/microscopy http://microscopynotes.com/ Cell: (914) 309-3270 ________________________________________ From: ImageJ Interest Group [[hidden email]] on behalf of Jim Passmore [[hidden email]] Sent: Saturday, May 23, 2015 8:59 AM To: [hidden email] Subject: Re: shortest distance to line &/or perpendicular to line From this <http://rsb.info.nih.gov/ij/macros/ToothRootToCrownRatio.txt> ( http://rsb.info.nih.gov/ij/macros/ToothRootToCrownRatio.txt) IJ macro, function distance(x1, y1, x2, y2, px, py) { dx=x2-x1; dy=y2-y1; dd = sqrt(dx*dx+dy*dy); tx=dx/dd; ty=dy/dd; nx=-ty; ny=tx; acx = px-x1; acy=py-y1; return abs(acx*nx+acy*ny); } Quickly looking over the code, I believe the inputs are a line segment with endpoints at x1,y1 and x2,y2, and a point at px,py. On Fri, May 22, 2015 at 5:08 PM, Cammer, Michael <[hidden email] > wrote: > Hi. > > We have a large object with a bunch of puncta inside it. We want to > calculate the shortest distance from each dot to the major axis. Getting > the major axis is simple and drawing it on the image is easy thanks to > Wayne's macro. > > Question: Given this line and each x, y, location of a dot, there must be > a simple formula to calculate the shortest distance to the line (a > perpendicular). > > Any help greatly appreciated. > > Thank you!! > > ========================================================================= > Michael Cammer, Microscopy Core & Skirball Institute, NYU Langone Medical > Center > Cell: 914-309-3270 ** MY OFFICE HAS MOVED TO > SKIRBALL 2nd FLOOR, Back right ** > http://ocs.med.nyu.edu/microscopy & http://microscopynotes.com/ > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > ... [show rest of quote] *-- Jim Passmore* Research Associate Sealed Air Corporation -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Disable Popup Ads | Edit this page |