a1ae0521c01ea831a35876f05053eef6d4052366
1
module Parasitemia.GUI.State
3 open System.Collections.Generic
12 let sourceImages = List<SourceImage>()
14 member val CurrentImage: SourceImage option = None with get
, set
15 member val FilePath: string = "" with get
, set
16 member val PatientID: string = "" with get
, set
19 let data = { PiaZ.sources
= List.ofSeq
sourceImages; PiaZ.patientID
= this
.PatientID }
20 PiaZ.save
this.FilePath data
23 let data = PiaZ.load
this.FilePath
24 this.PatientID <- data.patientID
26 sourceImages.InsertRange(0, data.sources
)
28 member this.AddSourceImage (filePath
: string) : SourceImage =
29 let srcImg = { num
= sourceImages.Count + 1; rbcs
= []; img
= new Image<Bgr, byte
>(filePath
) }
30 sourceImages.Add(srcImg)
33 member this.SetResult (num
: int) (cells
: Cell list) =
34 let sourceImage = sourceImages.Find(fun srcImg -> srcImg.num
= num
)
35 sourceImage.rbcs
<- cells
36 |> List.filter
(fun cell
-> match cell
.cellClass
with HealthyRBC | InfectedRBC -> true | _ -> false )
37 |> List.mapi
(fun i cell
->
39 infected
= cell
.cellClass
= InfectedRBC
41 center
= Point(float cell.center
.X, float cell.center
.Y)
42 size
= Size(float cell.elements
.Width, float cell.elements
.Height)
43 stainArea
= cell.stainArea
})
45 member this.SourceImages : SourceImage seq =
46 sourceImages :> SourceImage seq
48 member this.Reset () =