Re: IDL's built-in function DILATE and ERODE doesn't work as described in help [message #50707 is a reply to message #50705] |
Thu, 12 October 2006 06:27   |
Jo Klein
Messages: 54 Registered: January 2006
|
Member |
|
|
The same applies to LABEL_REGION, which has caused me quite some
headache. IDL help doesn't even mention that restriction for
label_region, and it's not available in source code to figure out. Try:
a=shift(dist(20),10)
b=a lt 7
tvimage,bytscl(b),/noint
Then:
c=label_region(b)
tvimage,bytscl(c),/noint
The voxels on the border are mistakenly incorporated into the background
component, which is *really* dangerous when you use this to extract
features (e.g. a histogram each) from different objects in an image.
I would go as far as to say this is an error in IDL.
Cheers,
Jo
Karsten Rodenacker wrote:
> Don't use IDL's dilate and erode without embedding your data into a
> sufficiently large array. Border handling is not coherently
> implemented. That is a large disadvantage, not to say an error, for the
> application of math. morph. operations in sequences. Ask for
> improvement, possibly ITTVIS can be convinced!
> Regards
> Karsten
>
> Am Thu, 12 Oct 2006 04:33:59 +0200 schrieb Gongqin Shen
> <gqshen2008@gmail.com>:
>
>> 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?
>>
>
>
|
|
|