{"action":"created","issue":{"url":"https://api.github.com/repos/scipy/scipy/issues/4586","labels_url":"https://api.github.com/repos/scipy/scipy/issues/4586/labels{/name}","comments_url":"https://api.github.com/repos/scipy/scipy/issues/4586/comments","events_url":"https://api.github.com/repos/scipy/scipy/issues/4586/events","html_url":"https://github.com/scipy/scipy/issues/4586","id":59648091,"number":4586,"title":"ndimage: binary erosion.dilation algorithm selected by brute_force parameter unclear","user":{"login":"rgommers","id":98330,"avatar_url":"https://avatars.githubusercontent.com/u/98330?v=3","gravatar_id":"","url":"https://api.github.com/users/rgommers","html_url":"https://github.com/rgommers","followers_url":"https://api.github.com/users/rgommers/followers","following_url":"https://api.github.com/users/rgommers/following{/other_user}","gists_url":"https://api.github.com/users/rgommers/gists{/gist_id}","starred_url":"https://api.github.com/users/rgommers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgommers/subscriptions","organizations_url":"https://api.github.com/users/rgommers/orgs","repos_url":"https://api.github.com/users/rgommers/repos","events_url":"https://api.github.com/users/rgommers/events{/privacy}","received_events_url":"https://api.github.com/users/rgommers/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/scipy/scipy/labels/defect","name":"defect","color":"e11d21"},{"url":"https://api.github.com/repos/scipy/scipy/labels/scipy.ndimage","name":"scipy.ndimage","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-03T14:23:28Z","updated_at":"2015-10-10T07:36:45Z","closed_at":null,"body":"From gh-4578:\r\n\r\nThe ``brute_force`` argument in ``ndimage.morphology.binary_erosion`` and ``ndimage.morphology.binary_dilation`` is undocumented. ``brute_force`` selects a completely different algorithm defined in ni_morphology.c with zero documentation. I don't understand what it does or why by reading the code."},"comment":{"url":"https://api.github.com/repos/scipy/scipy/issues/comments/147049254","html_url":"https://github.com/scipy/scipy/issues/4586#issuecomment-147049254","issue_url":"https://api.github.com/repos/scipy/scipy/issues/4586","id":147049254,"user":{"login":"JDWarner","id":2184487,"avatar_url":"https://avatars.githubusercontent.com/u/2184487?v=3","gravatar_id":"","url":"https://api.github.com/users/JDWarner","html_url":"https://github.com/JDWarner","followers_url":"https://api.github.com/users/JDWarner/followers","following_url":"https://api.github.com/users/JDWarner/following{/other_user}","gists_url":"https://api.github.com/users/JDWarner/gists{/gist_id}","starred_url":"https://api.github.com/users/JDWarner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JDWarner/subscriptions","organizations_url":"https://api.github.com/users/JDWarner/orgs","repos_url":"https://api.github.com/users/JDWarner/repos","events_url":"https://api.github.com/users/JDWarner/events{/privacy}","received_events_url":"https://api.github.com/users/JDWarner/received_events","type":"User","site_admin":false},"created_at":"2015-10-10T07:36:45Z","updated_at":"2015-10-10T07:36:45Z","body":"It would appear `brute_force` forces a code path which fully computes each iteration. For the special case where the center is true (the flag `cit` must be `True`) and `brute_force` is false, it appears there is an alternative path which tracks which pixels are changed. I assume it then only recalculates where needed in subsequent iterations, but haven't done a full analysis of the algorithm beyond this point.\r\n\r\nThe `brute_force` parameter has no effect for the default `iterations` of 1, only multiple iterations. I do not know why the center must be true to enable the more efficient path."}}