[Insight-users] problem with dilate and erode filter

Luis Ibanez luis.ibanez at kitware.com
Wed May 26 12:52:16 EDT 2010


Hi Chia-Hsiang,

The likely source of the problem are the lines

> dilateFilter->SetDilateValue(1);

> erodeFilter->SetErodeValue( 1);


Are you certain that your input image has pixel
values set to "0" and "1"  ?

because it is common to use "0" and "255" in order
to represent binary images....


In your case, the Erosion and Dilation filters are
only going to change pixels (and their neighbors)
whose values are set to "1".



    Regards,


         Luis


------------------------------------
On Sat, May 8, 2010 at 11:22 PM, m0985501 <m0985501 at mail.nuk.edu.tw> wrote:
> Hello all
>
> i am a beginner in itk. Here's a newbie question that troubles me. Hope somebody could help me.
>
> After processing with dilate filter and erode filter. the result looks same as the original one, nothing changes at all.
>
> BUT if i write the output of dilate filter, and then read again to erode filter. it works.
>
> my code is like this.
>
> ImageType3D::Pointer inputSeries= reader->GetOutput();
>
> KernelType  ball;
> ball.SetRadius( 30);
> ball.CreateStructuringElement();
>
> BinaryDilateFilterType::Pointer dilateFilter= BinaryDilateFilterType::New();
> dilateFilter->SetInput( mask);
> dilateFilter->SetKernel( ball);
> dilateFilter->SetDilateValue(1);
>
> BinaryErodeFilterType::Pointer erodeFilter= BinaryErodeFilterType::New();
> erodeFilter->SetInput( dilateFilter->GetOutput());
> erodeFilter->SetKernel( ball2);
> erodeFilter->SetErodeValue( 1);
> erodeFilter->Update();
>
> return erodeFilter->GetOutput();
> then write the image to disk
>
> It also occured with grayscale ones. The filters seems do nothing, but still time consuming.
> i tried with itk 3.14, 3.16 and 3.18, and compiled with vc 6, 7, 8, 9.
>
> Could anyone help me please.
> thank you
>
>
>
> Chia-Hsiang Hu
> Machine Learning and Medical Application Lab
> Dept. of Computer Science and Information Engineering
> National University of Kauhsiung
> (e) m0985501_AT_mail_DOT_nuk_DOT_edu_DOT_tw
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>


More information about the Insight-users mailing list