Skin Cancer Detection

TDS-Algorithm (Total Dermoscopic Score)

\[\mathrm{TDS}=1.3\cdot A+0.1\cdot B+0.5\cdot C+0.5\cdot D\]

  • A: Integer value of the number of asymmetry features (0 is symmetric, 1 middle, 2 is asymmetric)
  • B: Integer value of the number of border irregularity features (0 to 8 indicating the presence of border irregularities in 8 regions)
  • C: Integer value indicating the presence of one to six specific colors (1 to 6)
  • D: Integer value indicating presence of one to five distinct structures or textures (1 to 5)
EvaluationTDS Score
Benign< 4.75
Suspicious4.75 to 5.45
Malignant> 5.45

Process

image

1. Preprocessing

  1. Grayscale
  2. Crop-in by a factor
  3. Apply a Gaussian blur (with sigma=5)

Output

image

2. Segmentation

  1. Using Otsu's method to turn the filtered grey-scale image into a binary image
  2. fill the holes in the image.
  3. Find the contours of the shape using cv2.findContours

Output

image

3. Feature Extraction

  1. Calculate the centroid and bounding box
  2. Calculate color score
    1. For each pixel within the lesion area, the euclidean distance from 6 RGB values is calculated
    2. For each color, the count is increased if the pixel is closest to it
    3. The end result is a vector of 6 values, each representing the count of pixels closest to the color, which will be divided by the total number of pixels
    4. For each color with a value greater than 0.01, a point is given to the TDS C score
    5. Calculate the variance of the RGB values: \[variance=\sigma^2=\frac{1}{n}\sum_{i=1}^{n}(x_i-\bar{x})^2\] where \(x_i\) is the RGB value of the pixel, \(\bar{x}\) is the mean of the RGB values \(\bar{x}=\frac{1}{n}\sum_{i=1}^n x_i\), and \(n\) is the number of pixels
  3. Calculate the asymmetry score
    1. The centroid is calculated
    2. For each degree out of 360 degrees, the radii in polar coordinates are calculated
    3. For each radii, the length of the symmetric radii is calculated and for pairs of which the difference of distances is less than 10%, a point is given
    4. The sum of points is the \(\mathrm{SFA}_i\) (Score For Axis) score.
    5. The radius with the maximum \(\mathrm{SFA}\) score is defined as the major axis of symmetry.
    6. The asymmetry score is calculated as follows:
EvaluationAsymmetry score
major axis \(\geq 140\) and minor axis \(\geq 140\)Symmetric across both axis ==> 0
major axis \(\geq 140\) and minor axis \(\lt 140\)symmetric across one axis ==> 1
major axis \(\lt 140\) and minor axis \(\lt 140\)asymmetric ==> 2