Glands segmentation is a very important and yet challenging problem of histological images analysis. Accurate segmentation of mucous glands is a crucial step to obtain reliable morphological statistics and is necessary for the development of high-quality diagnostic algorithms, which are an integral part of timely medical care. In this paper we propose a two-stage segmentation method, which predicts the probability maps of glands boundaries in histological images based on a priori knowledge about the geometric shape of the mucous glands and uses a convolutional neural network (CNN) model to get the final segmentation result based on the predicted probability maps. The proposed method demonstrates good results in separating adjacent glands, which is one of the most challenging aspects in automatic segmentation of histological glands and one of the most complicated for algorithms based on applying convolutional neural networks. The evaluation of the proposed algorithm was performed with Warwick-QU dataset, which contains real histological images of colon tissue.