// Information associated to a document.
type JSONInformation = {
patientID: string
- fileVersion: int
-}
+ fileVersion: int }
// Information associated to each images.
type JSONSourceImage = {
rbcs: RBC List
healthyRBCBrightness: float32 // 0 to 1.
- infectedRBCBrightness: float32 // 0 to 1.
-}
+ infectedRBCBrightness: float32 } // 0 to 1.
type DocumentData = {
patientID: string
- images: SourceImage list
-}
+ images: SourceImage list }
let mainEntryName = "info.json"
let imageExtension = ".tiff"
/// </summary>
/// <param name="filePath"></param>
/// <exception cref="System.IOException">If the file cannot be read</exception>
-let load (filePath: string) : DocumentData =
+let load (filePath: string) (defaultConfig: ParasitemiaCore.Config.Config) : DocumentData =
use file = ZipFile.Open(filePath, ZipArchiveMode.Read)
let mainEntry = file.GetEntry(mainEntryName)
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)
+
+ let config = defaultConfig.Copy()
+ config.Parameters <-
+ { ParasitemiaCore.Config.defaultParameters with
+ resolution = imgInfo.parameters.resolution }
+
config.SetRBCRadius imgInfo.RBCRadius
yield { num = imgNum
name = imgInfo.name