projects
/
master-thesis.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
04d4504
)
More homogeneous ellipse density.
author
Greg Burri
<greg.burri@gmail.com>
Fri, 29 Jan 2016 23:44:49 +0000
(
00:44
+0100)
committer
Greg Burri
<greg.burri@gmail.com>
Fri, 29 Jan 2016 23:44:49 +0000
(
00:44
+0100)
Parasitemia/ParasitemiaCore/Config.fs
patch
|
blob
|
history
Parasitemia/ParasitemiaCore/Ellipse.fs
patch
|
blob
|
history
Parasitemia/ParasitemiaCore/KdTree.fs
patch
|
blob
|
history
Parasitemia/ParasitemiaCore/UnitsOfMeasure.fs
patch
|
blob
|
history
diff --git
a/Parasitemia/ParasitemiaCore/Config.fs
b/Parasitemia/ParasitemiaCore/Config.fs
index
5e3280c
..
b721b70
100644
(file)
--- a/
Parasitemia/ParasitemiaCore/Config.fs
+++ b/
Parasitemia/ParasitemiaCore/Config.fs
@@
-24,7
+24,9
@@
type Parameters = {
LPFStandardDeviationRBC: float<μm>
// Ellipse.
LPFStandardDeviationRBC: float<μm>
// Ellipse.
- factorNbPick: float // The number of computed ellipse per edge pixel.
+ nbPickElementsMin: int
+ factorNbValidPick: float // The number of computed ellipse per edge pixel.
+ factorNbMaxPick: float
// Parasites detection.
darkStainLevel: float // Lower -> more sensitive. Careful about illumination on the borders.
// Parasites detection.
darkStainLevel: float // Lower -> more sensitive. Careful about illumination on the borders.
@@
-55,7
+57,9
@@
let defaultParameters = {
LPFStandardDeviationParasite = 0.15<μm>
LPFStandardDeviationRBC = 0.22<μm>
LPFStandardDeviationParasite = 0.15<μm>
LPFStandardDeviationRBC = 0.22<μm>
- factorNbPick = 1.0
+ nbPickElementsMin = 10
+ factorNbValidPick = 0.05 //1.0
+ factorNbMaxPick = 2.
darkStainLevel = 0.25
maxDarkStainRatio = 0.1 // 10 %
darkStainLevel = 0.25
maxDarkStainRatio = 0.1 // 10 %
diff --git
a/Parasitemia/ParasitemiaCore/Ellipse.fs
b/Parasitemia/ParasitemiaCore/Ellipse.fs
index
db23ece
..
cf55a8e
100644
(file)
--- a/
Parasitemia/ParasitemiaCore/Ellipse.fs
+++ b/
Parasitemia/ParasitemiaCore/Ellipse.fs
@@
-131,7
+131,9
@@
let find (edges: Matrix<byte>)
// We choose a window size for which the biggest ellipse can always be fitted in.
let windowSize = roundInt (2.f * r2)
// We choose a window size for which the biggest ellipse can always be fitted in.
let windowSize = roundInt (2.f * r2)
- let factorNbPick = config.Parameters.factorNbPick
+ let factorNbValidPick = config.Parameters.factorNbValidPick
+ let factorNbMaxPick = config.Parameters.factorNbMaxPick
+ let nbPickElementsMin = config.Parameters.nbPickElementsMin
let increment = windowSize / (int incrementWindowDivisor)
let increment = windowSize / (int incrementWindowDivisor)
@@
-180,8
+182,9
@@
let find (edges: Matrix<byte>)
if currentElements.Count >= 10
then
if currentElements.Count >= 10
then
- let mutable nbOfPicks = (float currentElements.Count) * factorNbPick |> int
- while nbOfPicks > 0 do
+ let mutable nbOfPicks = (float currentElements.Count) * factorNbMaxPick |> int
+ let mutable nbOfValidPicks = (float currentElements.Count) * factorNbValidPick |> int
+ while nbOfPicks > 0 && nbOfValidPicks > 0 do
let p1 = currentElements.[rng.Next(currentElements.Count)]
let p2 = currentElements.[rng.Next(currentElements.Count)]
let p3 = currentElements.[rng.Next(currentElements.Count)]
let p1 = currentElements.[rng.Next(currentElements.Count)]
let p2 = currentElements.[rng.Next(currentElements.Count)]
let p3 = currentElements.[rng.Next(currentElements.Count)]
@@
-200,7
+203,8
@@
let find (edges: Matrix<byte>)
match ellipse p1xf p1yf (float m1) p2xf p2yf (float m2) p3xf p3yf with
| Some e when e.Cx > 0.f && e.Cx < w_f - 1.f && e.Cy > 0.f && e.Cy < h_f - 1.f &&
e.A >= r1 - radiusTolerance && e.A <= r2 + radiusTolerance && e.B >= r1 - radiusTolerance && e.B <= r2 + radiusTolerance ->
match ellipse p1xf p1yf (float m1) p2xf p2yf (float m2) p3xf p3yf with
| Some e when e.Cx > 0.f && e.Cx < w_f - 1.f && e.Cy > 0.f && e.Cy < h_f - 1.f &&
e.A >= r1 - radiusTolerance && e.A <= r2 + radiusTolerance && e.B >= r1 - radiusTolerance && e.B <= r2 + radiusTolerance ->
- ellipses.Add e
+ nbOfValidPicks <- nbOfValidPicks - 1
+ ellipses.Add e
| _ -> ()
| _ -> ()
| _ -> ()
| _ -> ()
diff --git
a/Parasitemia/ParasitemiaCore/KdTree.fs
b/Parasitemia/ParasitemiaCore/KdTree.fs
index
4513208
..
3a60977
100644
(file)
--- a/
Parasitemia/ParasitemiaCore/KdTree.fs
+++ b/
Parasitemia/ParasitemiaCore/KdTree.fs
@@
-65,10
+65,10
@@
type Tree<'a when 'a :> I2DCoords> =
buildTreeFromSortedArray xSorted ySorted 1
member this.Search (searchRegion: Region) : 'a list =
buildTreeFromSortedArray xSorted ySorted 1
member this.Search (searchRegion: Region) : 'a list =
- let rec valuesFrom (tree: Tree<'a>) : 'a list =
+ let rec valuesFrom (tree: Tree<'a>)
(acc: 'a list)
: 'a list =
match tree with
match tree with
- | Node (_,
part1, part2) -> (valuesFrom part1) @ (valuesFrom part2
)
- | Leaf v ->
[v]
+ | Node (_,
left, right) -> (valuesFrom right (valuesFrom left acc)
)
+ | Leaf v ->
v :: acc
let rec searchWithRegion (tree: Tree<'a>) (currentRegion: Region) (depth: int) : 'a list =
match tree with
let rec searchWithRegion (tree: Tree<'a>) (currentRegion: Region) (depth: int) : 'a list =
match tree with
@@
-77,7
+77,7
@@
type Tree<'a when 'a :> I2DCoords> =
let valuesInRegion (region: Region) (treeRegion: Tree<'a>) =
if region.IsSub searchRegion
then
let valuesInRegion (region: Region) (treeRegion: Tree<'a>) =
if region.IsSub searchRegion
then
- valuesFrom treeRegion
+ valuesFrom treeRegion
[]
elif region.Intersects searchRegion
then
searchWithRegion treeRegion region (depth + 1)
elif region.Intersects searchRegion
then
searchWithRegion treeRegion region (depth + 1)
diff --git
a/Parasitemia/ParasitemiaCore/UnitsOfMeasure.fs
b/Parasitemia/ParasitemiaCore/UnitsOfMeasure.fs
index
637f49e
..
ec343ea
100644
(file)
--- a/
Parasitemia/ParasitemiaCore/UnitsOfMeasure.fs
+++ b/
Parasitemia/ParasitemiaCore/UnitsOfMeasure.fs
@@
-6,12
+6,12
@@
[<Measure>] type inch
[<Measure>] type ppi = px / inch // Pixel per inch.
[<Measure>] type inch
[<Measure>] type ppi = px / inch // Pixel per inch.
-let μm
InchRatio
= 25.4e3<μm/inch>
-let mm
InchRatio
= 25.4<mm/inch>
+let μm
PerInch
= 25.4e3<μm/inch>
+let mm
PerInch
= 25.4<mm/inch>
-let μmToInch(x: float<μm>) : float<inch> = x / μm
InchRatio
-let inchToμm(x: float<inch>) : float<μm> = x * μm
InchRatio
+let μmToInch(x: float<μm>) : float<inch> = x / μm
PerInch
+let inchToμm(x: float<inch>) : float<μm> = x * μm
PerInch
-let mmToInch(x: float<mm>) : float<inch> = x / mm
InchRatio
-let inchTomm(x: float<inch>) : float<mm> = x * mm
InchRatio
+let mmToInch(x: float<mm>) : float<inch> = x / mm
PerInch
+let inchTomm(x: float<inch>) : float<mm> = x * mm
PerInch