Sep 23, 2023


Automatic Detection and Measure of Malignant Lesion in WSI.

Primaa lab

By : Adrien Nivaggioli (Primaa), Nicolas Pozin (Primaa), Marceau Clavel (Primaa), Marie Sockeel (Primaa), Sophie Mazellier (Medipath), Elisabeth Lanteri (Medipath), Marielle Figuccio (Medipath), Catherine Lefebvre (Medipath), Solène-Florence Kammerer-Jacquet (CHU de Rennes), Maxime Battistella (APHP Hôpital Saint Louis), Vincent Rouleau (Medipath) and Stéphane Sockeel (Primaa).


The most frequent malignant lesions in dermatopathology are either Basal-Cell Carcinoma (BCC), Squamous-Cell Carcinoma (SCC), or Melanoma. We propose a deep-learning based algorithm that automatically detects these skin lesions, measures them and computes relevant margins.

Figure 1. Detection and Measurements of a Lesion Red: Detected Malignant Lesion. Blue: Depth of Invasion. Dark Green: Diameter of the Lesion. Light Green: Epiderm. Purple: Deep Margin. Yellow: Deep Limit Orange: Lateral Margins.


We gathered and labeled 1795 Whole Slides Images containing both malignant, benign lesions, and healthy tissue. The annotations were performed by junior pathologists and then reviewed by expert pathologists.

From those annotations, we extracted patches of size 256×256 at zoom x20. Details can be found in Table 1.

Table 1. Dataset Details 


The test dataset includes 392 WSI with most frequent malignant lesions, and 500 WSI of healthy tissue or benign lesions. Results are presented in Table 2. Computed measures and margins are consistent with medical practice.

Table 2. Results Summary


We trained two classification models using a Deep Feature Learning [1] approach: one to detect the epiderm, and another to detect and classify malignant lesions. Both models operate on 256×256 patches at zoom x20.

At inference, for each WSI, we start by using a Canny Edge Detector to segment the different tissue pieces. The traditional OTSU thresholding algorithm could not be used, as it tends to miss the hypodermis, which is required to compute the deep margin.

Then, the tissue is decomposed into patches which are then classified. Masks for lesion and epiderm are deduced from those classifications. The epiderm mask is refined using a Gaussian Mixture Model, to remove the “blocky” aspect due to the patch-based approach.

Finally, using those three masks, we can calculate measures and margins for each tissue piece:

  • The Depth of Invasion is defined as the directed hausdorff distance between the lesion and the epiderm.
  • The Diameter of the lesion is the distance between the two furthest points of the lesion, while keeping a relative parallelism with the epiderm.
  • The Deep Margin is the distance between the two closest points on the deep limit and the lesion.

The Lateral Margins are the distance between the two closest points on the extremities of the epiderm and the lesion.


To our knowledge, we propose the first algorithm able to perform an automatic detection of skin malignant lesions in Whole Slide histopathological Images, while measuring depth and margins automatically. On-going developments should improve results further. Detection of benign lesions and classification of subtypes of malignant lesions are also being explored.

You can learn more on automatic detection of skin lesions by discovering our product, Cleo Skin.

[1] Nivaggioli A, Pozin N, et al (2023). Classification in Histopathology: A unique deep embeddings extractor for multiple classification tasks. Preprint.