Replace "for [..] in [..]" by "for [..] to [..]" for consistency.
[master-thesis.git] / Parasitemia / ParasitemiaCore / Granulometry.fs
index b325534..004a25e 100644 (file)
@@ -1,6 +1,7 @@
 module ParasitemiaCore.Granulometry
 
 open System
+open System.IO
 open System.Drawing
 
 open Emgu.CV
@@ -24,24 +25,24 @@ let findRadiusByClosing (img: Image<Gray, 'TDepth>) (range: int * int) (scale: f
     let intensityImg = scaledImg.GetSum().Intensity
 
     // 's' must be odd.
-    let octagon (s: int) : Mat =
+    let octagon (s: int) : Matrix<byte> =
         if s % 2 = 0 then failwith "s must be odd"
         let m = new Matrix<byte>(Array2D.create s s 1uy)
         let r = (float s) / (Math.Sqrt 2. + 2.) |> roundInt
-        for i in 0 .. r - 1 do
-            for j in 0 .. r - 1 do
+        for i = 0 to r - 1 do
+            for j = 0 to r - 1 do
                 if i + j < r
                 then
                     m.[i, j] <- 0uy
                     m.[s - i - 1, j] <- 0uy
                     m.[i, s - j - 1] <- 0uy
                     m.[s - i - 1, s - j - 1] <- 0uy
-        m.Mat
+        m
 
     let mutable previous_n = Double.NaN
-    for r in r1' .. r2' do
+    for r = r1' to r2' do
         let se = if useOctagon
-                 then octagon (2 * r - 1) // It doesnd't speed up the process.
+                 then (octagon (2 * r - 1)).Mat // It doesn't speed up the process.
                  else CvInvoke.GetStructuringElement(CvEnum.ElementShape.Ellipse, Size(2 * r, 2 * r), Point(-1, -1))
 
         use closed = scaledImg.MorphologyEx(CvEnum.MorphOp.Close, se, Point(-1, -1), 1, CvEnum.BorderType.Replicate, MCvScalar(0.0))