-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Discretization of disk footprints (also ellipse, ball) #5470
Comments
Additional considerations: We could potentially allow both conventions by adding a keyword-only |
ImageMagick deals with this by allowing specification of a floating point radius which for example matches "current" when the radius is a whole number or "proposed" if the radius is a half pixel number. Size is always |
Hi @grlee77, and thank you for raising this. I agree, your proposed implementation looks visually more disk-like! |
Description
When constructing footprints (structuring elements) corresponding to a disk, the following code is currently used:
scikit-image/skimage/morphology/footprints.py
Lines 118 to 120 in d85b064
A second possibility is the following:
where the radius has been extended by 0.5 voxels. Practially the former means the edge of the disk falls at the voxel center a distance radius away, while for the later, the disk extends to the outer edge of that same voxel. A concrete illustration of this is given for radius = 3 (vs. 3.5) below:
Below is an illustration where the top row are the currently returned footprints for
skimage.morphology.disk
and the bottom row are the footprints with the proposed modification.I don't know that the existing behavior is technically a bug, but it is more a matter of what convention is chosen. To me, the lower row look visually more disk-like (although radius=1 is too coarse to resemble a disk in either case).
If this change is made for
disk
, the same convention should be used forball
andellipse
as well.The text was updated successfully, but these errors were encountered: