[Insight-users] Create a Structuring Element from an image
Cyril Krykwinski
cyril.krykwinski at gmail.com
Mon Jun 29 13:16:02 EDT 2009
Dear insight-users,
I would like to create a 3D Binary Cross Structuring Element, with size =
3x3x1 (i.e. radius = 1x1x0)
1) I tried to define different radius with this code:
// typedef itk::BinaryCrossStructuringElement<unsigned char,3>
KernelType;
//
// KernelType cross;
// KernelType::RadiusType crossRadius;
// crossRadius[0] = 1;
// crossRadius[1] = 1;
// crossRadius[2] = 0;
// cross.CreateStructuringElement();
//
// typedef itk::BinaryDilateImageFilter < InputImageType ,
OutputImageType , KernelType > DilateFilterType;
// DilateFilterType::Pointer binaryDilate = DilateFilterType::New( );
// binaryDilate->SetInput ( inputImage -> GetOutput( ) );
// binaryDilate->SetKernel ( cross);
// binaryDilate->SetDilateValue ( 255 );
I tried also other radius, or to change the size with:
// KernelType::SizeType crossSize;
// crossSize[0] = 3;
// crossSize[1] = 3;
// crossSize[2] = 1;
but I always obtain a dilation with size = 3x3x3 (i.e. radius = 1x1x1)
2) I also tried to create my structuring element from an image (as it was
advised in a precedent message in this mailing list) which is an image 3x3x1
whom pixels are =1 for (x=1) OR (y=1)
imageKernal is the image 3x3x1 of my structuring element.
// typedef itk::FlatStructuringElement<3> SEType;
// SEType K;
// K = SEType::FromImage < InputImageType > ( imageKernel->GetOutput( )
);
// InputImageType ::Pointer kernelImage = K.GetImage < InputImageType >
( );
//
// binaryDilate->SetInput(unsignedCharImageContour->GetOutput());
// binaryDilate->SetKernel(kernelImage);
// binaryDilate->SetDilateValue( 255 );
but FromImage is not a member of itk::FlatStructuringElement.
So, is it possible to create our own 3D structuring element, directly in ITK
or from an image?
Any help will be greatly appreciated,
Best regards,
Cyril.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090629/d4bf968f/attachment.htm>
More information about the Insight-users
mailing list