e29465c0008a1b686b7a9f9c58fe1483660baece
[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 let healthyRBColor = Color.FromRgb(255uy, 255uy, 0uy) // Yellow-green.
13 let infectedRBColor = Color.FromRgb(255uy, 0uy, 40uy) // Red with a bit of blue.
14
15 type RBC = {
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 type SourceImage = {
29 mutable num: int
30 mutable name: string
31
32 mutable config: ParasitemiaCore.Config.Config
33 mutable dateLastAnalysis: DateTime // UTC.
34 img: Image<Bgr, byte>
35 mutable rbcs: RBC list
36
37 mutable healthyRBCBrightness: float32
38 mutable infectedRBCBrightness: float32 } with
39
40 member this.HealthyRBCColor: SolidColorBrush =
41 let mutable color = healthyRBColor * this.healthyRBCBrightness
42 color.A <- 255uy;
43 SolidColorBrush(color)
44
45 member this.InfectedRBCColor: SolidColorBrush =
46 let mutable color = infectedRBColor * this.infectedRBCBrightness
47 color.A <- 255uy;
48 SolidColorBrush(color)