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

Home » Public Forums » archive » Re: Regarding the Fit_Ellipse Program
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: Regarding the Fit_Ellipse Program [message #58876] Tue, 26 February 2008 12:44 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
plim.dreaming@gmail.com writes:

> I finally got the polyfillv to work (after converting my data to
> device coordinates) but it won't plot because of memory (unable to
> allocate memory to make array). I imagine this may be related to the
> fact that the !d.x_size is 17780. Am I wrong in thinking this?

Wow! Where do you work that they bought you a monitor
as big as a city block!?

What, exactly, did you try to "plot", and what
commands did you use to do it?

> I generally see the device size as being 512.
> And I am new to IDLanROI so I have been reading through
> http://www.physics.nyu.edu/grierlab/idl_html_help/objects_an 3.html
> and am still at a loss as to how I can convert the contour plot into a
> ROI and fit an ellipse to it... any links to tutorial pages would be
> stellar! I think I am at a similar stage of confusion as this one guy
> whose post I found and paste below:

You see! These are so easy *anyone* can learn to use them. ;-)

When I was learning to use them, I was still intimidated
by people throwing big words around (polymorphism, inheritance, etc.).
Once I learned they were talking about IDL procedures and functions,
I was fine. Basically, I just load the polygon (the output from your
contour plot) into them in the INIT method, and then I use the method
ComputeMask in place of POLYFILLV and the method ComputeGeometry for
everything else I need to know. It really is very, very simple.

If you can't figure it out in five minutes, let me know, and I'll
see if I can scare up an example.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Regarding the Fit_Ellipse Program [message #58888 is a reply to message #58876] Tue, 26 February 2008 08:57 Go to previous messageGo to next message
plim.dreaming is currently offline  plim.dreaming
Messages: 22
Registered: February 2008
Junior Member
Thanks David,
I finally got the polyfillv to work (after converting my data to
device coordinates) but it won't plot because of memory (unable to
allocate memory to make array). I imagine this may be related to the
fact that the !d.x_size is 17780. Am I wrong in thinking this? I
generally see the device size as being 512.
And I am new to IDLanROI so I have been reading through
http://www.physics.nyu.edu/grierlab/idl_html_help/objects_an 3.html
and am still at a loss as to how I can convert the contour plot into a
ROI and fit an ellipse to it... any links to tutorial pages would be
stellar! I think I am at a similar stage of confusion as this one guy
whose post I found and paste below:

David Fanning wrote:
> Hi Folks,
>
> Alright, who can explain these damn IDLanROI objects to me!?
> They look like just what I need, if I could figure out
> how they work. :-(
>
> I'm trying to select and classify regions in an image.
>
> Thanks for any hints.
>
> David

Thanks again,
Bruno
Re: Regarding the Fit_Ellipse Program [message #58902 is a reply to message #58888] Tue, 26 February 2008 06:46 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
plim.dreaming@gmail.com writes:

> The last time I posted here I got awesome help and I have what I
> believe is a smaller problem this time.
> I am trying to use the fit_ellipse program (http://www.dfanning.com/
> ip_tips/fit_ellipse.html) and having some difficulty in that my ROI is
> a contour defined by a 2-D array and not a 1-D array of pixels.
> My 2-D array contains the x and y positions of all the points along
> that contour (or ROI) so I am trying to translate this fit_ellipse
> program to something I can use.

Use your contour with POLYFILLV to get the indices inside
the contour. (Or, put your contour into an IDLanROI object
and use the inherit methods there to do the same, with
slightly different results.) Then, you can create the
"blob" that works with FIT_ELLIPSE. I personally feel
a bit more secure with the IDLarROI method, but I've
used both. I've convinced myself that both methods are
"accurate," whatever that means. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Regarding the Fit_Ellipse Program [message #58971 is a reply to message #58876] Tue, 26 February 2008 13:38 Go to previous message
plim.dreaming is currently offline  plim.dreaming
Messages: 22
Registered: February 2008
Junior Member
So, I used contour to obtain the x and y positions of a certain
contour level and labeled those arrays as posx and posy.
then obtained the positions in terms of the device, because that is
what polyfillv uses:
D = convert_coord(posx,posy, /to_device)

I did a print,!D.x_size to get the device sizes (it gave me the famous
17780) so I did:
result = polyfillv(D(0,*),D(1,*),17780,17780)
plots,fit_ellipse(result)

It is unable to allocate memory for the fit_ellipse part.
Is the !D.x_size related to the monitor size or the monitor resolution
or the postscript resolution or non-of-the-above?

And with the IDLanROI I finally made the object
blob = OBJ_NEW( 'IDLanROI', posx, posy ) and have to say that I
certainly was/am scared by wording such as: "Init methods are special
life cycle methods..."!?
I am right now trying to figure out how to type in this new language
Result = Obj->[IDLanROI::]ComputeMask(
to get from here to fitting an ellipse to the object and getting the
semi-major and semi-minor axis.

Much thanks,
"Bruno Schmidt of Northern Florida State University"

- so honey what did you do at work all day today?
- oh, i drew an ellipse...
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Labeling the x-axis with a non standard time string
Next Topic: Re: Create an ENVI .img file

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

Current Time: Wed Oct 08 19:30:53 PDT 2025

Total time taken to generate the page: 0.00523 seconds