X-Git-Url: http://git.euphorik.ch/?p=master-thesis.git;a=blobdiff_plain;f=Parasitemia%2FParasitemia%2FGUI%2FPiaZ.fs;h=e330a2d0ecc9cd02f8d7c461a042714b208f0fdc;hp=a373e53454009df41393e793e80ce47c7cca1c58;hb=807437584bdd3d7b7b33be8282472f81f8cce606;hpb=8013d6a586604e443332e6e9a715c86df444a875 diff --git a/Parasitemia/Parasitemia/GUI/PiaZ.fs b/Parasitemia/Parasitemia/GUI/PiaZ.fs index a373e53..e330a2d 100644 --- a/Parasitemia/Parasitemia/GUI/PiaZ.fs +++ b/Parasitemia/Parasitemia/GUI/PiaZ.fs @@ -1,6 +1,7 @@ // ParasitemIA Zipped file format. module Parasitemia.GUI.PiaZ +open System open System.Windows open System.IO open System.IO.Compression @@ -22,6 +23,8 @@ type FileData = { // The json type associated to a source image. type JSONSourceImage = JsonProvider<""" { + "RBCRadius" : 32.5, + "dateLastAnalysis" : 1.5, "rbcs": [ { "num": 1, @@ -66,8 +69,10 @@ let save (filePath: string) (data: FileData) = imgSrc.img.ToBitmap().Save(imgEntry.Open(), System.Drawing.Imaging.ImageFormat.Tiff) let imgJSON = - JSONSourceImage.Root([| for rbc in imgSrc.rbcs -> - JSONSourceImage.Rbc( + JSONSourceImage.Root(decimal imgSrc.rbcRadius, + decimal <| imgSrc.dateLastAnalysis.ToFileTimeUtc(), + [| for rbc in imgSrc.rbcs -> + JSONSourceImage.Rbc( rbc.num, rbc.infected, rbc.setManually, decimal rbc.center.X, decimal rbc.center.Y, decimal rbc.size.Width, decimal rbc.size.Height, @@ -94,9 +99,13 @@ let load (filePath: string) : FileData = imgNum <- imgNum + 1 let imgJSONEntry = file.GetEntry(filename + ".json") let imgJSON = JSONSourceImage.Load(imgJSONEntry.Open()) - yield { num = imgNum; img = img; rbcs = [ for rbc in imgJSON.Rbcs -> - { num = rbc.Num; - infected = rbc.Infected; setManually = rbc.SetManually; - center = Point(float rbc.PosX, float rbc.PosY); size = Size(float rbc.Width, float rbc.Height); - infectedArea = rbc.StainArea } ] } ] + yield { num = imgNum + rbcRadius = float imgJSON.RbcRadius + dateLastAnalysis = DateTime.FromFileTimeUtc(int64 imgJSON.DateLastAnalysis) + img = img + rbcs = [ for rbc in imgJSON.Rbcs -> + { num = rbc.Num; + infected = rbc.Infected; setManually = rbc.SetManually; + center = Point(float rbc.PosX, float rbc.PosY); size = Size(float rbc.Width, float rbc.Height); + infectedArea = rbc.StainArea } ] } ] { sources = sources; patientID = mainJSON.PatientId } \ No newline at end of file