Add a status bar.
[master-thesis.git] / Parasitemia / ParasitemiaUI / State.fs
index 5b89810..f133640 100644 (file)
@@ -30,6 +30,10 @@ type State () =
         List.length srcImg.rbcs,
         srcImg.rbcs |> List.fold (fun nbInfected rbc -> if rbc.infected then nbInfected + 1 else nbInfected) 0
 
+    member this.ImageNbAltered (srcImg: SourceImage) : int * int =
+        List.length srcImg.rbcs,
+        srcImg.rbcs |> List.fold (fun nbAltered rbc -> if rbc.setManually then nbAltered + 1 else nbAltered) 0
+
     member this.GlobalParasitemia : int * int =
         sourceImages
         |> Seq.fold (fun (nbTotal, nbTotalInfected) srcImg ->
@@ -56,16 +60,18 @@ type State () =
     /// <summary>
     /// Load the current state. 'FilePath' must have been defined.
     /// </summary>
-    /// <exception cref="System.IOException">If the file cannot be laoded</exception>
+    /// <exception cref="System.IOException">If the file cannot be loaded</exception>
     member this.Load () =
         let data = PiaZ.load this.FilePath
         this.PatientID <- data.patientID
         sourceImages.Clear()
         sourceImages.InsertRange(0, data.images)
-        if sourceImages.Count > 0
-        then this.CurrentImage <- Some sourceImages.[0]
+        this.CurrentImage <- if sourceImages.Count > 0 then Some sourceImages.[0] else None
         alteredSinceLastSave <- false
 
+    /// <summary>
+    /// </summary>
+    /// <exception cref="System.IOException">If the image cannot be read</exception>
     member this.AddSourceImage (filePath: string) (defaultConfig: ParasitemiaCore.Config.Config) : SourceImage =
         let srcImg = { num = sourceImages.Count + 1; config = defaultConfig.Copy(); dateLastAnalysis = DateTime(0L); rbcs = []; img = new Image<Bgr, byte>(filePath) }
         sourceImages.Add(srcImg)