type Result = {
darkStain: Image<Gray, byte>
- stain: Image<Gray, byte>
- infection: Image<Gray, byte> }
+ infection: Image<Gray, byte>
+ stain: Image<Gray, byte> }
// Create three binary markers :
// * 'Dark stain' corresponds to the colored pixel, it's independent of the size of the areas.
let maxLocation = ref <| [| Point() |]
diff.MinMax(min, max, minLocation, maxLocation)
- diff._ThresholdBinary((!max).[0] * threshold |> Gray, Gray(255.))
+ let valueThreshold = if (!max).[0] * threshold < 0.1 * (median_bg - median_fg) then 0.1 * (median_bg - median_fg) else (!max).[0] * threshold
+
+ diff._ThresholdBinary(Gray(valueThreshold), Gray(255.))
diff, closed
- let parasitesMarker, filteredGreenWithoutParasites = marker (int config.ParasiteArea) config.Parameters.infectionLevel
+ let infectionMarker, filteredGreenWithoutInfection = marker (int config.InfectionArea) config.Parameters.infectionLevel
let stainMarker, filteredGreenWithoutStain = marker (int config.StainArea) config.Parameters.stainLevel
{ darkStain = darkStain
- stain = parasitesMarker
- infection = stainMarker },
- filteredGreenWithoutParasites,
+ infection = infectionMarker
+ stain = stainMarker },
+ filteredGreenWithoutInfection,
filteredGreenWithoutStain