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
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
+ elements.[y - minY, x - minX] <- 1uy
nbElement <- nbElement + 1
nbElement <- nbElement + 1
- let infected = infection.Data.[y, x, 0] > 0uy
- let stain = parasites.cytoplasm.Data.[y, x, 0] > 0uy
- let darkStain = parasites.darkStain.Data.[y, x, 0] > 0uy
-
- if infected
+ if nucleusData.[y, x, 0] > 0uy
then
then
- infectedPixels.Add(Point(x, y))
+ nucleusPixels.Add(Point(x, y))
- if stain
+ if parasiteData.[y, x, 0] > 0uy
then
then
- cytoplasmPixels.Add(Point(x, y))
+ parasitePixels.Add(Point(x, y))
- if darkStain
+ if darkStainData.[y, x, 0] > 0uy
then
darkStainPixels <- darkStainPixels + 1
then
darkStainPixels <- darkStainPixels + 1
- let mutable cytoplasmArea = 0
- if infectedPixels.Count > 0
+ let mutable parasiteArea = 0
+ if nucleusPixels.Count > 0
then
then
- for cytoplasmPixel in cytoplasmPixels do
- if infectedPixels.Exists(fun p -> pown (p.X - cytoplasmPixel.X) 2 + pown (p.Y - cytoplasmPixel.Y) 2 <= perimeterParasiteSquared)
+ for parasitePixel in parasitePixels do
+ if nucleusPixels.Exists(fun p -> pown (p.X - parasitePixel.X) 2 + pown (p.Y - parasitePixel.Y) 2 <= perimeterParasiteSquared)
then
then
- cytoplasmArea <- cytoplasmArea + 1
+ parasiteArea <- parasiteArea + 1
let cellClass =
if float darkStainPixels > config.Parameters.maxDarkStainRatio * (float nbElement)
let cellClass =
if float darkStainPixels > config.Parameters.maxDarkStainRatio * (float nbElement)
- averageColor_BG: float32 * float32 * float32 // R * G * B.
- averageColor_RBC: float32 * float32 * float32 // R * G * B.
- averageColor_Parasite: float32 * float32 * float32 // R * G * B.
-
ratioAreaPaleCenter: float32 // The area of the second opening is 'ratioSecondAreaOpen' * mean RBC area. It's applied only if greater than 'initialAreaOpen'.
granulometryRange: float32 // The radius will be seeked from radius - granulometryRange * radius to radius + granulometryRange * radius.
ratioAreaPaleCenter: float32 // The area of the second opening is 'ratioSecondAreaOpen' * mean RBC area. It's applied only if greater than 'initialAreaOpen'.
granulometryRange: float32 // The radius will be seeked from radius - granulometryRange * radius to radius + granulometryRange * radius.
infectionSensitivity: float // between 0 (the least sensitive) and 1 (the most sensitive).
standardDeviationMaxRatio: float // The standard deviation of the pixel values of a cell can't be greater than standardDeviationMaxRatio * global standard deviation
infectionSensitivity: float // between 0 (the least sensitive) and 1 (the most sensitive).
standardDeviationMaxRatio: float // The standard deviation of the pixel values of a cell can't be greater than standardDeviationMaxRatio * global standard deviation
- minimumCellAreaFactor: float32 // Factor of the mean RBC area. A cell with an area below this will be rejected.
-}
+ minimumCellAreaFactor: float32 } // Factor of the mean RBC area. A cell with an area below this will be rejected.
let defaultParameters = {
rbcDiameter = 8.<μm>
resolution = 220.e3<ppi> // 220.e3<ppi> Correspond to 50X.
let defaultParameters = {
rbcDiameter = 8.<μm>
resolution = 220.e3<ppi> // 220.e3<ppi> Correspond to 50X.
- averageColor_BG = 113.3f, 135.3f, 150.3f
- averageColor_RBC = 94.7f, 80.7f, 99.3f
- averageColor_Parasite = 76.f, 58.f, 94.f
-
- (*averageColor_BG = 179.f, 148.f, 121.f
- averageColor_RBC = 141.f, 96.f, 83.f
- averageColor_Parasite = 123.f, 89.f, 83.f*)
-
ratioAreaPaleCenter = 2.f / 5.f // The ratio between an RBC area and the area of the its pale center.
granulometryRange = 0.5f
ratioAreaPaleCenter = 2.f / 5.f // The ratio between an RBC area and the area of the its pale center.
let initialAreaOpening = int <| config.RBCRadiusByResolution.Area * config.Parameters.ratioAreaPaleCenter * 1.1f // We do an area opening a little larger to avoid to do a second one in the case the radius found is near the initial one.
let initialAreaOpening = int <| config.RBCRadiusByResolution.Area * config.Parameters.ratioAreaPaleCenter * 1.1f // We do an area opening a little larger to avoid to do a second one in the case the radius found is near the initial one.
darkStain: Image<Gray, byte> // Colored pixel, it's independent of the size of the areas. It corresponds to white cells, schizontes, gametocytes, throphozoites.
nucleus: Image<Gray, byte> // Parasite nucleus. It may contain some debris. It shouldn't contain thrombocytes or larger elements.
type Result = {
darkStain: Image<Gray, byte> // Colored pixel, it's independent of the size of the areas. It corresponds to white cells, schizontes, gametocytes, throphozoites.
nucleus: Image<Gray, byte> // Parasite nucleus. It may contain some debris. It shouldn't contain thrombocytes or larger elements.