[ITK] Strange behavior of morphological operations
Timothee Evain
tevain at telecom-paristech.fr
Mon Jun 29 11:08:01 EDT 2015
Hello everyone,
I was testing morphological operations when I stumbled on a strange behavior when you are using an asymmetrical structuring element.
For example :
itk::Neighborhood<float,3> SE4;
int SE4Radius=2;
SE4.SetRadius(SE4Radius);
for (int i = 0; i < SE4.GetSize()[0]*SE4.GetSize()[1]*SE4.GetSize()[2]; i++)
{
SE4[i]=0;
}
SE4[SE4.GetCenterNeighborhoodIndex()]=1;
for (int i = 1; i <= SE4Radius; i++)
{
itk::Neighborhood<float,3>::OffsetType SE4Off1={i,0,0};
itk::Neighborhood<float,3>::OffsetType SE4Off2={0,i,0};
itk::Neighborhood<float,3>::OffsetType SE4Off3={0,0,i};
SE4[SE4Off1]=1; SE4[SE4Off2]=1; SE4[SE4Off3]=1;
}
If you dilate with this element using the BinaryDilateImageFilter, your object will be dilated toward positive X, Y and Z dimensions, which is quite expected, but if you are using the BasicDilateImageFilter, the object will be dilated toward negative X, Y and Z dimensions which doesn't fit the intuition since we inputed a structuring element with ON "voxels" only on positive offsets.
I would say it is coming from its parent, the MorphologicalImageFilter, since a custom implemented filter deriving from it have the same strange behavior.
Is there a reason for this ?
Tim
More information about the Community
mailing list