X-Git-Url: http://git.euphorik.ch/?p=master-thesis.git;a=blobdiff_plain;f=Parasitemia%2FParasitemia%2FClassifier.fs;h=8467d24e7f212c920b700937bf82050cafcdea7e;hp=e0bbfa972f8359a4ada0fd19755652047b754b39;hb=8cf3b0a302943312c588690b4e4c90af17b3e87a;hpb=10afa9a402eb88c8e073fe8b0d607faa25230eef diff --git a/Parasitemia/Parasitemia/Classifier.fs b/Parasitemia/Parasitemia/Classifier.fs index e0bbfa9..8467d24 100644 --- a/Parasitemia/Parasitemia/Classifier.fs +++ b/Parasitemia/Parasitemia/Classifier.fs @@ -65,8 +65,8 @@ let findCells (ellipses: Ellipse list) (parasites: ParasitesMarker.Result) (fg: let mutable totalElement = 0 let mutable fgElement = 0 - for y in minY .. maxY do - for x in minX .. maxX do + for y in (if minY < 0 then 0 else minY) .. (if maxY >= fg.Height then fg.Height - 1 else maxY) do + for x in (if minX < 0 then 0 else minX) .. (if maxX >= fg.Width then fg.Width - 1 else maxX) do let yf, xf = float y, float x if e.Contains xf yf && neighbors |> List.forall (fun (otherE, _, _) -> not <| otherE.Contains xf yf) then @@ -86,8 +86,8 @@ let findCells (ellipses: Ellipse list) (parasites: ParasitesMarker.Result) (fg: let minX, minY, maxX, maxY = ellipseWindow e let mutable area = 0 - for y in minY .. maxY do - for x in minX .. maxX do + for y in (if minY < 0 then 0 else minY) .. (if maxY >= fg.Height then fg.Height - 1 else maxY) do + for x in (if minX < 0 then 0 else minX) .. (if maxX >= fg.Width then fg.Width - 1 else maxX) do let yf, xf = float y, float x if fg.Data.[y, x, 0] > 0uy && e.Contains xf yf &&