[Insight-users] modification of itkBinaryBallStructuringElement
Irene Gonzálvez García
irenegonzalvezg at gmail.com
Mon Apr 7 13:22:16 EDT 2008
Dear all,
I've successfully run a dilatation using a BallStructuringElement in
4D. Now, I am trying to modify the structuring element. What I would
like to create is an asymmetric BallStructuringElement. Making an
example with a 3x3 2D structuring element, i.e. in chapter 11 page 722,
iterators, I would like to make zero the pixels 0, 3 and 6. In the
itkBinaryBallStructuringElement.txx, I've modified part of the code:
// Iterate through the entire image and set interior pixels to 1
for(sfi.GoToBegin(); (!sfi.IsAtEnd()); ++sfi)
{
sfi.Set(NumericTraits<TPixel>::One);
}
//Set pixels 0,3 and 6 equal to 0
for(sfi.GoToBegin(); (!sfi.IsAtEnd()); ++sfi)
{
sfi.Set(NumericTraits<TPixel>::Zero);
++sfi; //I write this 2 lines because the operatos += is not
defined, so it isn't possible to write in the for definition sfi+=3;
++sfi;
}
Working in 2D, the pixels 0,3 and 6 should be equal to zero and the rest
equal to 1, but the result of the dilation is not the expected one, so I
think the problem is in this part of the code because the dilatation
algorithm works fine. Is it the correct way to set pixels equal to
zero?. Continuing with this example and for a 4D image I would like to
create a structuring element in 4D, making it symmetric for (X,Y,Z) and
asymmetric the temporal dimension (from the center to the left side
equal to zero and from the center to the right equal to 1(including the
center)). How can I identify pixels in 4D?
Best regards and thank you for your help
Irene
More information about the Insight-users
mailing list