The goal of this paper is the presentation of a post-processing method allowing to remove impulse noise in binary images, while preserving thin structures. We use a grain filter as in [5]. We propose a method to automatically determine the required threshold using Galton-Watson processes. We present numerical results and a complete analysis on a synthetic image. We end the numerical section considering a specific application to granite samples crack detection: here we deal with X-tomography images that have been binarized via preprocessing techniques and we want to remove residual impulse noise while keeping cracks and micro-cracks structure.