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

Home » Public Forums » archive » IDL's built-in function DILATE and ERODE doesn't work as described in help
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
IDL's built-in function DILATE and ERODE doesn't work as described in help [message #50717] Wed, 11 October 2006 19:33 Go to next message
gqshen2008@gmail.com is currently offline  gqshen2008@gmail.com
Messages: 9
Registered: October 2005
Junior Member
For example, if you have the data as a = [0, 1, 1, 0] and kernel as k
= [1, 1], according to the help provided by IDL, the result of running
the code:
result = DILATE(a, k)
will be [0, 1, 1, 0], however, IDL's output is [1, 1, 1, 0].
ERODE performs in a similar way. Does that mean the help is actually
broken?
Re: IDL's built-in function DILATE and ERODE doesn't work as described in help [message #50828 is a reply to message #50717] Mon, 16 October 2006 13:36 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Gongqin Shen writes:

> Technically speaking, we can do that, but why we use IDL at all if we
> have to put extra effort like that? I am sure many people here can
> write most of IDL's routines by themselves. What IDL should do is
> actually lessen the programming burden, not increase that.

Careful now. Radical ideas like this will get you
cross-ways with the Chairman Emeritus of the IDL
Expert Programmers Association. If IDL was so
easy everyone could use it, this newsgroup would
have to shut down and we would have to turn to
The Onion (http://www.theonion.com/) to get our
daily news fix. :-(

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: IDL's built-in function DILATE and ERODE doesn't work as described in help [message #50829 is a reply to message #50717] Mon, 16 October 2006 13:29 Go to previous message
gqshen2008@gmail.com is currently offline  gqshen2008@gmail.com
Messages: 9
Registered: October 2005
Junior Member
I know this topic has gone beyond my initial question, but I have got
a response from ITTVIS support.
In IDL, if you don't set the optional argument(s), Nx, Ny or Nz, IDL
thinks that Nx = DIMENSION(X) /2, which means that
DILATE([0, 1, 1, 0], [1, 1])
has the same effect as
DILATE([0, 1, 1, 0], [1, 1], 1)
which means that for every 1 in the data, it will align with k[1], so
the output is [1, 1, 1, 0].
If you want to get the same result as in their help, you should
explicitly set the Nx to 0.
One interesting thing is that you can set Nx to 2, 3, 5 or even -1,
-2, etc.

Another interesting finding is that if you have:
DILATE([0, 1, 1, 0], [1, 1], 3)
My initial guess is that it will output [1, 0, 0, 0], however, IDL
will not replace 1 with [1, 1, 0, 0] unless any kernel's pixle overlays
with the original data. So the real result is [0, 0, 0, 0].

Notice the sudden jump of output from [0, 0, 0, 0]:
DILATE([0, 0, 1, 1], [1, 1], 3)
will output [1, 1, 0, 0].

Gongqin Shen wrote:
> For example, if you have the data as a = [0, 1, 1, 0] and kernel as k
> = [1, 1], according to the help provided by IDL, the result of running
> the code:
> result = DILATE(a, k)
> will be [0, 1, 1, 0], however, IDL's output is [1, 1, 1, 0].
> ERODE performs in a similar way. Does that mean the help is actually
> broken?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDL's built-in function DILATE and ERODE doesn't work as described in help
Next Topic: Re: sorting string arrays - non alphabetic and user defined order

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

Current Time: Wed Oct 08 17:35:00 PDT 2025

Total time taken to generate the page: 0.00547 seconds