[Insight-users] binary erosion
mauro maiorca
mauromaiorca at gmail.com
Fri Nov 23 08:15:48 EST 2007
Hi people,
I'm trying to perform erosion with itk, but unfortunately without any
luck. The strange thing is that there isn't any problem with dilation.
starting from a volume (here a slice from the volume, the inside has
value 0, and the structure I'm interested in has value 255)
http://traversata.altervista.org/facial_segmented_28_starting.jpg
(or, if you like more png:
http://traversata.altervista.org/facial_segmented_28_starting.png )
unfortunately the result that I obtain is:
http://traversata.altervista.org/facial_segmented028.jpg
with mainly the colour reversed, and some changes far from the center
of the image. I'm using itk 3.2.0
Any help/suggestion would be appreciated!
cheers,
Mauro
The portion of code interested is:
typedef itk::Image<PixelType, 3> outputImageType;
typedef itk::BinaryBallStructuringElement< PixelType, 3 >
StructuringElementType;
typedef itk::BinaryErodeImageFilter< outputImageType, outputImageType,
StructuringElementType > ErodeFilterType;
ErodeFilterType::Pointer binaryErode = ErodeFilterType::New();
StructuringElementType ball;
StructuringElementType::SizeType ballSize;
ballSize[0] = 6;
ballSize[1] = 6;
ballSize[2] = 1; //I also tried with other combinations of ballSize,
but with the same results
ball.SetRadius(ballSize);
ball.CreateStructuringElement();
binaryErode->SetInput( confidence->GetOutput() );
/*confidence->GetOutput() is the image
http://traversata.altervista.org/facial_segmented_28_starting.jpg*/
binaryErode->SetKernel( ball );
binaryErode->SetErodeValue( 255 );
binaryErode->Update();
facial_SegmentedPtr = binaryErode->GetOutput();
/*binaryErode->GetOutput() is the image
http://traversata.altervista.org/facial_segmented028.jpg*/
More information about the Insight-users
mailing list