[Insight-users] Re: [vtkusers] Binary Closing (and Dilate+Erode) have no effect

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Thu Sep 6 08:49:06 EDT 2007


Hi,

You should use the itk mailing list if you need some help with itk!

Your code below seem to be correct - perhaps the problem is not in  
that part. Just a small thing: the slice by slice filter is not  
required. If you want to perform a 2D dilation in all the slice of a  
3D images, you can simply use a structuring element with a radius 0  
on one dimension.

Can you post a full example with a test image, so we can try to help  
much ?

Thanks,

Gaëtan




Le 5 sept. 07 à 15:48, snrf at no-log.org a écrit :

> Dear all:
>
> For the last day I've been struggling to have a simple binary  
> closing to
> work:
> I tried the binarymorphologicalclosing add-on extensions and a manual
> Dilate + Erode approach (codes are below). Still, I do not have  
> anything
> on the output , the image is still like the one I input.
>
> Any help, suggestions are appreciated.
>
> Flo.
>
> binarymorphologicalclosing
> ---------------------------
>
> typedef itk::BinaryBallStructuringElement< PixelType2, Dimension2>
> KernelType;
> KernelType ball;
> KernelType::SizeType ballSize;
> ballSize.Fill( BallValue );
> ball.SetRadius(ballSize);
> ball.CreateStructuringElement();
>
> typedef itk::SliceBySliceImageFilter< ImageType, ImageType >  
> FilterType;
> FilterType::Pointer filter = FilterType::New();
>
> typedef itk::BinaryMorphologicalClosingImageFilter<
> FilterType::InternalInputImageType,
> FilterType::InternalOutputImageType, KernelType > Filter;
> Filter::Pointer fil = Filter::New();
>
> fil->SetKernel( ball );
> fil->SetSafeBorder( true );
> filter->SetInput( caster->GetOutput() );
> filter->SetFilter( fil );
>
> Dilate + Erode:
> ---------------
>
> typedef itk::BinaryBallStructuringElement < PixelType, Dimension>  
> KernelType;
> KernelType ball;
> KernelType::SizeType ballSize;
>  ballSize.Fill( BallValue );
>  ball.SetRadius(ballSize);
>  ball.CreateStructuringElement();
>
> typedef itk::BinaryErodeImageFilter<BinaryImageType3,
> BinaryImageType3,KernelType >  ErodeFilterType;
> typedef itk::BinaryDilateImageFilter<ImageType, BinaryImageType3,
> KernelType >  DilateFilterType;
>
> ErodeFilterType::Pointer  binaryErode  = ErodeFilterType::New();
> DilateFilterType::Pointer binaryDilate = DilateFilterType::New();
>
> binaryDilate->SetKernel( ball );
> binaryErode->SetKernel(  ball );
> binaryDilate->SetInput( caster->GetOutput() );
> binaryErode->SetInput( binaryDilate->GetOutput() );
>
> PixelType background =   0;
> PixelType foreground = 100;
> binaryDilate->SetDilateValue( foreground );
> binaryErode->SetErodeValue( foreground );
> binaryErode->SetBoundaryToForeground(true);
>
> binaryDilate->Update();
> binaryErode->Update();
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/ 
> Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers

--
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr



-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: =?ISO-8859-1?Q?Ceci_est_une_signature_=E9lectronique_PGP?=
Url : http://public.kitware.com/pipermail/insight-users/attachments/20070906/6cabb9b6/PGP-0001.pgp


More information about the Insight-users mailing list