Discrete mereotopology (DM) is a first-order spatial logic that fuses together mereology (the theory of parthood relations) and topology to model discrete space. We show how a set of quasitopological functions defined within DM can be mapped to specific operators defined in mathematical morphology (MM) and easily implemented in scientific image processing programs. These functions provide the means to model topological properties of individual regions and spatial relations between them such as contact, overlap, and the relation of part to whole. DM not only extends the expressive power of image processing applications where mathematical morphology is used, but by functioning as a logic it also supplies the formal basis with which to prove the correctness of implemented algorithms as well as providing the computational basis to mechanically reason about segmented digital images using automated reasoning programs. In particular, we show how DM can supply a model-based and algorithmic context to the otherwise blind pixel-based image processing routines still dominating conventional imaging approaches. A number of worked examples drawn from the histological domain are given, including segmentation of cells in culture, identifying basal cell layers from stratified epithelia sections, and cell sorting in blood smears.