X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=Parasitemia%2FParasitemiaUI%2FPiaZ.fs;h=bb553b8442cc015198a567474913016e47f76b07;hb=1b8e45987bde692ab5602c281f878707f70459b7;hp=92397be46d9df87547913dd2cb1aa6c990d6d083;hpb=c4a76a01f62568c6353396ff85551a3151fc5236;p=master-thesis.git
diff --git a/Parasitemia/ParasitemiaUI/PiaZ.fs b/Parasitemia/ParasitemiaUI/PiaZ.fs
index 92397be..bb553b8 100644
--- a/Parasitemia/ParasitemiaUI/PiaZ.fs
+++ b/Parasitemia/ParasitemiaUI/PiaZ.fs
@@ -20,8 +20,7 @@ let filter = "PIA|*.piaz"
// Information associated to a document.
type JSONInformation = {
patientID: string
- fileVersion: int
-}
+ fileVersion: int }
// Information associated to each images.
type JSONSourceImage = {
@@ -34,13 +33,11 @@ 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"
@@ -95,7 +92,7 @@ let updateDocumentData (fromVersion: int) (toVersion: int) (data: DocumentData)
///
///
/// If the file cannot be read
-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)
@@ -114,7 +111,12 @@ let load (filePath: string) : DocumentData =
let imgJSONEntry = file.GetEntry(imgEntry.Name + ".json")
use imgJSONFileReader = new StreamReader(imgJSONEntry.Open())
let imgInfo = JsonConvert.DeserializeObject(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