comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Calculate maximum diameter?
items: Re: Calculate maximum diameter?

Calculate maximum diameter?
type: item
description: Hi folks, I have a set of roughly circular ROI's for which I want to compute the maximum diameter - the longest straight line from one point on the boundary of the ROI, through the center, to the opposing boundary. Any ideas about the best way to do this? I do a loop I guess....compute the diameter for all 360 degrees around the center. Principal components analysis also springs to mind, but some of these ROI's have different scales in the x and y dimensions. Can anyone help? Jeff
creator: Jeff N.
date: 2006-02-04T20:28:07-00:00

Re: Calculate maximum diameter?
type: item
description: It depends on what you mean by 'roughly' - if the radius is a random function, you won't do any better than to search them all; if you means an ellipse, or some other predictable deviation from circular, you could, of course, get there quicker. Greg
creator: greg michael
date: 2006-02-06T13:14:51-00:00

Re: Calculate maximum diameter?
type: item
description: Jeff N. wrote: > Hi folks, > > I have a set of roughly circular ROI's for which I want to compute the > maximum diameter - the longest straight line from one point on the > boundary of the ROI, through the center, to the opposing boundary. Is it essential that it go through the center? In many contexts its more useful to know the length of the longest straight line from any given vertex to any other vertex. There's a pretty obvious O(N^2) algorithm for finding that maximun distance.
creator: James Kuyper
date: 2006-02-06T15:41:43-00:00

Re: Calculate maximum diameter?
type: item
description: Yep, it does need to go through the center. I may end up using a fitted ellipse as a starting point, so we'll just see what works best. Thanks for the ideas! Jeff kuyper@wizard.net wrote: > Jeff N. wrote: >> Hi folks, >> >> I have a set of roughly circular ROI's for which I want to compute the >> maximum diameter - the longest straight line from one point on the >> boundary of the ROI, through the center, to the opposing boundary. > > Is it essential that it go through the center? In many contexts its > more useful to know the length of the longest straight line from any > given vertex to any other vertex. There's a pretty obvious O(N^2) > algorithm for finding that maximun distance.
creator: Jeff N.
date: 2006-02-06T22:36:24-00:00

Re: Calculate maximum diameter?
type: item
description: Jeff N. wrote: > Yep, it does need to go through the center. I may end up using a > fitted ellipse as a starting point, so we'll just see what works best. > Thanks for the ideas! How do you define the center of your "roughly circular" ROI's? Geometric centroid? Does this have to correspond to a discrete ROI pixel? And how do you define diameter? From one ROI pixel through the "center" to another ROI pixel? Or can the centroid and the opposite side pixel be non-discrete? Depending on how "big" a pixel is compared to your length units, maybe it doesn't matter (e.g. if a length unit was a pixel) After computing your centroid, why can't you just rotate through 180deg. from one ROI pixel to the next, construct a line from your current pixel through your centroid and determine where it intersects your ROI on the other side? It seems a bit ham-fisted maybe, but it doesn't rely on any particular definition of "roughly circular." I'm curious as to why you need the maximum diameter of your ROI's. If you have a lot of them, usually a particular orientation is chosen -- with a common defined axis of symmetry assumed to be random with respect to that orientation -- and the dimension of your ROI's along that orientation is used (e.g. to compute statistics on particle sizes). paulv > > Jeff > > > kuyper@wizard.net wrote: > >> Jeff N. wrote: >> >>> Hi folks, >>> >>> I have a set of roughly circular ROI's for which I want to compute the >>> maximum diameter - the longest straight line from one point on the >>> boundary of the ROI, through the center, to the opposing boundary. >> >> Is it essential that it go through the center? In many contexts its >> more useful to know the length of the longest straight line from any >> given vertex to any other vertex. There's a pretty obvious O(N^2) >> algorithm for finding that maximun distance. > > -- Paul van Delst CIMSS @ NOAA/NCEP/EMC
creator: Paul Van Delst[1]
date: 2006-02-06T23:17:10-00:00

