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

erode: potential bug with 3D strel_diamond #122

Open
korbinian90 opened this issue Mar 17, 2023 · 0 comments
Open

erode: potential bug with 3D strel_diamond #122

korbinian90 opened this issue Mar 17, 2023 · 0 comments

Comments

@korbinian90
Copy link

I'm using the erode function with a diamond shape structuring element, but the output doesn't look like what I expected. I'm working with 3D masks. Here is a minimal example with 3x3x3 showing the unexpected result.

Explanation:
The center voxel image[2,2,2] should be 0 after erosion (It is connected to image[2,2,3]==0).
In the output of erode, the voxel eroded[2,2,2]==1 though, which is not what I expected.

julia> image = [1 1 1; 1 1 1; 1 1 1;;; 0 1 0; 1 1 1; 1 1 1;;; 0 0 0; 0 0 0; 1 1 1]
3×3×3 Array{Int64, 3}:
[:, :, 1] =
 1  1  1
 1  1  1
 1  1  1

[:, :, 2] =
 0  1  0
 1  1  1
 1  1  1

[:, :, 3] =
 0  0  0
 0  0  0
 1  1  1

julia> SE = strel_diamond(box)
3×3×3 ImageMorphology.SEDiamondArray{3, 3, UnitRange{Int64}, 0} with indices -1:1×-1:1×-1:1:
[:, :, -1] =
 0  0  0
 0  1  0
 0  0  0

[:, :, 0] =
 0  1  0
 1  1  1
 0  1  0

[:, :, 1] =
 0  0  0
 0  1  0
 0  0  0

julia> eroded = erode(image, SE)
3×3×3 Array{Int64, 3}:
[:, :, 1] =
 1  1  1
 1  1  1
 1  1  1

[:, :, 2] =
 0  1  0
 0  1  0
 1  1  1

[:, :, 3] =
 0  0  0
 0  0  0
 0  0  0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant