X-Git-Url: http://git.euphorik.ch/?p=master-thesis.git;a=blobdiff_plain;f=Parasitemia%2FParasitemiaUI%2FPiaZ.fs;h=92397be46d9df87547913dd2cb1aa6c990d6d083;hp=c9dfd5b8247d4022dfd1dcd810c38d1516654dec;hb=c4a76a01f62568c6353396ff85551a3151fc5236;hpb=94fbffc758bf0299b077e344ebcbecca408ae564 diff --git a/Parasitemia/ParasitemiaUI/PiaZ.fs b/Parasitemia/ParasitemiaUI/PiaZ.fs index c9dfd5b..92397be 100644 --- a/Parasitemia/ParasitemiaUI/PiaZ.fs +++ b/Parasitemia/ParasitemiaUI/PiaZ.fs @@ -26,6 +26,8 @@ type JSONInformation = { // Information associated to each images. type JSONSourceImage = { num: int + name: string + RBCRadius: float32 // The RBC Radius found by granulometry. parameters: ParasitemiaCore.Config.Parameters dateLastAnalysis: DateTime @@ -42,7 +44,7 @@ type DocumentData = { let mainEntryName = "info.json" let imageExtension = ".tiff" -let currentFileVersion = 1 +let currentFileVersion = 2 /// /// Save a document in a give file path. The file may already exist. @@ -72,6 +74,7 @@ let save (filePath: string) (data: DocumentData) = imgJSONFileWriter.Write( JsonConvert.SerializeObject( { num = srcImg.num + name = srcImg.name RBCRadius = srcImg.config.RBCRadius.Pixel parameters = srcImg.config.Parameters dateLastAnalysis = srcImg.dateLastAnalysis @@ -108,12 +111,13 @@ let load (filePath: string) : DocumentData = use bitmap = new System.Drawing.Bitmap(imgEntry.Open(), false) let img = new Image(bitmap) imgNum <- imgNum + 1 - let imgEntry = file.GetEntry(imgEntry.Name + ".json") - use imgEntryFileReader = new StreamReader(imgEntry.Open()) - let imgInfo = JsonConvert.DeserializeObject(imgEntryFileReader.ReadToEnd()) + let imgJSONEntry = file.GetEntry(imgEntry.Name + ".json") + use imgJSONFileReader = new StreamReader(imgJSONEntry.Open()) + let imgInfo = JsonConvert.DeserializeObject(imgJSONFileReader.ReadToEnd()) let config = ParasitemiaCore.Config.Config(imgInfo.parameters) config.SetRBCRadius imgInfo.RBCRadius yield { num = imgNum + name = imgInfo.name config = config dateLastAnalysis = imgInfo.dateLastAnalysis img = img