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

Home » Public Forums » archive » Re: Still getting trouble with ROI's
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: Still getting trouble with ROI's [message #37881] Tue, 03 February 2004 06:33
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Ben Tupper writes:

> Not to beat a dead horse (I agree that Nunio is pushing a rope uphill),
> but...
>
> Even if POLYFILLV returns the subscript indices out of order, then he
> could still work with them using the built-in ARRAY_INDICES and your
> FIND_BOUNDARY routines to get the outline.
>
> Am I missing something?

Well, I don't think ARRAY_INDICES is going to help
much (when did RSI sneak *that* program into IDL!),
but FIND_BOUNDARY is what he wants, for sure. It's
just that it is such an inelegant extra step. He
has already collected the points he wants, the
points that were used in POLYFILLV to get the
indices that were returned. He just needs to
intercept the program at the appropriate place.

My only point is that it is simpler, less time
consuming, *and* you learn more about what you
are doing if you just build the functionality
for yourself than if you try to push the
square peg of CW_DEFOI into this round hole. :-)

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
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
Re: Still getting trouble with ROI's [message #37882 is a reply to message #37881] Tue, 03 February 2004 05:54 Go to previous message
btt is currently offline  btt
Messages: 345
Registered: December 2000
Senior Member
David Fanning wrote:
> Bruce Bowler writes:
>
>
>> Based on the fact that xy is the result of a "where", I'd assume that the
>> single number returned is the "1 dimensional index that would result if
>> the 2 dimensional array were addressed at X,Y".
>>
>
> I'm a big Janet Jackson fan (or at least NOW I am!),
> but I'm pretty sure this won't work. The problem is
> that the WHERE function (or, actually, POLYFILLV in
> this case) doesn't return *ordered* indices. So you
> can't really use the indices to "draw" anything.
>
> But even if you could, I think Nuno needs the outline,
> not the indices inside the outline. He's just using
> the wrong tool for the job, I think.
>

Hi David,

Not to beat a dead horse (I agree that Nunio is pushing a rope uphill),
but...

Even if POLYFILLV returns the subscript indices out of order, then he
could still work with them using the built-in ARRAY_INDICES and your
FIND_BOUNDARY routines to get the outline.

Am I missing something?

Ben
Re: Still getting trouble with ROI's [message #37883 is a reply to message #37882] Tue, 03 February 2004 05:56 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Nuno Oliveira writes:

> P.S. I guess that you were not one of the thousands that called to the
> SuperBowl organization claiming against Janet's.arguments.

I have no objection to Janet's "arguments". I was more offended
by the guy who kept grabbing his crouch every 5 seconds. Don't
we have any jock ointment around here!?

The alternative, of course, was to switch the channel and
watch the ladies play 7 on 7 tackle football while
dressed in lingerie.

