29fc0a586be9f1a5704735baff2c7e030efb3b6d
1
module ParasitemiaUI.Export
8 /// <exception cref="System.IOException">If the results cannot be exported</exception>
9 let exportResults (state
: State) (filePath
: string) =
10 use writer = new StreamWriter(new FileStream(filePath
, FileMode.Create, FileAccess.Write))
11 fprintfn
writer "File: %s" state
.FilePath
12 fprintfn
writer "Export date: %O" DateTime.Now
15 fprintfn
writer "Patient ID: %s" state
.PatientID
16 fprintfn
writer "Global parasitemia: %s" (Utils.percentText
state.GlobalParasitemia)
18 for srcImg
in state.SourceImages do
20 fprintfn
writer "Image name: %s" srcImg
.name
21 fprintfn
writer "Parasitemia: %s" (Utils.percentText
(state.ImageParasitemia srcImg
))
22 fprintfn
writer "Added infected erythrocyte: %s %s" (state.ImageNbManuallyChangedRBCStr srcImg
true) (state.ImageManuallyChangedRBCStr srcImg
true)
23 fprintfn
writer "Removed infected erythrocyte: %s %s" (state.ImageNbManuallyChangedRBCStr srcImg
false) (state.ImageManuallyChangedRBCStr srcImg
false)