module Classifier open System open System.Drawing open Emgu.CV open Emgu.CV.Structure type CellClass = HealthyRBC | InfectedRBC | Peculiar type Cell = { cellClass: CellClass center: Point elements: Matrix } type KdEllipse (e: Types.Ellipse) = inherit Types.Ellipse (e.Cx, e.Cy, e.A, e.B, e.Alpha) interface KdTree.I2DCoords with member this.X = this.Cx member this.Y = this.Cy let findCells (ellipses: Types.Ellipse list) (parasites: ParasitesMarker.Result) (fg: Image) : Cell list = if ellipses.IsEmpty then [] else let tree = KdTree.Tree.buildTree (ellipses |> List.map KdEllipse) []