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

Home » Public Forums » archive » Re: cw_defroi vertices.
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: cw_defroi vertices. [message #30359] Thu, 18 April 2002 09:17 Go to next message
Ted Cary is currently offline  Ted Cary
Messages: 53
Registered: October 2001
Member
"David Higgins" <dmh@medphysics.leeds.ac.uk> wrote in message
news:<a03a1bd.0204180834.4fbdc03d@posting.google.com>...

> I want to be able to use cw_defroi instead because I am updating a

> draw widget.

> Obviously xVerts and yVerts are no longer defined, and it seems that

> the "area" array is the wrong dimensions to be used with the "data"

> keyword in the initialization of "ROI" (above).

>

> Does anyone know how I should input the vertices of the region of

> interest when initializing "ROI"?

>

> TIA

> Dave Higgins

Hello,

You could use my lab's modified version of CW_DEFROI, which will optionally
return the vertices. There's also an option to draw rubber band lines in
polygon mode, and a few more modifications. I can send it to you as soon as
I get to work, if you want.

I believe the reason the "area array" returned by your CW_DEFROI is of the
wrong dimensions to put into an IDLanROI is that it is a 1D vector of array
subscripts. You can convert these into x and y vectors if you know your
image dimensions--see Fanning's website (just MOD the "area" vector by
x-width to get the x vector and divide by x-width to get y.)

If you do put this area/interior data into your ROI, you'll probably want to
change the TYPE. I know there's a TYPE which treats the data as points, but
I don't know the number to use offhand. However, if you want to continue to
use ROIs of TYPE 2 (closed polygon), you'll need the vertices. Either use
the modified CW_DEFROI or write your own code to draw the region (not a bad
idea, since CW_DEFROI uses its own crash-prone event loop)--I don't think
contouring the area is the best approach.

(I don't have IDL at this computer, so I'm not sure of all of the above
advice... )

Hope this helps,
Re: cw_defroi vertices. [message #30361 is a reply to message #30359] Thu, 18 April 2002 10:07 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Higgins (dmh@medphysics.leeds.ac.uk) writes:

> I have been using DEFROI to define a region of interest, and then
> using xVerts and yVerts in the line that follows:
>
> area=DEFROI(m,n,xVerts,yVerts)
> ROI=OBJ_NEW('IDLanROI', xVerts, yVerts, type=2); type two
> ;is a closed polygon
>
> I want to be able to use cw_defroi instead because I am updating a
> draw widget.
> Something like
> area = cw_defroi(info.drawID)
>
> Obviously xVerts and yVerts are no longer defined, and it seems that
> the "area" array is the wrong dimensions to be used with the "data"
> keyword in the initialization of "ROI" (above).
>
> Does anyone know how I should input the vertices of the region of
> interest when initializing "ROI"?

You can turn your "area" into xVerts and yVerts like this.
(I assume your image is an m-by-n array.)

xVerts = area MOD m
yVerts = area / m

These will be in device (pixel) coordinate space.

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@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: filling holes in blobs quickly
Next Topic: file i/o help

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

Current Time: Wed Oct 08 14:56:22 PDT 2025

Total time taken to generate the page: 0.00517 seconds