module State open System.Collections.Generic open Emgu.CV open Emgu.CV.Structure type ImageSource = { cells: List img: Image } type State () = let imagesSource = List() member val FilePath: string = "" with get, set member val PatientID: string = "" with get, set member this.Save () = let data = { Pia.sources = []; Pia.patientID = this.PatientID } Pia.save this.FilePath data member this.Load () = let data = Pia.load this.FilePath this.PatientID <- data.patientID member this.AddSourceImage (filePath: string) = imagesSource.Add({ cells = List(); img = new Image(filePath) }) member x.ImagesSource : ImageSource seq = imagesSource :> ImageSource seq member this.Reset () = this.PatientID <- "" imagesSource.Clear()