Re: IDLanROI Confusion [message #24557] |
Wed, 04 April 2001 20:20  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Mark Hadfield (m.hadfield@niwa.cri.nz) writes:
>> What happens if you make the circle much much bigger? I think then
>> the answers will converge to what you expect.
>
> I don't.
>
> Consider a pixelated diagonal line segment. The length along the pixel edges
> will exceed the true (along-diagonal) length by sqrt(2), however fine you
> pixelate it.
Well, I've done the experiment (easy with IDL :-)
and I find that the area seems to converge, but
the perimeter seems to remain about 15-17% larger
than I expect it to be. I am now trying to
figure out a clever way to add up the straight
line distance between points without using a loop.
(And without resorting to JD.) I'll let you know
what I find. :-)
Cheers,
David
P.S. Let's just say that 15% is probably right at the
border of the other, unavoidable, errors in my analysis,
but it is big enough to worry me.
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
|
Re: IDLanROI Confusion [message #24568 is a reply to message #24560] |
Wed, 04 April 2001 14:47   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
davidf@dfanning.com (David Fanning) writes:
> Folks,
>
> Alright. I admit it. I don't get it. :-(
>
> I want to use the IDLanROI object to calculate
> the perimeter, centroid, and area of a region of interest.
> But I'm not sure the values can be trusted. Here is an
> example.
...
> Here are the results. 15% error in the perimeter is pretty large!
>
> Calculated Perimeter: 362.61017
> Expected Perimeter: 314.159
> Discrepancy in Perimeter (percent): 115.42240%
>
> Calculated Area: 7691.5000
> Expected Area: 7853.98
> Discrepancy in Area (percent): 97.931216%
>
> Calculated Centroid: 199.50135 200.25225
> Expected Centroid: 200 200
>
> Am I doing something wrong, or should I believe these numbers?
> The same exercise with a square region produced accurate numbers.
>
> My expected ROI's are not squares or circles, but they are
> much closer to circles than squares.
What do you mean, they aren't squares or circles? If it isn't a
circle then you won't get a perfect match to the theory, right?
More than likely the region of interest becomes pixelated into square
pixels. It's pretty clear to me that this will give a greater
perimeter than a true circle since there are more horizontal and
vertical segments than are required.
What happens if you make the circle much much bigger? I think then
the answers will converge to what you expect.
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: IDLanROI Confusion [message #24617 is a reply to message #24568] |
Thu, 05 April 2001 11:18  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Craig Markwardt (craigmnet@cow.physics.wisc.edu) writes:
> More than likely the region of interest becomes pixelated into square
> pixels. It's pretty clear to me that this will give a greater
> perimeter than a true circle since there are more horizontal and
> vertical segments than are required.
It is true that this perimeter measurement is affected
by pixelation. I've found that by first smoothing the
data before I calculate the ISOCONTOUR, then using
those values for the IDLanROI object, I can get
within a couple of percent of the actual value, as
opposed to the normal 15-17%.
By the way, I just noticed that the connectivity
and vertices values on the ISOCONTOUR command are
actually reversed from what is printed in the on-line
help. That may explain a bit of my confusion. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|