module ParasitemiaUI.Analysis
open System
-open System.IO
open System.Linq
open System.Windows
-open System.Windows.Media
-open System.Windows.Markup
-open System.Windows.Shapes
open System.Windows.Controls
-open System.Diagnostics
-open Microsoft.Win32 // For the common dialogs.
-
-open Emgu.CV.WPF
+open ParasitemiaUIControls
open ParasitemiaCore.UnitsOfMeasure
open ParasitemiaCore.Config
open Types
let showWindow (parent : Window) (state : State.State) : bool =
- let win = Views.AnalysisWindow ()
+ let win = AnalysisWindow ()
win.Owner <- parent
win.Left <- (if parent.WindowState = WindowState.Maximized then 0. else parent.Left) + parent.ActualWidth / 2. - win.Width / 2.
win.Top <- (if parent.WindowState = WindowState.Maximized then 0. else parent.Top) + parent.ActualHeight / 2. - win.Height / 2.
win.stackSourceImagesSelection.Children.Clear ()
let width = int win.stackSourceImagesSelection.ActualWidth
for srcImg in state.SourceImages do
- let imageSourceSelection = Views.ImageSourceSelection (Tag = srcImg, Margin = Thickness 3.)
+ let imageSourceSelection = ImageSourceSelection (Tag = srcImg, Margin = Thickness 3.)
imageSourceSelection.Tag <- srcImg
imageSourceSelection.txtImageNumber.Text <- string srcImg.RomanNum
// Get the new parameters for each image. If an error occurs then 'None' is returned and a message box is displayed.
// The boolean is 'true' if the image is selected (checked).
let getInputImagesParameters () : (SourceImage * bool * Parameters) list option =
- let sourceImagesControls = win.stackSourceImagesSelection.Children |> Seq.cast<Views.ImageSourceSelection>
+ let sourceImagesControls = win.stackSourceImagesSelection.Children |> Seq.cast<ImageSourceSelection>
let parameters =
seq {
for srcImgCtrl in sourceImagesControls do
let isChecked = srcImgCtrl.chkSelection.IsChecked
match parseAndValidatePPI srcImgCtrl.txtResolution.Text with
| Some resolution ->
- yield Some (srcImg, isChecked.HasValue && isChecked.Value, { srcImg.Config.Parameters with resolution = resolution * 1.<ppi> })
+ Some (srcImg, isChecked.HasValue && isChecked.Value, { srcImg.Config.Parameters with resolution = resolution * 1.<ppi> })
| None ->
MessageBox.Show (sprintf "No resolution defined for the image number %d" srcImg.Num, "No resolution defined", MessageBoxButton.OK, MessageBoxImage.Information) |> ignore
- yield None
+ None
} |> Seq.takeWhile (fun e -> e.IsSome) |> Seq.map (fun e -> e.Value) |> List.ofSeq
if parameters.Count () <> sourceImagesControls.Count () then
for srcImg, selected, parameters in imagesParameters do
srcImg.Config.Parameters <- parameters // Save parameters.
if selected then
- yield string srcImg.RomanNum, srcImg.Config, srcImg.Img
+ string srcImg.RomanNum, srcImg.Config, srcImg.Img
]
if imagesToProcess.IsEmpty then