Use of roman number to identify images.
[master-thesis.git] / Parasitemia / ParasitemiaUI / SourceImage.fs
index 2330227..7b3de18 100644 (file)
@@ -25,16 +25,19 @@ type SourceImage (num : int, name : string, config : ParasitemiaCore.Config.Conf
     let infectedRBColor = Color.FromRgb (255uy, 0uy, 40uy) // Red with a bit of blue.
 
     let updateAverageRBCSize () =
-        averageRBCSize <-
-            rbcs
-            |> List.collect (fun rbc -> [ rbc.size.Width; rbc.size.Height ])
-            |> List.average
+        if List.isEmpty rbcs |> not then
+            averageRBCSize <-
+                rbcs
+                |> List.collect (fun rbc -> [ rbc.size.Width; rbc.size.Height ])
+                |> List.average
 
     do
         updateAverageRBCSize ()
 
     member this.Num with get () = num and set value = num <- value
 
+    member this.RomanNum = Utils.toRomanNumber this.Num
+
     member this.Name with get () = name and set value = name <- value
 
     member this.Config = config
@@ -45,7 +48,9 @@ type SourceImage (num : int, name : string, config : ParasitemiaCore.Config.Conf
 
     member this.RBCs
         with get () = rbcs
-        and set value = rbcs <- value
+        and set value =
+            rbcs <- value
+            updateAverageRBCSize ()
 
     member this.ImageParasitemia : int * int =
         List.length rbcs,