[Insight-users] Abnormal termination error with erotion filter!!!

salah salah at gris . uni-tuebingen . de
Fri, 30 May 2003 11:47:05 +0200


Hello all,

I am using the GrayscaleFunctionErodeImageFilter.=20
exactly as show in this piece of code
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D
//  this piece is in the header file of my class
   typedef itk::GrayscaleFunctionErodeImageFilter<InputImageType,
                                   ImageType, KernelType>   =
InputErotionFilterType;
   InputErotionFilterType::Pointer                         m_Eroder;=20

// in the constructor of my class=20
  m_Eroder =3D InputErotionFilterType::New();  =20
  =20
// in the erosion method of my class
   KernelType::SizeType ballSize;
   KernelType ball;                    // Structuring element
   ballSize[0] =3D rad;      ballSize[1] =3D rad;      ballSize[2] =3D =
rad;
   ball.SetRadius(ballSize);
   ball.CreateStructuringElement();

   m_Eroder->SetInput( m_InputImage );
   m_Eroder->SetKernel( ball );
   m_Eroder->Update();
   m_ErodedImage =3D m_Eroder->GetOutput();
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D

There is one instant of the erosion filter (m_Eroder) in my
appliation. It is created in the constractor of the base class
of my application. The erosion method is called by pressing
a button in the UI.

I have the following problem with this combination:

The erosion filter works fine when I call it for the first time.
It also works fine if I change the radius of the structuring
element and re-run the filter on the same image. Moreover,
it works fine if feed it with a new input image of the same=20
dimensions of the first image. BUT, if I feed it with an image
of some new different dimensions. The program exits with
an abnormal termination error message!!!!!

I tried to trace the program. It crashes exactly at the=20
m_Eroder->Update();
statement....

Did anybody have such a problem?? Could anybody please
guess what it could be??=20

I think the problem COULD be solved if there WERE some way
to "RESET" the instance of the filter, of cource without deleting
it or re-calling ::New();


Thanks a lot ,,,,

Zein


















->8<------------->8<------------->8<------------->8<------------->8<-----=
-------->8<-
Zein I. Salah=20
University of T=FCbingen, WSI-GRIS, Sand 14, 72076 T=FCbingen=20
Email: salah at gris . uni-tuebingen . de
Tel.: (07071) 29 75465 (GRIS),           Fax: (07071) 29 54 66