X-Git-Url: http://git.euphorik.ch/?p=master-thesis.git;a=blobdiff_plain;f=Parasitemia%2FParasitemiaUI%2FTypes.fs;h=ada2a1f52cb4ee3db7c3468d523e0abf28f88eab;hp=fa99d9023a72f0ee1f6848b31d7669019419baa8;hb=2d712781def419c9acc98368f7102b19b064f16d;hpb=9343c4deb0bf88c58d9c92d465d8e99f64656875 diff --git a/Parasitemia/ParasitemiaUI/Types.fs b/Parasitemia/ParasitemiaUI/Types.fs index fa99d90..ada2a1f 100644 --- a/Parasitemia/ParasitemiaUI/Types.fs +++ b/Parasitemia/ParasitemiaUI/Types.fs @@ -11,69 +11,83 @@ open Newtonsoft.Json open ParasitemiaCore.UnitsOfMeasure -let healthyRBColor = Color.FromRgb(255uy, 255uy, 0uy) // Yellow-green. -let infectedRBColor = Color.FromRgb(255uy, 0uy, 40uy) // Red with a bit of blue. - -type RBC = { - num: int - - [] - mutable infected: bool - - [] - mutable setManually: bool - - center: Point - size: Size - infectedArea: int } - -type SourceImage = { - mutable num: int - mutable name: string - - mutable config: ParasitemiaCore.Config.Config - mutable dateLastAnalysis: DateTime // UTC. - img: Image - mutable rbcs: RBC list - - mutable healthyRBCBrightness: float32 - mutable infectedRBCBrightness: float32 } with - - member this.HealthyRBCColor: SolidColorBrush = - let mutable color = healthyRBColor * this.healthyRBCBrightness - color.A <- 255uy; - SolidColorBrush(color) - - member this.InfectedRBCColor: SolidColorBrush = - let mutable color = infectedRBColor * this.infectedRBCBrightness - color.A <- 255uy; - SolidColorBrush(color) - -type PredefinedPPI = { - ppi: int - label: string } with - override this.ToString() = - sprintf "%s: %d" this.label this.ppi - -type SensorSize = { - w: float - h: float - label: string } with - override this.ToString () = - sprintf "%g mm × %g mm%s" this.w this.h (if this.label = "" then "" else " (" + this.label + ")") - -let defaultPredefinedPPI = [ - { ppi = 230000; label = "50×" } - { ppi = 460000; label = "100×" } ] - -let defaultSensorSizes = [ - { w = 3.2; h = 2.4; label = "1/4″" } - { w = 4.8; h = 3.6; label = "1/3″" } - { w = 5.76; h = 4.29; label = "1/2.5″" } - { w = 6.4; h = 4.8; label = "1/2″" } - { w = 7.18; h = 5.32; label = "1/1.8″" } - { w = 7.6; h = 5.7; label = "1/1.7″" } - { w = 8.8; h = 6.6; label = "2/3″" } - { w = 13.2; h = 8.8; label = "1″" } ] +let healthyRBColor = Color.FromRgb (255uy, 255uy, 0uy) // Yellow-green. +let infectedRBColor = Color.FromRgb (255uy, 0uy, 40uy) // Red with a bit of blue. + +type RBC = + { + num : int + + [] + mutable infected : bool + + [] + mutable setManually : bool + + center : Point + size : Size + infectedArea : int + } + +type SourceImage = + { + mutable num : int + mutable name : string + + mutable config : ParasitemiaCore.Config.Config + mutable dateLastAnalysis : DateTime // UTC. + img : Image + mutable rbcs : RBC list + + mutable healthyRBCBrightness : float32 + mutable infectedRBCBrightness : float32 + } + with + member this.HealthyRBCColor : SolidColorBrush = + let mutable color = healthyRBColor * this.healthyRBCBrightness + color.A <- 255uy + SolidColorBrush (color) + + member this.InfectedRBCColor : SolidColorBrush = + let mutable color = infectedRBColor * this.infectedRBCBrightness + color.A <- 255uy + SolidColorBrush (color) + +type PredefinedPPI = + { + ppi : int + label : string + } + with + override this.ToString () = + sprintf "%s: %d" this.label this.ppi + +type SensorSize = + { + w : float + h : float + label : string + } + with + override this.ToString () = + sprintf "%g mm × %g mm%s" this.w this.h (if this.label = "" then "" else " (" + this.label + ")") + +let defaultPredefinedPPI = + [ + { ppi = 230000; label = "50×" } + { ppi = 460000; label = "100×" } + ] + +let defaultSensorSizes = + [ + { w = 3.2; h = 2.4; label = "1/4″" } + { w = 4.8; h = 3.6; label = "1/3″" } + { w = 5.76; h = 4.29; label = "1/2.5″" } + { w = 6.4; h = 4.8; label = "1/2″" } + { w = 7.18; h = 5.32; label = "1/1.8″" } + { w = 7.6; h = 5.7; label = "1/1.7″" } + { w = 8.8; h = 6.6; label = "2/3″" } + { w = 13.2; h = 8.8; label = "1″" } + ]