I think it's just the latest sign (as if we needed another
with the Bushies and all) that the world is coming to
an end. :-(

Cheers,

David

P.S. Let's just say my yearly foray into television land
only confirmed that our decision to unplug the TV 15 years
ago was about the smartest decision I ever made!

--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
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
Re: Still getting trouble with ROI's [message #37884 is a reply to message #37882] Tue, 03 February 2004 03:25 Go to previous message
Nuno Oliveira is currently offline  Nuno Oliveira
Messages: 75
Registered: October 2003
Member
Sorry if sometimes my purpose is not very clear. I try to put little
problems in here that you sometimes can help with your tips. I'm expecting
these tips to help on programming my tools and not to solve all my problems.
I guess if I don't think hard on my problems I'll never learn.



Cheers,



Nuno.



P.S. I guess that you were not one of the thousands that called to the
SuperBowl organization claiming against Janet's.arguments.




"David Fanning" <david@dfanning.com> wrote in message
news:MPG.1a883e07f0fedaf39897ce@news.frii.com...
> Bruce Bowler writes:
>
> I'm a big Janet Jackson fan (or at least NOW I am!),
> but I'm pretty sure this won't work. The problem is
> that the WHERE function (or, actually, POLYFILLV in
> this case) doesn't return *ordered* indices. So you
> can't really use the indices to "draw" anything.
>
> But even if you could, I think Nuno needs the outline,
> not the indices inside the outline. He's just using
> the wrong tool for the job, I think.
>
> Cheers,
>
> David
> --
> David W. Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> 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
Re: Still getting trouble with ROI's [message #37885 is a reply to message #37884] Tue, 03 February 2004 03:17 Go to previous message
Nuno Oliveira is currently offline  Nuno Oliveira
Messages: 75
Registered: October 2003
Member
Thanks, Bruce. I was looking in the tutorials and it was not clear the
working procedure of the where function (it is now?). It works on a mask
right? So if have result = where(xy) it would mean that xy is a matrix (in
the case 2-D) where de elements of the roi have value 1 and the others have
value 0.

So maybe the solution is seeking for i,j such that xy(i,j) eq 1. If true
then adding these (i,j) to a pointer and returning this two-dimensional
array? What do you say? I'm going to try.



Cheers,



Nuno.



"Bruce Bowler" <bbowler@bigelow.org> wrote in message
news:pan.2004.02.02.17.47.37.709701@bigelow.org...
> On Mon, 02 Feb 2004 16:40:14 +0000, Nuno Oliveira put fingers to keyboard
> and said:
>
> Based on the fact that xy is the result of a "where", I'd assume that the
> single number returned is the "1 dimensional index that would result if
> the 2 dimensional array were addressed at X,Y".
>
> --
> +-------------------+--------------------------------------- ------------+
> Bruce Bowler | To be great is to be misunderstood. - Ralph Waldo
> 1.207.633.9600 | Emerson
> bbowler@bigelow.org |
> +-------------------+--------------------------------------- ------------+
>
Re: Still getting trouble with ROI's [message #37886 is a reply to message #37885] Tue, 03 February 2004 03:02 Go to previous message
Nuno Oliveira is currently offline  Nuno Oliveira
Messages: 75
Registered: October 2003
Member
At this stage I'm trying to build an application that draw and manages ROI'
s, with some requirements but still trying to make it simple. My priorities
make that I'm trying to maximize the use of idl functions. And then when
finished, if I still have time for development then I make some functions of
my own. That was the reason why was making use of cw_defroi

(and I'm still trying)



Besides drawing, it should allow the user, to move and eventually resize,
and to save and load. I was thinking of making it through x and y indices.
I can "see" if the user presses the arrows and then affecting the indices.
For resizing, checking if the user clicks the border and then .



I haven't think in the solution for all options. But for now it is clear
that if I want to manipulate the roi I need to get the indices in the (x,y)
form.


"David Fanning" <david@dfanning.com> wrote in message
news:MPG.1a883b05b7f372e19897cd@news.frii.com...
>
> I presume you are trying to draw a polygon, right? And you
> want the coordinates of the polygon, *not* the indices of
> the points inside the polygon. Is that right? The requirement
> for my program is that the ROI points be drawn in a freehand
> way. Does that bother you?
>
> Give me a day or two. Perhaps late tonight, although--of course--
> that will mean a LOT more testing on your part. :-)
>
> Cheers,
>
> David
> --
> David W. Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> 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
Re: Still getting trouble with ROI's [message #37898 is a reply to message #37886] Mon, 02 February 2004 09:59 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Bruce Bowler writes:

> Based on the fact that xy is the result of a "where", I'd assume that the
> single number returned is the "1 dimensional index that would result if
> the 2 dimensional array were addressed at X,Y".
>
> If I weren't so tired from partying after the Pat's won last night I'd
> tell you how to turn that back into 2 dimensions, but my brain is toast
> right now. I'm sure either a Panthers fan, someone on the left coast or
> someone who doesn't care about the Pat's or the Panthers can help...

I'm a big Janet Jackson fan (or at least NOW I am!),
but I'm pretty sure this won't work. The problem is
that the WHERE function (or, actually, POLYFILLV in
this case) doesn't return *ordered* indices. So you
can't really use the indices to "draw" anything.

But even if you could, I think Nuno needs the outline,
not the indices inside the outline. He's just using
the wrong tool for the job, I think.

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
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
Re: Still getting trouble with ROI's [message #37899 is a reply to message #37898] Mon, 02 February 2004 09:47 Go to previous message
Bruce Bowler is currently offline  Bruce Bowler
Messages: 128
Registered: September 1998
Senior Member
On Mon, 02 Feb 2004 16:40:14 +0000, Nuno Oliveira put fingers to keyboard
and said:

> My purpose is not to decompose. I could decompose outside cw_defroi (and
> then my problem is I can not distinguish between (127,2) from (12,72) when I
> have xy=1272). I was looking for the place where cw_defroi 'composes' xy
> and, avoiding composition, making it two separate variables or one variable
> with two dimensions.

Based on the fact that xy is the result of a "where", I'd assume that the
single number returned is the "1 dimensional index that would result if
the 2 dimensional array were addressed at X,Y".

If I weren't so tired from partying after the Pat's won last night I'd
tell you how to turn that back into 2 dimensions, but my brain is toast
right now. I'm sure either a Panthers fan, someone on the left coast or
someone who doesn't care about the Pat's or the Panthers can help...

--
+-------------------+--------------------------------------- ------------+
Bruce Bowler | To be great is to be misunderstood. - Ralph Waldo
1.207.633.9600 | Emerson
bbowler@bigelow.org |
+-------------------+--------------------------------------- ------------+
Re: Still getting trouble with ROI's [message #37900 is a reply to message #37899] Mon, 02 February 2004 09:47 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Nuno Oliveira writes:

> Indeed, I'm going to start thinking my ROI tool. But still I've think very
> well what I really need.
>
> My deception comes from the fact that cw_defroi is not compatible with roi
> objects. That's what is REALLY annoying me.

Ah, well, two different eras. I feel the same way when
I'm flirting with those young waitresses down at the cafe. :-(

The time I've spent on this already this morning, combined
with the fact that I'm trying hard to get some real work done,
has nearly pushed this program over my personal threshold of
"Oh, hell, I'll just write the damn thing!" That, and I just
realized I could use something very much like it for the
next stage of the program I am (suppose to be) working on.

I presume you are trying to draw a polygon, right? And you
want the coordinates of the polygon, *not* the indices of
the points inside the polygon. Is that right? The requirement
for my program is that the ROI points be drawn in a freehand
way. Does that bother you?

Give me a day or two. Perhaps late tonight, although--of course--
that will mean a LOT more testing on your part. :-)

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
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
Re: Still getting trouble with ROI's [message #37901 is a reply to message #37900] Mon, 02 February 2004 09:33 Go to previous message
Nuno Oliveira is currently offline  Nuno Oliveira
Messages: 75
Registered: October 2003
Member
Indeed, I'm going to start thinking my ROI tool. But still I've think very
well what I really need.



