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:
9a025e7
)
Adjustment of some parameters.
author
Greg Burri
<greg.burri@gmail.com>
Sat, 30 Jan 2016 17:11:17 +0000
(18:11 +0100)
committer
Greg Burri
<greg.burri@gmail.com>
Sat, 30 Jan 2016 17:11:17 +0000
(18:11 +0100)
Parasitemia/ParasitemiaCore/Analysis.fs
patch
|
blob
|
history
Parasitemia/ParasitemiaCore/Config.fs
patch
|
blob
|
history
Parasitemia/ParasitemiaCore/Ellipse.fs
patch
|
blob
|
history
Parasitemia/ParasitemiaCore/MatchingEllipses.fs
patch
|
blob
|
history
diff --git
a/Parasitemia/ParasitemiaCore/Analysis.fs
b/Parasitemia/ParasitemiaCore/Analysis.fs
index
7f58463
..
c894fc4
100644
(file)
--- a/
Parasitemia/ParasitemiaCore/Analysis.fs
+++ b/
Parasitemia/ParasitemiaCore/Analysis.fs
@@
-42,7
+42,7
@@
let doAnalysis (img: Image<Bgr, byte>) (name: string) (config: Config) (reportPr
let report (percent: int) : unit option =
reportWithVal percent ()
let report (percent: int) : unit option =
reportWithVal percent ()
- let inline buildLogWithName (text: string) = sprintf "
(%s)
%s" name text
+ let inline buildLogWithName (text: string) = sprintf "
№ %s:
%s" name text
let logWithName mess = Log.User(buildLogWithName mess)
let inline logTimeWithName (text: string) (f: unit -> 'a option) : 'a option = Log.LogWithTime((buildLogWithName text), Severity.USER, f)
let logWithName mess = Log.User(buildLogWithName mess)
let inline logTimeWithName (text: string) (f: unit -> 'a option) : 'a option = Log.LogWithTime((buildLogWithName text), Severity.USER, f)
diff --git
a/Parasitemia/ParasitemiaCore/Config.fs
b/Parasitemia/ParasitemiaCore/Config.fs
index
67b9ce3
..
d50ab0e
100644
(file)
--- a/
Parasitemia/ParasitemiaCore/Config.fs
+++ b/
Parasitemia/ParasitemiaCore/Config.fs
@@
-59,7
+59,7
@@
let defaultParameters = {
nbPickElementsMin = 10
factorNbValidPick = 0.06 //1.0
nbPickElementsMin = 10
factorNbValidPick = 0.06 //1.0
- factorNbMaxPick =
2
.
+ factorNbMaxPick =
4
.
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
cf55a8e
..
cf94be2
100644
(file)
--- a/
Parasitemia/ParasitemiaCore/Ellipse.fs
+++ b/
Parasitemia/ParasitemiaCore/Ellipse.fs
@@
-77,19
+77,18
@@
let ellipse (p1x: float) (p1y: float) (m1: float) (p2x: float) (p2y: float) (m2:
Some (Types.Ellipse(float32 cx, float32 cy, float32 majorAxis, float32 minorAxis, float32 phi'))
Some (Types.Ellipse(float32 cx, float32 cy, float32 majorAxis, float32 minorAxis, float32 phi'))
-
-let private vectorRotation (p1x: float32) (p1y: float32) (v1x: float32) (v1y: float32) (px: float32) (py: float32) : float32 =
- if p1y > py
+let inline private vectorRotation (px: float32) (py: float32) (vx: float32) (vy: float32) (p0x: float32) (p0y: float32) : float32 =
+ if py > p0y
then
then
- if v
1
x > 0.f then -1.f else 1.f
- elif p
1y < p
y
+ if vx > 0.f then -1.f else 1.f
+ elif p
y < p0
y
then
then
- if v
1
x < 0.f then -1.f else 1.f
- elif p
1x > p
x
+ if vx < 0.f then -1.f else 1.f
+ elif p
x > p0
x
then
then
- if v
1
y < 0.f then -1.f else 1.f
+ if vy < 0.f then -1.f else 1.f
else // p1x < px
else // p1x < px
- if v
1
y > 0.f then -1.f else 1.f
+ if vy > 0.f then -1.f else 1.f
let private areVectorsValid (p1x: float32) (p1y: float32) (p2x: float32) (p2y: float32) (v1x: float32) (v1y: float32) (v2x: float32) (v2y: float32) : (float32 * float32) option =
let m1 = -v1x / v1y
let private areVectorsValid (p1x: float32) (p1y: float32) (p2x: float32) (p2y: float32) (v1x: float32) (v1y: float32) (v2x: float32) (v2y: float32) : (float32 * float32) option =
let m1 = -v1x / v1y
@@
-97,23
+96,25
@@
let private areVectorsValid (p1x: float32) (p1y: float32) (p2x: float32) (p2y: f
let b1 = -m1 * p1x + p1y
let b2 = -m2 * p2x + p2y
let b1 = -m1 * p1x + p1y
let b2 = -m2 * p2x + p2y
- let p
x = -((b1 - b2) / (m1 - m2)
)
- let p
y = -((m2 * b1 - m1 * b2) / (m1 - m2)
)
+ let p
0x = -(b1 - b2) / (m1 - m2
)
+ let p
0y = -(m2 * b1 - m1 * b2) / (m1 - m2
)
- let rot1 = vectorRotation p1x p1y v1x v1y p
x p
y
- let rot2 = vectorRotation p2x p2y v2x v2y p
x p
y
+ let rot1 = vectorRotation p1x p1y v1x v1y p
0x p0
y
+ let rot2 = vectorRotation p2x p2y v2x v2y p
0x p0
y
if rot1 = rot2
then
None
else
if rot1 = rot2
then
None
else
- let alpha1 = atan2 (p1y - py) (p1x - px)
- let alpha2 = atan2 (p2y - py) (p2x - px)
+ let alpha1 =
+ let alpha1' = atan2 (p1y - p0y) (p1x - p0x)
+ if alpha1' < 0.f then 2.f * PI + alpha1' else alpha1'
- let alpha1' = if alpha1 < 0.f then 2.f * PI + alpha1 else alpha1
- let alpha2' = if alpha2 < 0.f then 2.f * PI + alpha2 else alpha2
+ let alpha2 =
+ let alpha2' = atan2 (p2y - p0y) (p2x - p0x)
+ if alpha2' < 0.f then 2.f * PI + alpha2' else alpha2'
- let diff = rot1 * alpha1
' + rot2 * alpha2'
+ let diff = rot1 * alpha1
+ rot2 * alpha2
if diff > PI || (diff < 0.f && diff > -PI)
then
if diff > PI || (diff < 0.f && diff > -PI)
then
@@
-201,7
+202,7
@@
let find (edges: Matrix<byte>)
match areVectorsValid (float32 p1xf) (float32 p1yf) (float32 p2xf) (float32 p2yf) -xDirData.[p1.Y, p1.X] -yDirData.[p1.Y, p1.X] -xDirData.[p2.Y, p2.X] -yDirData.[p2.Y, p2.X] with
| Some (m1, m2) ->
match ellipse p1xf p1yf (float m1) p2xf p2yf (float m2) p3xf p3yf with
match areVectorsValid (float32 p1xf) (float32 p1yf) (float32 p2xf) (float32 p2yf) -xDirData.[p1.Y, p1.X] -yDirData.[p1.Y, p1.X] -xDirData.[p2.Y, p2.X] -yDirData.[p2.Y, p2.X] with
| Some (m1, m2) ->
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 &&
+ | 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 ->
nbOfValidPicks <- nbOfValidPicks - 1
ellipses.Add e
e.A >= r1 - radiusTolerance && e.A <= r2 + radiusTolerance && e.B >= r1 - radiusTolerance && e.B <= r2 + radiusTolerance ->
nbOfValidPicks <- nbOfValidPicks - 1
ellipses.Add e
diff --git
a/Parasitemia/ParasitemiaCore/MatchingEllipses.fs
b/Parasitemia/ParasitemiaCore/MatchingEllipses.fs
index
f028e90
..
af72e57
100644
(file)
--- a/
Parasitemia/ParasitemiaCore/MatchingEllipses.fs
+++ b/
Parasitemia/ParasitemiaCore/MatchingEllipses.fs
@@
-10,10
+10,10
@@
open Types
open Utils
// All ellipses with a score below this are removed.
open Utils
// All ellipses with a score below this are removed.
-let matchingScoreThresholdPerRadiusUnit = 0.0
25f // For a radius of 1.
+let matchingScoreThresholdPerRadiusUnit = 0.0
7f // For a radius of 1. // 0.25
let matchingScorePower = 20.f
let windowSizeRadiusFactor = 1.f / 2.f
let matchingScorePower = 20.f
let windowSizeRadiusFactor = 1.f / 2.f
-let minimumDistanceFromCenterRadiusFactor = 1.f /
4
.f
+let minimumDistanceFromCenterRadiusFactor = 1.f /
3
.f
type private EllipseScoreFlaggedKd (matchingScore: float32, e: Ellipse) =
let mutable matchingScore = matchingScore
type private EllipseScoreFlaggedKd (matchingScore: float32, e: Ellipse) =
let mutable matchingScore = matchingScore