[Insight-users] Compile fails for BinaryMorphologicalOpeningImageFilter

Denis Shamonin dshamoni at gmail.com
Wed Oct 20 05:02:37 EDT 2010


Dear all,

The BinaryMorphologicalOpeningImageFilter class fails to compile for
different input/output image types.

typedef itk::Image<_TDataTypeIn, Dimension> InputImage;
typedef itk::Image<_TDataTypeOut, Dimension> OutputImage;
typedef itk::BinaryMorphologicalOpeningImageFilter<InputImage,
OutputImage, KernelType>

The reason is that inside BinaryMorphologicalOpeningImageFilter::GenerateData()
dilate filter templated over TInputImage.
dilate = BinaryDilateImageFilter< TInputImage, TInputImage, TKernel >::New();

While erode templated over TInputImage, TOutputImage
erode = BinaryErodeImageFilter< TInputImage, TOutputImage, TKernel >::New();

And later erode is used as input for dilate.

dilate->SetInput( erode->GetOutput() ); // COMPILE FAIL!

I think you have to change it to:
dilate = BinaryDilateImageFilter< TInputImage, TOutputImage, TKernel >::New();

Same goes for BinaryMorphologicalClosingImageFilter, although it is
compiling fine.

Please fix it, Thanks.

Denis Shamonin, MSc
Division of Image Processing (LKEB)
Department of Radiology
Leiden University Medical Center
PO Box 9600, 2300 RC Leiden, The Netherlands


More information about the Insight-users mailing list