[Insight-users] morphological openings by a segment

Miller, James V (Research) millerjv at crd.ge.com
Wed, 21 Apr 2004 09:37:14 -0400


ITK provides a couple of structuring elements for convenience (BinaryBall
and BinaryCross).  But any other structuring element can be constructed 
by instantiating a Neighborhood and setting the values you want to be one.
The indexing in a Neighborhood is similar to the indexing in an image

typedef itk::Neighorhood<char, 2> ElementType;
ElementType element;
ElementType::SizeType radius;
radius.Fill(3);
element.SetSize( radius );

// at this point you can set the elements of the neighborhood using the 
// operator[].  The data in an N-D neighborhood is stored in a 1D array, 
// organized as [][][][slice][row][col].  operator[] takes a 1D index into
// the array. You can use operator[] directly, or you can ask a Neighborhood

// to compute the 1D index from an offset to the center pixel of the 
// neighborhood.
ElementType::OffsetType offset;
offset[0] = 0;
offset[1] = -1;
element[ element.GetNeighborhoodIndex(offset) ] = 1; // set the pixel above
the center pixel



-----Original Message-----
From: Yann GAVET [mailto:yann.gavet at univ-st-etienne.fr]
Sent: Wednesday, April 21, 2004 9:01 AM
To: insight-users at itk.org
Subject: Re: [Insight-users] morphological openings by a segment


Thank you Luis.

Im sorry to ask again, I cannot find how to generate a structuring element.
I guess I should use a Neighborhood and set the pixels in my element to 
1, but I cant find any example and help on that.

Yann.

Luis Ibanez wrote:

> Hi Yann,
>
> It seems that you suggest to use several different
> structuring elements, each one associated with a
> particular direction.
>
> If this is the case, computing each openning and the
> making the union of them seems to be a reasonable
> way to go.  It won't necessarily be the fastest
> implementation, but at least will allow you to get
> a prof of concept.
>
>
>    Regards,
>
>
>        Luis
>
>
> -------------------
> Yann GAVET wrote:
>
>>    Hi all,
>>
>> I want to do perform the union of the openings by a segment of a 
>> given size in several directions (say 48 for example), and I wonder 
>> how to do it.
>>
>> I m thinking of creating all the segments, then computing the 
>> openings, and doing the binary union of the results.
>>
>> Do you think this is the best way to do it?
>>
>> regards.
>> yann
>
>
>
>
>