X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=Parasitemia%2FParasitemiaUI%2FState.fs;fp=Parasitemia%2FParasitemiaUI%2FState.fs;h=f1336402a4945f4b819401e575dbdd2b5c308eff;hb=f765276ea9abd8be286a17fae45509dde749812b;hp=5b89810591e6cb93b5072cbdec609bd411df7616;hpb=4bfa3cbdc6145e6944f02e24829ab2ef3a851ac1;p=master-thesis.git diff --git a/Parasitemia/ParasitemiaUI/State.fs b/Parasitemia/ParasitemiaUI/State.fs index 5b89810..f133640 100644 --- a/Parasitemia/ParasitemiaUI/State.fs +++ b/Parasitemia/ParasitemiaUI/State.fs @@ -30,6 +30,10 @@ type State () = List.length srcImg.rbcs, srcImg.rbcs |> List.fold (fun nbInfected rbc -> if rbc.infected then nbInfected + 1 else nbInfected) 0 + member this.ImageNbAltered (srcImg: SourceImage) : int * int = + List.length srcImg.rbcs, + srcImg.rbcs |> List.fold (fun nbAltered rbc -> if rbc.setManually then nbAltered + 1 else nbAltered) 0 + member this.GlobalParasitemia : int * int = sourceImages |> Seq.fold (fun (nbTotal, nbTotalInfected) srcImg -> @@ -56,16 +60,18 @@ type State () = /// /// Load the current state. 'FilePath' must have been defined. /// - /// If the file cannot be laoded + /// If the file cannot be loaded member this.Load () = let data = PiaZ.load this.FilePath this.PatientID <- data.patientID sourceImages.Clear() sourceImages.InsertRange(0, data.images) - if sourceImages.Count > 0 - then this.CurrentImage <- Some sourceImages.[0] + this.CurrentImage <- if sourceImages.Count > 0 then Some sourceImages.[0] else None alteredSinceLastSave <- false + /// + /// + /// If the image cannot be read member this.AddSourceImage (filePath: string) (defaultConfig: ParasitemiaCore.Config.Config) : SourceImage = let srcImg = { num = sourceImages.Count + 1; config = defaultConfig.Copy(); dateLastAnalysis = DateTime(0L); rbcs = []; img = new Image(filePath) } sourceImages.Add(srcImg)