- let nucleusPixels = List<Point>()
- let parasitePixels = List<Point>()
-
- let mutable darkStainPixels = 0
- let mutable nbElement = 0
-
- let elements = new Matrix<byte>(maxY - minY + 1, maxX - minX + 1)
- for y in minY .. maxY do
- for x in minX .. maxX do
- let p = PointF(float32 x, float32 y)
- if pixelOwnedByE p e (neighbors |> List.choose (fun (otherE, p1, p2) -> if otherE.Removed then None else Some (otherE :> Ellipse, Utils.lineFromTwoPoints p1 p2)))
- then
- elements.[y - minY, x - minX] <- 1uy
- nbElement <- nbElement + 1
-
- if nucleusData.[y, x, 0] > 0uy
- then
- nucleusPixels.Add(Point(x, y))
-
- if parasiteData.[y, x, 0] > 0uy
- then
- parasitePixels.Add(Point(x, y))
-
- if darkStainData.[y, x, 0] > 0uy
- then
- darkStainPixels <- darkStainPixels + 1
-
- let mutable parasiteArea = 0
- if nucleusPixels.Count > 0
- then
- for parasitePixel in parasitePixels do
- if nucleusPixels.Exists(fun p -> pown (p.X - parasitePixel.X) 2 + pown (p.Y - parasitePixel.Y) 2 <= diameterParasiteSquared)
- then
- parasiteArea <- parasiteArea + 1
-
- let cellClass =
- if float darkStainPixels > config.Parameters.maxDarkStainRatio * (float nbElement)
- then
- Peculiar
-
- elif nucleusPixels.Count > 0 && parasiteArea >= minimumParasiteArea
- then
- let infectionToRemove = Morpho.connectedComponents parasites.parasite nucleusPixels
- for p in infectionToRemove do
- nucleusData.[p.Y, p.X, 0] <- 0uy
- InfectedRBC