Skip to content

Commit

Permalink
refactor: remove redundant impose_minima function implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
cpaniaguam committed Nov 18, 2024
1 parent ca8a412 commit c8120eb
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,35 +120,6 @@ function imextendedmin(img::AbstractArray, h::Int=2, conn::Int=2)::BitMatrix
return mask_minima .> 0
end

function impose_minima(I::AbstractArray{T}, BW::AbstractArray{Bool}) where {T<:Integer}
marker = 255 .* BW
mask = imcomplement(min.(I .+ 1, 255 .- marker))
reconstructed = IceFloeTracker.MorphSE.mreconstruct(
IceFloeTracker.MorphSE.dilate, marker, mask
)
return IceFloeTracker.imcomplement(Int.(reconstructed))
end

function impose_minima(
I::AbstractArray{T}, BW::AbstractMatrix{Bool}
) where {T<:AbstractFloat}
# compute shift
a, b = extrema(I)
rng = b - a
h = rng == 0 ? 0.1 : rng / 1000

marker = -Inf * BW .+ (Inf * .!BW)
mask = min.(I .+ h, marker)

return 1 .- IceFloeTracker.MorphSE.mreconstruct(
IceFloeTracker.MorphSE.dilate, 1 .- marker, 1 .- mask
)
end

function imregionalmin(A, conn=2)
return ImageMorphology.local_minima(A; connectivity=conn) .> 0
end

"""
impose_minima(I::AbstractArray{T}, BW::AbstractArray{Bool}) where {T<:Integer}
Expand Down

0 comments on commit c8120eb

Please sign in to comment.