My deception comes from the fact that cw_defroi is not compatible with roi
objects. That's what is REALLY annoying me.



"David Fanning" <david@dfanning.com> wrote in message
news:MPG.1a88346d80b866c89897cc@news.frii.com...
> Nuno Oliveira writes:
> Sigh... Right. Maybe you should be writing your own ROI routine.
> I'm pretty sure it could have been done by now. :-)
>
> Cheers,
>
> David
>
> P.S. Let's just say I have the funny suspicion that this
> tool might be a wrench and that what you are looking for
> is a hammer. :-)
>
> --
> David W. Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> 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
Re: Still getting trouble with ROI's [message #37902 is a reply to message #37901] Mon, 02 February 2004 09:18 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Nuno Oliveira writes:

> My purpose is not to decompose. I could decompose outside cw_defroi (and
> then my problem is I can not distinguish between (127,2) from (12,72) when I
> have xy=1272). I was looking for the place where cw_defroi 'composes' xy
> and, avoiding composition, making it two separate variables or one variable
> with two dimensions.

Sigh... Right. Maybe you should be writing your own ROI routine.
I'm pretty sure it could have been done by now. :-)

Cheers,

David

P.S. Let's just say I have the funny suspicion that this
tool might be a wrench and that what you are looking for
is a hammer. :-)

--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
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
Re: Still getting trouble with ROI's [message #37904 is a reply to message #37902] Mon, 02 February 2004 08:40 Go to previous message
Nuno Oliveira is currently offline  Nuno Oliveira
Messages: 75
Registered: October 2003
Member
My purpose is not to decompose. I could decompose outside cw_defroi (and
then my problem is I can not distinguish between (127,2) from (12,72) when I
have xy=1272). I was looking for the place where cw_defroi 'composes' xy
and, avoiding composition, making it two separate variables or one variable
with two dimensions.



"David Fanning" <david@dfanning.com> wrote in message
news:MPG.1a8825d1b36013cf9897cb@news.frii.com...
> Actually, this doesn't look too hard to me.
> Just define a couple of keywords to get back
> what you want, then in the "all done" portion
> of the code (near the bottom), fill up your keywords
> before you return the "xy" variable. You will probably
> have to do some checking for the various things "xy"
> can be, but basically you just want to decompose
> that variable, I think.
>
> "Own event loop" means the program is not using XManager
> to check for events. This program is what you might call
> a "hypermodal" widget. You ain't doin' nothin' until this
> program is finished!
>
> Cheers,
>
> David
> --
> David W. Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> 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
Re: Still getting trouble with ROI's [message #37905 is a reply to message #37904] Mon, 02 February 2004 08:16 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Nuno Oliveira writes:

