comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: IDLanROI Confusion
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: IDLanROI Confusion [message #24557] Wed, 04 April 2001 20:20 Go to next message
davidf is currently offline  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 #24560 is a reply to message #24557] Wed, 04 April 2001 16:55 Go to previous messageGo to next message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
"Craig Markwardt" <craigmnet@cow.physics.wisc.edu> wrote in message
news:onitkkcp6b.fsf@cow.physics.wisc.edu...
>
> 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.

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.

---
Mark Hadfield
m.hadfield@niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield
National Institute for Water and Atmospheric Research
Re: IDLanROI Confusion [message #24568 is a reply to message #24560] Wed, 04 April 2001 14:47 Go to previous messageGo to next message
Craig Markwardt is currently offline  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 Go to previous message
davidf is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: long to float
Next Topic: Index of a sector

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 09:21:50 PDT 2025

Total time taken to generate the page: 0.00690 seconds