Debug: modified mask erosion for compatibility between functional and diffusion pipelines