- for y in (if minY < 0 then 0 else minY) .. (if maxY >= h then h - 1 else maxY) do
- for x in (if minX < 0 then 0 else minX) .. (if maxX >= w then w - 1 else maxX) do
+ for y in (if minY < 0 then 0 else minY) .. (if maxY >= height then height - 1 else maxY) do
+ for x in (if minX < 0 then 0 else minX) .. (if maxX >= width then width - 1 else 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
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)))
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 <= diameterParasiteSquared)
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)