Skip to content

Commit

Permalink
fix: use k=3 for kmeans seg for tiled workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
cpaniaguam committed Nov 20, 2024
1 parent 55a752a commit 9ebc728
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/ice_masks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,11 @@ function get_ice_masks(

fc_landmasked = apply_landmask(falsecolor_image, .!landmask)

Threads.@threads for tile in tiles
# Conditionally update binarized_tiling as its not used in some workflows
# Threads.@threads
for tile in tiles
@debug "Processing tile: $tile"
binarize && (binarized_tiling[tile...] .= imbinarize(morph_residue[tile...]))

morph_residue_seglabels = kmeans_segmentation(Gray.(morph_residue[tile...] / 255))
mrt = morph_residue[tile...]
morph_residue_seglabels = kmeans_segmentation(Gray.(mrt / 255), k=3)

# TODO: handle case where get_nlabel returns missing
floes_label = get_nlabel(
Expand All @@ -163,9 +162,12 @@ function get_ice_masks(
band_7_threshold_relaxed=band_7_threshold_relaxed,
band_1_threshold_relaxed=band_1_threshold_relaxed,
possible_ice_threshold=possible_ice_threshold,
)
)

ice_mask[tile...] .= (morph_residue_seglabels .== floes_label)

ice_mask[tile...] .= (morph_residue_seglabels .== floes_label)
# Conditionally update binarized_tiling as its not used in some workflows
binarize && (binarized_tiling[tile...] .= imbinarize(mrt))
end

return (icemask=ice_mask, bin=binarized_tiling .> 0)
Expand Down

0 comments on commit 9ebc728

Please sign in to comment.