Re: Calculate maximum diameter?
type: item
description: Hmm, possibly the attached routine is of some help. It is extracted from a thesis http://www.isical.ac.in/~amitava/thesis.ps Regards Karsten Am Sat, 04 Feb 2006 21:28:07 +0100 schrieb Jeff N. <jnettle1@utk.edu>: > Hi folks, > > I have a set of roughly circular ROI's for which I want to compute the > maximum diameter - the longest straight line from one point on the > boundary of the ROI, through the center, to the opposing boundary. Any > ideas about the best way to do this? I do a loop I guess....compute > the diameter for all 360 degrees around the center. Principal > components analysis also springs to mind, but some of these ROI's have > different scales in the x and y dimensions. Can anyone help? > > Jeff > ; $Id: ad_msc.pro,v 1.2 2006/02/07 08:04:03 karo Exp $ ;+ ; NAME: ; AD_MSC ; ; PURPOSE: ; Calculation of the minimumspanning circle ; ; CATEGORY: ; Geometry ; ; CALLING SEQUENCE: ; Rad=ad_msc(X,Alpha) ; ; INPUTS: ; X: 2/3 dim Vector with coordinates [3,nx] ; Alpha: Weight ; ; KEYWORD PARAMETERS: ; WEIGHT: Switch set decreased weight, def. constant weight ; ; MAX_ITERATIONS: Number of iterations ; CENTER: variable, will contain the coordinates of msc ; EPS: Epsilon for exact match ; NP: Number of nonprinted lines if PRINT is on ; PRINT: Switch for printing ; ; OUTPUTS: ; Result: Radius of MSC ; ; PROCEDURE: ; ; EXAMPLE: ; See in program file ; ; ; MODIFICATION HISTORY: ; Written by: Karsten Rodenacker, after A. Datta, 1998. ; Nov. 99 Revised for 3d ; $Log: ad_msc.pro,v $ ; Revision 1.2 2006/02/07 08:04:03 karo ; Conversion Win to Mac ; ; FUNCTION ad_msc, x, a, $ MAX_ITERATIONS=nit, WEIGHT=ia, $ CENTER=cent,EPS=eps, NP=np, $ PRINT=print,HIT_POINT=i1 ;- IF NOT keyword_set(eps) THEN eps=0.1E-7 eps=double(eps) ; if not keyword_set(nit) then nit=2000l IF NOT keyword_set(nit) THEN nit=(size(x,/dim))[1]*10. IF NOT keyword_set(np) THEN np=100 sx=size(x) nx=n_elements(x)/sx[1] w=double(total(x[0,*])/nx) FOR i=1,sx[1]-1 DO w=[temporary(w),double(total(x[i,*])/nx)] it=0…
creator: Karsten Rodenacker
date: 2006-02-07T08:06:11-00:00

Re: Calculate maximum diameter?
type: item
description: Thanks for the code Karsten, I'll give it a look!
creator: Jeff N.
date: 2006-02-08T23:01:36-00:00

Re: Calculate maximum diameter?
type: item
description: Paul Van Delst wrote: > How do you define the center of your "roughly circular" ROI's? Geometric centroid? Does > this have to correspond to a discrete ROI pixel? And how do you define diameter? From one > ROI pixel through the "center" to another ROI pixel? Or can the centroid and the opposite > side pixel be non-discrete? Depending on how "big" a pixel is compared to your length > units, maybe it doesn't matter (e.g. if a length unit was a pixel) Yes, I'm defining the center as the geometric centroid. I don't necessarily think that it has to correspond to a discrete pixel, but you are right that this probably doesn't matter, and you guessed the reason why too. > > After computing your centroid, why can't you just rotate through 180deg. from one ROI > pixel to the next, construct a line from your current pixel through your centroid and > determine where it intersects your ROI on the other side? It seems a bit ham-fisted maybe, > but it doesn't rely on any particular definition of "roughly circular." I can, and there's a good chance this is what I'll do. I'm trying to decide if the PCA would be more effective though. Plus, I'm going to probably have trouble coding this approach :) I understand that how i'm defining "roughly circular" is important....I think that they're circular enough (not shaped like stars or anything) so that the PCA would work. If this helps, I've done some measurements on these that are the perimeter of the ROI divided by the perimeter of a circle with the same area as the ROI, and these measurements are usually within 30-40% of a circle. (why am i using that kind of measurement? b/c someone else used that method and i'm evaluating it :) ) > > I'm curious as to why you need the maximum diameter of your ROI's. If you have a lot of > them, usually a particular orientation is chosen -- with a common defined axis of symmetry > assumed to be random with respect to that orientation -- and the dimension of your ROI's > along that orientation is used (…
creator: Jeff N.
date: 2006-02-08T23:18:05-00:00