Add the panel to display image source previews.
[master-thesis.git] / Parasitemia / Parasitemia / GUI / State.fs
1 module State
2
3 open System.Collections.Generic
4
5 open Emgu.CV
6 open Emgu.CV.Structure
7
8 type ImageSource = {
9 cells: List<Types.Cell>
10 img: Image<Bgr, byte> }
11
12 type State () =
13 let imagesSource = List<ImageSource>()
14
15 member val FilePath: string = "" with get, set
16 member val PatientID: string = "" with get, set
17
18 member this.Save () =
19 let data = { Pia.sources = []; Pia.patientID = this.PatientID }
20 Pia.save this.FilePath data
21
22 member this.Load () =
23 let data = Pia.load this.FilePath
24 this.PatientID <- data.patientID
25
26 member this.AddSourceImage (filePath: string) =
27 imagesSource.Add({ cells = List<Types.Cell>(); img = new Image<Bgr, byte>(filePath) })
28
29 member x.ImagesSource : ImageSource seq =
30 imagesSource :> ImageSource seq
31
32 member this.Reset () =
33 this.PatientID <- ""
34 imagesSource.Clear()