--- /dev/null
+module ParasitemiaUI.Export
+
+open System
+open System.IO
+
+open State
+
+/// <exception cref="System.IOException">If the results cannot be exported</exception>
+let exportResults (state: State) (filePath: string) =
+ use writer = new StreamWriter(new FileStream(filePath, FileMode.Create, FileAccess.Write))
+ fprintfn writer "File: %s" state.FilePath
+ fprintfn writer "Export date: %A" DateTime.Now
+
+ fprintfn writer ""
+ fprintfn writer "Patient ID: %s" state.PatientID
+ fprintfn writer "Global parasitemia: %s" (Utils.percentText state.GlobalParasitemia)
+
+ for srcImg in state.SourceImages do
+ fprintfn writer ""
+ fprintfn writer "Image name: %s" srcImg.name
+ fprintfn writer "Parasitemia: %s" (Utils.percentText (state.ImageParasitemia srcImg))
+ fprintfn writer "Added infected erythrocyte: %s %s" (state.ImageNbManuallyChangedRBCStr srcImg true) (state.ImageManuallyChangedRBCStr srcImg true)
+ fprintfn writer "Removed infected erythrocyte: %s %s" (state.ImageNbManuallyChangedRBCStr srcImg false) (state.ImageManuallyChangedRBCStr srcImg false)
+ ()
\ No newline at end of file