> I was looking into that now, :(.
>
> I don't understand the code sequence. What is that "own event loop"?

Actually, this doesn't look too hard to me.
Just define a couple of keywords to get back
what you want, then in the "all done" portion
of the code (near the bottom), fill up your keywords
before you return the "xy" variable. You will probably
have to do some checking for the various things "xy"
can be, but basically you just want to decompose
that variable, I think.

"Own event loop" means the program is not using XManager
to check for events. This program is what you might call
a "hypermodal" widget. You ain't doin' nothin' until this
program is finished!

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
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
Re: Still getting trouble with ROI's [message #37906 is a reply to message #37905] Mon, 02 February 2004 08:01 Go to previous message
Nuno Oliveira is currently offline  Nuno Oliveira
Messages: 75
Registered: October 2003
Member
I was looking into that now, :(.



I don't understand the code sequence. What is that "own event loop"?





"David Fanning" <david@dfanning.com> wrote in message
news:MPG.1a881dc54d57a0ca9897ca@news.frii.com...
> Nuno Oliveira writes:
>
>> That's really encouraging!
>>
>> Well, I'm thinking to go on an great adventure, ;) Getting cw_Defroi
saving
>> it as my_cw_defroi and see if I can make it to return a two-dimensional
>> array with the coordinates.
>>
>> If I don't come back in, say, an hour or two, call an ambulance! ;)
>
> Oh, oh. Have you seen that code, with its own event loop!?
> I hope they have a defibrillator. :-(
>
> Cheers,
>
> David
> --
> David W. Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> 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
Re: Still getting trouble with ROI's [message #37907 is a reply to message #37906] Mon, 02 February 2004 07:42 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Nuno Oliveira writes:

> That's really encouraging!
>
> Well, I'm thinking to go on an great adventure, ;) Getting cw_Defroi saving
> it as my_cw_defroi and see if I can make it to return a two-dimensional
> array with the coordinates.
>
> If I don't come back in, say, an hour or two, call an ambulance! ;)

Oh, oh. Have you seen that code, with its own event loop!?
I hope they have a defibrillator. :-(

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
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
Re: Still getting trouble with ROI's [message #37908 is a reply to message #37907] Mon, 02 February 2004 07:30 Go to previous message
Nuno Oliveira is currently offline  Nuno Oliveira
Messages: 75
Registered: October 2003
Member
That's really encouraging!



Well, I'm thinking to go on an great adventure, ;) Getting cw_Defroi saving
it as my_cw_defroi and see if I can make it to return a two-dimensional
array with the coordinates.



If I don't come back in, say, an hour or two, call an ambulance! ;)



Cheers,



Nuno.



"David Fanning" <david@dfanning.com> wrote in message
news:MPG.1a8818303cc63e479897c9@news.frii.com...
> Nuno Oliveira writes:
>
>> Can someone tell me why cw_defroi returns the coordinates of the
components
>> of the roi together.? When I start to use the roi related objects they
don't
>> understand this variable. When I call any of these objects I need to
pass
>> the coordinates SEPARATE. If I use cw_defroi I have to separate the
>> coordinates returned by cw_defroi before use the objects? This makes any
>> sense?
>
> I don't think you have been working with IDL long enough. :-)
>
> Here's my favorite all-time quote on the IDL newsgroup:
>
> "It looks like IDL is something that has been
> patched together over a period of 20 years
> by a 100 different programmers!"
>
> Indeed.
>
> Cheers,
>
> David
>
> P.S. Let's just say I would be happy if the programs I
> wrote two months ago still worked with the programs I'm
> writing today. :-)
>
> --
> David W. Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> 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
Re: Still getting trouble with ROI's [message #37909 is a reply to message #37908] Mon, 02 February 2004 07:18 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Nuno Oliveira writes:

> Can someone tell me why cw_defroi returns the coordinates of the components
> of the roi together.? When I start to use the roi related objects they don't
> understand this variable. When I call any of these objects I need to pass
> the coordinates SEPARATE. If I use cw_defroi I have to separate the
> coordinates returned by cw_defroi before use the objects? This makes any
> sense?

I don't think you have been working with IDL long enough. :-)

Here's my favorite all-time quote on the IDL newsgroup:

"It looks like IDL is something that has been
patched together over a period of 20 years
by a 100 different programmers!"

Indeed.

Cheers,

David

P.S. Let's just say I would be happy if the programs I
wrote two months ago still worked with the programs I'm
writing today. :-)

--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
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: Re: Using CALL_EXTERNAL with C++ Code
Next Topic: Virtual Machine Crashes :-(

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

Current Time: Wed Oct 08 18:39:51 PDT 2025

Total time taken to generate the page: 0.00553 seconds