// 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
let mainEntryName = "info.json"
let imageExtension = ".tiff"
-let currentFileVersion = 1
+let currentFileVersion = 2
/// <summary>
/// Save a document in a give file path. The file may already exist.
imgJSONFileWriter.Write(
JsonConvert.SerializeObject(
{ num = srcImg.num
+ name = srcImg.name
RBCRadius = srcImg.config.RBCRadius.Pixel
parameters = srcImg.config.Parameters
dateLastAnalysis = srcImg.dateLastAnalysis
use bitmap = new System.Drawing.Bitmap(imgEntry.Open(), false)
let img = new Image<Bgr, byte>(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 imgJSONEntry = file.GetEntry(imgEntry.Name + ".json")
+ use imgJSONFileReader = new StreamReader(imgJSONEntry.Open())
+ let imgInfo = JsonConvert.DeserializeObject<JSONSourceImage>(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