1
module ParasitemiaUI.Types
5 open System.Windows.Media
12 open ParasitemiaCore.UnitsOfMeasure
14 let healthyRBColor = Color.FromRgb(255uy, 255uy, 0uy) // Yellow-green.
15 let infectedRBColor = Color.FromRgb(255uy, 0uy, 40uy) // Red with a bit of blue.
22 mutable infected : bool
25 mutable setManually : bool
37 mutable config : ParasitemiaCore.Config.Config
38 mutable dateLastAnalysis : DateTime // UTC.
39 img
: Image<Bgr, byte
>
40 mutable rbcs : RBC list
42 mutable healthyRBCBrightness : float32
43 mutable infectedRBCBrightness : float32
46 member this
.HealthyRBCColor : SolidColorBrush =
47 let mutable color = healthyRBColor * this
.healthyRBCBrightness
49 SolidColorBrush(color)
51 member this
.InfectedRBCColor : SolidColorBrush =
52 let mutable color = infectedRBColor * this
.infectedRBCBrightness
54 SolidColorBrush(color)
62 override this.ToString() =
63 sprintf
"%s: %d" this.label
this.ppi
72 override this.ToString () =
73 sprintf
"%g mm × %g mm%s" this.w
this.h
(if this.label
= "" then "" else " (" + this.label
+ ")")
75 let defaultPredefinedPPI =
77 { ppi
= 230000<ppi
>; label
= "50×" }
78 { ppi
= 460000<ppi
>; label
= "100×" }
81 let defaultSensorSizes =
83 { w
= 3.2<mm
>; h
= 2.4<mm
>; label
= "1/4″" }
84 { w
= 4.8<mm
>; h
= 3.6<mm
>; label
= "1/3″" }
85 { w
= 5.76<mm
>; h
= 4.29<mm
>; label
= "1/2.5″" }
86 { w
= 6.4<mm
>; h
= 4.8<mm
>; label
= "1/2″" }
87 { w
= 7.18<mm
>; h
= 5.32<mm
>; label
= "1/1.8″" }
88 { w
= 7.6<mm
>; h
= 5.7<mm
>; label
= "1/1.7″" }
89 { w
= 8.8<mm
>; h
= 6.6<mm
>; label
= "2/3″" }
90 { w
= 13.2<mm
>; h
= 8.8<mm
>; label
= "1″" }