- let mainFile = file.GetEntry(mainFilename)
- let mainJSON = JSONMainInformation.Load(mainFile.Open())
-
- let sources = [
- let mutable imgNum = 0
- for imgEntry in file.Entries do
- let filename = imgEntry.Name
- if filename.EndsWith(imageExtension)
- then
- let img = new Image<Bgr, byte>(new System.Drawing.Bitmap(imgEntry.Open(), false)) // FIXME: Should we dispose the bitmap?
- 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 } ] } ]
- { sources = sources; patientID = mainJSON.PatientId }
\ No newline at end of file
+ let mainEntry = file.GetEntry(mainEntryName)
+ use mainEntryReader = new StreamReader(mainEntry.Open())
+ let info = JsonConvert.DeserializeObject<JSONInformation>(mainEntryReader.ReadToEnd())
+
+ { patientID = info.patientID
+ images = [ let mutable imgNum = 0
+ for imgEntry in file.Entries do
+ if imgEntry.Name.EndsWith(imageExtension)
+ then
+ let img = new Image<Bgr, byte>(new System.Drawing.Bitmap(imgEntry.Open(), false)) // FIXME: Should we dispose the bitmap?
+ imgNum <- imgNum + 1
+ let imgEntry = file.GetEntry(imgEntry.Name + ".json")
+ use imgEntryFileReader = new StreamReader(imgEntry.Open())
+ let imgInfo = JsonConvert.DeserializeObject<JSONSourceImage>(imgEntryFileReader.ReadToEnd())
+ let config = Config.Config(imgInfo.parameters)
+ config.SetRBCRadius imgInfo.RBCRadius
+ yield { num = imgNum
+ config = config
+ dateLastAnalysis = imgInfo.dateLastAnalysis
+ img = img
+ rbcs = imgInfo.rbcs } ] }
\ No newline at end of file