module Parasitemia.Main open System.IO open System.Windows open System.Windows.Media open System.Windows.Markup open System.Windows.Shapes open System.Windows.Controls open System.Drawing open System.Diagnostics open Emgu.CV open Emgu.CV.Structure open Emgu.CV.WPF open Config let display (window : Views.MainWindow) (img : IImage) = let imgControl = window.Root.FindName("img") :?> Controls.Image imgControl.Source <- BitmapSourceConvert.ToBitmapSource(img) let log (window : Views.MainWindow) (mess : string) = let txtLog = window.Root.FindName("txtLog") :?> Controls.TextBlock txtLog.Text <- txtLog.Text + mess + "\n" [] do Utils.dprintfn "OpenCV test" let app = new Application() let mainWindow = Views.MainWindow() Utils.log <- (fun m -> log mainWindow m) let config = { scale = 1.0 doGSigma1 = 1.5 doGSigma2 = 20.0 doGLowFreqPercentageReduction = 0.9 darkStainLevel = 0.839 stainSigma = 10.0 stainLevel = 0.9 stainSpreadRequired = 3.0 infectionSigma = 2.0 infectionLevel = 0.762 infectionPixelsRequired = 1 } ///// ELLIPSES ///// //use img = new Image("../../../../src/Tests_hough/images/1508133543-7-4-120-0001.png") //use img = new Image("../../../../src/Tests_hough/images/rbc_single.png") //use img = new Image("../../../../src/Tests_hough/images/rbc_single_oblong_4.png") //use img = new Image("../../../../src/Tests_hough/images/strange_rbc_1.png") //use img = new Image("../../../../src/Tests_hough/images/rbc_single_blurred.png") //use img = new Image("../../../../src/Tests_hough/images/lot.png") ///// PARASITES ///// use img = new Image("../../../../src/Parasites/images/1.png") // KdTree.test3 () // Utils.dprintfn "area: %A" area let result = ImageAnalysis.doAnalysis img config display mainWindow result.img mainWindow.Root.Show() app.Run() |> ignore