Support for IOS Matching Metric. Introduced the `mask_non_max_merge` function for handling non-maximum merging of masks