% In the recent era, deep convolutional networks (CNNs) have registered a serious breakthrough in medical image segmentation. Still, some anatomically aberrant segmentations may be observed, with holes or inaccuracies near the object boundaries, in cases of irregular shapes, lack of contrast, or noise.
% Current research trends for medical image segmentation via deep learning have investigated incorporating constraints,  such as spatial information or prior knowledge, in the loss function in order to avoid this artefact. One particularly important branch of prior losses is the contour-based losses which exploit distance maps inorder to conducts point-by-point optimization between ground-truth and predicted contours. Despite their significance, such losses may be complex in nature or computationally expensive. As a result, they are often susceptible to local solutions and vanishing gradient problems. The problem becomes more challenging given organs with non-convex shapes or border irregularities. This work proposes a novel loss constrain that optimizes the length or perimeter of the segmented object relative to the ground truth segmentation. The originality is to compute the object perimeter thanks to a soft approximation of the contour of the probability map as the difference between dilation and erosion of predicted segmentations carried out via min,max-pooling layers and ReLu operations. Moreover, instead of point-by-point minimization, the mean squared error between the sums of the over all ground-truth vs. predicted contours is optimized. This soft optimization of contour boundaries allows the network to take into consideration border irregularities within organs while still being efficient and fast. To validate the performance of the proposed loss, experiments are conducted on three public datasets (the spleen and hippocampus datasets  from the Decathlon challenge and the ACDC dataset, a cardiac cine-MR dataset dedicated to segmentation of three cardiac structures). Results show that the proposed method outperforms state-of-the-art boundary losses for both single and multi-organ segmentation.