diff --git a/src/segmentation_a_direct.jl b/src/segmentation_a_direct.jl index 527031b9..63510b19 100644 --- a/src/segmentation_a_direct.jl +++ b/src/segmentation_a_direct.jl @@ -96,7 +96,19 @@ function get_holes(img, min_opening_area=20, se=IceFloeTracker.se_disk4()) out = IceFloeTracker.MorphSE.fill_holes(out) return out .!= img +end + +function fillholes!(img) + img[get_holes(img)] .= true + return nothing +end +function get_segment_mask(ice_mask, tiled_binmask) + Threads.@threads for img in (ice_mask, tiled_binmask) + fillholes!(img) + end + segment_mask = ice_mask .&& tiled_binmask + return segment_mask end function branchbridge(img)