[Insight-users] opening and closing

Marius Staring marius at isi.uu.nl
Wed Jun 7 13:42:37 EDT 2006


Hi,

there are bugs in the GrayscaleMorphologicalClosingImageFilter and 
GrayscaleMorphologicalOpeningImageFilter.

In the GenerateData() method of the closing the following typedefs

  /** set up erosion and dilation methods */
  typename GrayscaleDilateImageFilter<TInputImage, TOutputImage, 
TKernel>::Pointer
    dilate = GrayscaleDilateImageFilter<TInputImage, TOutputImage, 
TKernel>::New();

  typename GrayscaleErodeImageFilter<TInputImage, TOutputImage, 
TKernel>::Pointer
    erode = GrayscaleErodeImageFilter<TInputImage, TOutputImage, 
TKernel>::New();

should be

  /** set up erosion and dilation methods */
  typename GrayscaleDilateImageFilter<TInputImage, TOutputImage, 
TKernel>::Pointer
    dilate = GrayscaleDilateImageFilter<TInputImage, TOutputImage, 
TKernel>::New();

  typename GrayscaleErodeImageFilter<TInputImage, TOutputImage, 
TKernel>::Pointer
    erode = GrayscaleErodeImageFilter<TOutputImage, TOutputImage, 
TKernel>::New();

Something similar holds for the opening, but then the other way around.

Another thing: the opening and closing code are not really consistent 
with each other. The ReleaseDataFlagOn() is in the closing set for both 
the erosion and the dilation, but for the opening only for the dilation. 
Also the grafting is strange: for the closing we have:

    this->GraftOutput( erode->GetOutput() );

and for the opening

    this->GraftOutput( this->GetOutput() );

where I would expect

    this->GraftOutput( dilate->GetOutput() );

I don't really get the grafting, but the laws of comparing things tell 
me something could be wrong. Can someone clarify this?

Cheers,

-- 
Marius Staring
Image Sciences Institute
University Medical Centre Utrecht
Heidelberglaan 100, 3584 CX Utrecht, The Netherlands
phone: +31 (0)30 250 3186, fax: +31 (0)30 251 3399
marius at isi.uu.nl, http://www.isi.uu.nl/People/Marius



More information about the Insight-users mailing list