projects
/
master-thesis.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Change the way the dark stain is marked.
[master-thesis.git]
/
Parasitemia
/
ParasitemiaCore
/
ParasitesMarker.fs
diff --git
a/Parasitemia/ParasitemiaCore/ParasitesMarker.fs
b/Parasitemia/ParasitemiaCore/ParasitesMarker.fs
index
6c25d04
..
2b70682
100644
(file)
--- a/
Parasitemia/ParasitemiaCore/ParasitesMarker.fs
+++ b/
Parasitemia/ParasitemiaCore/ParasitesMarker.fs
@@
-7,6
+7,9
@@
open Emgu.CV
open Emgu.CV.Structure
open Utils
open Emgu.CV.Structure
open Utils
+open Histogram
+open Otsu
+open Morpho
open ImgTools
type Result = {
open ImgTools
type Result = {
@@
-24,7
+27,7
@@
let find (img: Image<Gray, float32>) (config: Config.Config) : Result * Image<Gr
let _, mean_fg, mean_bg =
let hist = histogramImg imgWithoutNucleus 300
otsu hist
let _, mean_fg, mean_bg =
let hist = histogramImg imgWithoutNucleus 300
otsu hist
- imgWithoutNucleus.Cmp(
-(float mean_bg) * config.Parameters.darkStainLevel + (float
mean_fg), CvEnum.CmpType.LessThan)
+ imgWithoutNucleus.Cmp(
float mean_fg - config.Parameters.darkStainLevel * float (mean_bg -
mean_fg), CvEnum.CmpType.LessThan)
let marker (img: Image<Gray, float32>) (closed: Image<Gray, float32>) (level: float) : Image<Gray, byte> =
let diff = img.Copy()
let marker (img: Image<Gray, float32>) (closed: Image<Gray, float32>) (level: float) : Image<Gray, byte> =
let diff = img.Copy()
@@
-33,11
+36,13
@@
let find (img: Image<Gray, float32>) (config: Config.Config) : Result * Image<Gr
diff._ThresholdBinary(Gray(0.0), Gray(255.))
diff.Convert<Gray, byte>()
diff._ThresholdBinary(Gray(0.0), Gray(255.))
diff.Convert<Gray, byte>()
+ // Nucleus.
let nucleusMarker = marker img imgWithoutNucleus (1. / config.Parameters.infectionSensitivity)
let nucleusMarker = marker img imgWithoutNucleus (1. / config.Parameters.infectionSensitivity)
+ // Cytoplasm.
let imgWithoutParasite = img.CopyBlank()
let kernelSize =
let imgWithoutParasite = img.CopyBlank()
let kernelSize =
- let size = roundInt
(config.RBCRadius.Pixel / 5.f)
+ let size = roundInt
config.RBCRadius.CytoplasmSize
if size % 2 = 0 then size + 1 else size
use kernel =
if kernelSize <= 3
if size % 2 = 0 then size + 1 else size
use kernel =
if kernelSize <= 3