X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=Parasitemia%2FParasitemia%2FGUI%2FState.fs;h=45025366d91c3eb4d78533cb5ac35b3f49b6bf1d;hb=f4fdf61ef98b913129ddb771392c0bcb1475e6fb;hp=b5136c2269d93d3e74c16f0056b48d00e4d41882;hpb=da6b1ee15d0368ef9f2d9734b0d72996cbc227d8;p=master-thesis.git diff --git a/Parasitemia/Parasitemia/GUI/State.fs b/Parasitemia/Parasitemia/GUI/State.fs index b5136c2..4502536 100644 --- a/Parasitemia/Parasitemia/GUI/State.fs +++ b/Parasitemia/Parasitemia/GUI/State.fs @@ -1,34 +1,40 @@ -module State +module Parasitemia.GUI.State open System.Collections.Generic open Emgu.CV open Emgu.CV.Structure -type ImageSource = { - cells: List - img: Image } +open Types type State () = - let imagesSource = List() + let sourceImages = List() + let mutable currentImage = -1 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 } + let data = { Pia.sources = List.ofSeq sourceImages; Pia.patientID = this.PatientID } Pia.save this.FilePath data member this.Load () = let data = Pia.load this.FilePath this.PatientID <- data.patientID + sourceImages.Clear() + sourceImages.InsertRange(0, data.sources) - member this.AddSourceImage (filePath: string) = - imagesSource.Add({ cells = List(); img = new Image(filePath) }) + member this.AddSourceImage (filePath: string) : SourceImage = + let srcImg = { num = sourceImages.Count + 1; rbcs = []; img = new Image(filePath) } + sourceImages.Add(srcImg) + if sourceImages.Count = 1 + then + currentImage <- 1 + srcImg - member x.ImagesSource : ImageSource seq = - imagesSource :> ImageSource seq + member x.SourceImages : SourceImage seq = + sourceImages :> SourceImage seq member this.Reset () = this.PatientID <- "" - imagesSource.Clear() \ No newline at end of file + sourceImages.Clear() \ No newline at end of file