Merge branch 'master' of gburri.org:master-thesis
[master-thesis.git] / Parasitemia / ParasitemiaUI / Types.fs
1 module ParasitemiaUI.Types
2
3 open System
4 open System.Windows
5 open System.Windows.Media
6
7 open Emgu.CV
8 open Emgu.CV.Structure
9
10 open Newtonsoft.Json
11
12 open ParasitemiaCore.UnitsOfMeasure
13
14 type RBC =
15 {
16 num : int
17
18 [<JsonIgnore>]
19 mutable infected : bool
20
21 [<JsonIgnore>]
22 mutable setManually : bool
23
24 center : Point
25 size : Size
26 infectedArea : int
27 }
28
29 type PredefinedPPI =
30 {
31 ppi : int<ppi>
32 label : string
33 }
34 with
35 override this.ToString () =
36 sprintf "%s: %d" this.label this.ppi
37
38 type SensorSize =
39 {
40 w : float<mm>
41 h : float<mm>
42 label : string
43 }
44 with
45 override this.ToString () =
46 sprintf "%g mm × %g mm%s" this.w this.h (if this.label = "" then "" else " (" + this.label + ")")
47
48 let defaultPredefinedPPI =
49 [
50 { ppi = 230000<ppi>; label = "50×" }
51 { ppi = 460000<ppi>; label = "100×" }
52 ]
53
54 let defaultSensorSizes =
55 [
56 { w = 3.2<mm>; h = 2.4<mm>; label = "1/4″" }
57 { w = 4.8<mm>; h = 3.6<mm>; label = "1/3″" }
58 { w = 5.76<mm>; h = 4.29<mm>; label = "1/2.5″" }
59 { w = 6.4<mm>; h = 4.8<mm>; label = "1/2″" }
60 { w = 7.18<mm>; h = 5.32<mm>; label = "1/1.8″" }
61 { w = 7.6<mm>; h = 5.7<mm>; label = "1/1.7″" }
62 { w = 8.8<mm>; h = 6.6<mm>; label = "2/3″" }
63 { w = 13.2<mm>; h = 8.8<mm>; label = "1″" }
64 ]
65
66