This paper contains a systematic analysis of a natural measure theoretic notion of connectedness for sets of finite perimeter in ÂN, introduced by H. Federer in the more general framework of the theory of currents. We provide a new and simpler proof of the existence and uniqueness of the decomposition into the so-called M-connected components. Moreover, we study carefully the structure of the essential boundary of these components and give in particular a reconstruction formula of a set of finite perimeter from the family of the boundaries of its components. In the two dimensional case we show that this notion of connectedness is comparable with the topological one, modulo the choice of a suitable representative in the equivalence class. Our strong motivation for this study is a mathematical justification of all those operations in image processing that involve connectedness and boundaries. As an application, we use this weak notion of connectedness to provide a rigorous mathematical basis to a large class of denoising filters acting on connected components of level sets. We introduce a natural domain for these filters, the space WBV(Q) of functions of weakly bounded variation in Q, and show that these filters are also well behaved in the classical Sobolev and BV spaces.