Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update special_strels.jl #473

Closed
2 tasks done
cpaniaguam opened this issue Nov 6, 2024 · 0 comments · Fixed by #474
Closed
2 tasks done

Update special_strels.jl #473

cpaniaguam opened this issue Nov 6, 2024 · 0 comments · Fixed by #474
Assignees
Labels
enhancement New feature or request

Comments

@cpaniaguam
Copy link
Member

cpaniaguam commented Nov 6, 2024

  • Add se disk with radius = 20

  • Refactor se disk radius = 50

"""
    _generate_se!(se)

Generate a structuring element by leveraging symmetry (mirroring and inverting) a given initial structuring element.
"""
function _generate_se!(se)
    se .= se .| reverse(se; dims=1)
    se .= se .| reverse(se; dims=2)
    se .= .!se
    return nothing
end

function se_disk50()
    se = [sum(c.I) <= 29 for c in CartesianIndices((99, 99))]
    _generate_se!(se)
    return se
end

make_landmask_se = se_disk50

function se_disk4()
    se = zeros(Bool, 7, 7)
    se[4, 4] = 1
    return bwdist(se) .<= 3.6
end

function se_disk20()
    se = [sum(c.I) <= 11 for c in CartesianIndices((39, 39))]
    _generate_se!(se)
    return se
end
@cpaniaguam cpaniaguam self-assigned this Nov 6, 2024
@cpaniaguam cpaniaguam added the enhancement New feature or request label Nov 6, 2024
@cpaniaguam cpaniaguam linked a pull request Nov 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
1 participant