+ // Write each images and the associated information.
+ for imgSrc in data.sources do
+ let imgFilename = (string imgSrc.num) + imageExtension
+ let imgEntry = file.CreateEntry(imgFilename, CompressionLevel.NoCompression) // FIXME: It seems a compression is applied to this file despite of the 'NoCompression' flag.
+ imgSrc.img.ToBitmap().Save(imgEntry.Open(), System.Drawing.Imaging.ImageFormat.Tiff)
+
+ let imgJSON =
+ JSONSourceImage.Root([| for rbc in imgSrc.rbcs ->
+ JSONSourceImage.Rbc(
+ rbc.num,
+ rbc.infected, rbc.addedManually, rbc.removed,
+ decimal rbc.center.X, decimal rbc.center.Y, decimal rbc.size.Width, decimal rbc.size.Height,
+ rbc.stainArea) |])
+
+ let imgJSONEntry = file.CreateEntry(imgFilename + ".json", CompressionLevel.Fastest)
+ use imgJSONFileWriter = new StreamWriter(imgJSONEntry.Open())
+ imgJSON.JsonValue.WriteTo(imgJSONFileWriter, JsonSaveOptions.None)
+