Implemented morphological filter.