X-Git-Url: http://git.euphorik.ch/index.cgi?a=blobdiff_plain;f=Parasitemia%2FParasitemiaUI%2FExport.fs;fp=Parasitemia%2FParasitemiaUI%2FExport.fs;h=adecd6c76567ca1c718c9117c4beb2992a52f73c;hb=c4a76a01f62568c6353396ff85551a3151fc5236;hp=0000000000000000000000000000000000000000;hpb=94fbffc758bf0299b077e344ebcbecca408ae564;p=master-thesis.git diff --git a/Parasitemia/ParasitemiaUI/Export.fs b/Parasitemia/ParasitemiaUI/Export.fs new file mode 100644 index 0000000..adecd6c --- /dev/null +++ b/Parasitemia/ParasitemiaUI/Export.fs @@ -0,0 +1,24 @@ +module ParasitemiaUI.Export + +open System +open System.IO + +open State + +/// If the results cannot be exported +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