Binary closing slower than grayscale closing

Hi,

Context : I have a binary input image of type itk::Image<unsigned char, 2> (the image is a 512x512 pixels) and I am applying a closing filter on it using a itk::FlatStructuringElement<2>. The type of the structuring element is a ball with a radius of 5 pixels. I am using c++ with Visual Studio, the code and the itk libraries are both compiled in release (itk version 5.1).

Question #1: for the exact same input image, if I use a itk::BinaryMorphologicalClosingImageFilter, it takes more time to run than using a itk::GrayscaleMorphologicalClosingImageFilter and I don’t understand why.

Question #2: I would like to get a better understanding of the Update() function and I couldn’t find its implementation. I know that it is used at the end of the pipeline to apply all the previously set operations/filters but I can’t find what it really does. Can someone help me find my way in the documentation for the Update() function?

Note - For both filters, I only set the input image, set the kernel and call the Update() method as follows :

    closingFilter->SetInput(itkImg);
    closingFilter->SetKernel(structuringElement);
    closingFilter->Update();

Thank you for the help,
Côme

Update() method is the tip of the pipeline iceberg. Some explanatory materials:
Documentation
Lecture slides
ITK example

2 Likes

You can also use debugger’s step into function to trace the execution inside the pipeline update call.