* Add an exact method to compute an ellipse from three points and two tangents.
[master-thesis.git] / Parasitemia / Parasitemia / ParasitesMarker.fs
index fcb71da..671755c 100644 (file)
@@ -12,7 +12,6 @@ type Result = {
     infection: Image<Gray, byte>
     stain: Image<Gray, byte> }
 
-
 // Create three binary markers :
 // * 'Dark stain' corresponds to the colored pixel, it's independent of the size of the areas.
 // * 'Stain' corresponds to the stain around the parasites.
@@ -44,17 +43,16 @@ let findMa (green: Image<Gray, float32>) (filteredGreen: Image<Gray, float32>) (
     tmp,
     tmp
 
-
 // Create three binary markers :
 // * 'Dark stain' corresponds to the colored pixel, it's independent of the size of the areas.
 // * 'Stain' corresponds to the stain around the parasites.
 // * 'Infection' corresponds to the parasite. It shouldn't contain thrombocytes.
 let find (filteredGreen: Image<Gray, float32>) (config: Config.Config) : Result * Image<Gray, float32> =
     use filteredGreenWithoutInfection = filteredGreen.Copy()
-    ImgTools.areaCloseF filteredGreenWithoutInfection (int config.InfectionArea)
+    ImgTools.areaCloseF filteredGreenWithoutInfection (int config.RBCRadius.InfectionArea)
 
     let filteredGreenWithoutStain = filteredGreenWithoutInfection.Copy()
-    ImgTools.areaCloseF filteredGreenWithoutStain (int config.StainArea)
+    ImgTools.areaCloseF filteredGreenWithoutStain (int config.RBCRadius.StainArea)
 
     let darkStain =
         // We use the filtered image to find the dark stain.
@@ -70,13 +68,15 @@ let find (filteredGreen: Image<Gray, float32>) (config: Config.Config) : Result
         diff._ThresholdBinary(Gray(0.0), Gray(255.))
         diff.Convert<Gray, byte>()
 
-    let infectionMarker = marker filteredGreen filteredGreenWithoutInfection config.Parameters.infectionLevel
-    let stainMarker = marker filteredGreenWithoutInfection filteredGreenWithoutStain config.Parameters.stainLevel
+    let infectionMarker = marker filteredGreen filteredGreenWithoutInfection (1. / config.Parameters.infectionSensitivity)
+    let stainMarker = marker filteredGreenWithoutInfection filteredGreenWithoutStain (1. / config.Parameters.stainSensitivity)
 
     // TODO: comprendre pourquoi des valeurs sont negatives!?!?
+    (*
     let blackTopHat = filteredGreen.CopyBlank()
     CvInvoke.Subtract(filteredGreenWithoutInfection, filteredGreen, blackTopHat)
     ImgTools.saveImg (ImgTools.normalizeAndConvert blackTopHat) "BottomHat.png"
+    *)
 
     { darkStain = darkStain
       infection = infectionMarker