Save predefined PPI and sensor sizes in JSON files.
[master-thesis.git] / Parasitemia / ParasitemiaUI / Types.fs
index e29465c..fa99d90 100644 (file)
@@ -9,6 +9,8 @@ open Emgu.CV.Structure
 
 open Newtonsoft.Json
 
+open ParasitemiaCore.UnitsOfMeasure
+
 let healthyRBColor = Color.FromRgb(255uy, 255uy, 0uy) // Yellow-green.
 let infectedRBColor = Color.FromRgb(255uy, 0uy, 40uy) // Red with a bit of blue.
 
@@ -45,4 +47,33 @@ type SourceImage = {
     member this.InfectedRBCColor: SolidColorBrush =
         let mutable color = infectedRBColor * this.infectedRBCBrightness
         color.A <- 255uy;
-        SolidColorBrush(color)
\ No newline at end of file
+        SolidColorBrush(color)
+
+type PredefinedPPI = {
+    ppi: int<ppi>
+    label: string } with
+    override this.ToString() =
+        sprintf "%s: %d" this.label this.ppi
+
+type SensorSize = {
+    w: float<mm>
+    h: float<mm>
+    label: string } with
+    override this.ToString () =
+        sprintf "%g mm × %g mm%s" this.w this.h (if this.label = "" then "" else " (" + this.label + ")")
+
+let defaultPredefinedPPI = [
+    { ppi = 230000<ppi>; label = "50×" }
+    { ppi = 460000<ppi>; label = "100×" } ]
+
+let defaultSensorSizes = [
+    { w = 3.2<mm>;  h = 2.4<mm>;  label = "1/4″" }
+    { w = 4.8<mm>;  h = 3.6<mm>;  label = "1/3″" }
+    { w = 5.76<mm>; h = 4.29<mm>; label = "1/2.5″" }
+    { w = 6.4<mm>;  h = 4.8<mm>;  label = "1/2″" }
+    { w = 7.18<mm>; h = 5.32<mm>; label = "1/1.8″" }
+    { w = 7.6<mm>;  h = 5.7<mm>;  label = "1/1.7″" }
+    { w = 8.8<mm>;  h = 6.6<mm>;  label = "2/3″" }
+    { w = 13.2<mm>; h = 8.8<mm>;  label = "1″" } ]
+
+