{"action":"created","issue":{"url":"https://api.github.com/repos/scikit-image/scikit-image/issues/1583","labels_url":"https://api.github.com/repos/scikit-image/scikit-image/issues/1583/labels{/name}","comments_url":"https://api.github.com/repos/scikit-image/scikit-image/issues/1583/comments","events_url":"https://api.github.com/repos/scikit-image/scikit-image/issues/1583/events","html_url":"https://github.com/scikit-image/scikit-image/pull/1583","id":93654278,"number":1583,"title":"FIX:  bug in 'reflect' and 'wrap' coordinate mapping","user":{"login":"grlee77","id":6528957,"avatar_url":"https://avatars.githubusercontent.com/u/6528957?v=3","gravatar_id":"","url":"https://api.github.com/users/grlee77","html_url":"https://github.com/grlee77","followers_url":"https://api.github.com/users/grlee77/followers","following_url":"https://api.github.com/users/grlee77/following{/other_user}","gists_url":"https://api.github.com/users/grlee77/gists{/gist_id}","starred_url":"https://api.github.com/users/grlee77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grlee77/subscriptions","organizations_url":"https://api.github.com/users/grlee77/orgs","repos_url":"https://api.github.com/users/grlee77/repos","events_url":"https://api.github.com/users/grlee77/events{/privacy}","received_events_url":"https://api.github.com/users/grlee77/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":39,"created_at":"2015-07-07T23:39:36Z","updated_at":"2015-10-01T18:30:07Z","closed_at":"2015-08-20T22:53:11Z","pull_request":{"url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1583","html_url":"https://github.com/scikit-image/scikit-image/pull/1583","diff_url":"https://github.com/scikit-image/scikit-image/pull/1583.diff","patch_url":"https://github.com/scikit-image/scikit-image/pull/1583.patch"},"body":"This pull request fixes subtle indexing errors in ``coord_map`` from ``_shared.interpolation.pyx``\r\nfor modes 'reflect' and 'mirror'.\r\n\r\nI added a small python wrapper to coord_map so I could create a test.  The image example shown below was added to the documentation.\r\n\r\nThe following lists output for a set of 1D coordinates before and after the PR:\r\n\r\n```python\r\nwrap = [coord_map(4, n, 'W') for n in range(-6, 6)]\r\n# before PR, wrap = [3, 1, 2, 3, 1, 2, 0, 1, 2, 3, 1, 2]\r\n# after PR, wrap  = [2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1]\r\n```\r\nNote that coordinate 0 was not wrapped!\r\n\r\n```python\r\nreflect = [coord_map(4, n, 'R') for n in range(-6, 6)]\r\n# before PR, reflect = [0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1]\r\n# after PR, reflect  = [2, 3, 3, 2, 1, 0, 0, 1, 2, 3, 3, 2]\r\n```\r\nnote that the edge coordinates 0 and 3 were not being duplicated in the mirrors\r\n\r\nThe difference is perhaps easier to see in images than the 1D example above. The original image extent is indicated by the region inside the yellow lines.\r\n\r\n**Prior to the PR:**\r\n![buggy_edge_modesv2](https://cloud.githubusercontent.com/assets/6528957/8559764/c94252a8-24de-11e5-9506-4314de1017cc.png)\r\n\r\n**After this PR:**\r\n![fixed_edge_modesv2](https://cloud.githubusercontent.com/assets/6528957/8559765/cdfc4448-24de-11e5-9554-514c528ce03b.png)\r\n"},"comment":{"url":"https://api.github.com/repos/scikit-image/scikit-image/issues/comments/144809998","html_url":"https://github.com/scikit-image/scikit-image/pull/1583#issuecomment-144809998","issue_url":"https://api.github.com/repos/scikit-image/scikit-image/issues/1583","id":144809998,"user":{"login":"stefanv","id":45071,"avatar_url":"https://avatars.githubusercontent.com/u/45071?v=3","gravatar_id":"","url":"https://api.github.com/users/stefanv","html_url":"https://github.com/stefanv","followers_url":"https://api.github.com/users/stefanv/followers","following_url":"https://api.github.com/users/stefanv/following{/other_user}","gists_url":"https://api.github.com/users/stefanv/gists{/gist_id}","starred_url":"https://api.github.com/users/stefanv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stefanv/subscriptions","organizations_url":"https://api.github.com/users/stefanv/orgs","repos_url":"https://api.github.com/users/stefanv/repos","events_url":"https://api.github.com/users/stefanv/events{/privacy}","received_events_url":"https://api.github.com/users/stefanv/received_events","type":"User","site_admin":false},"created_at":"2015-10-01T18:30:07Z","updated_at":"2015-10-01T18:30:07Z","body":"It assumes square pixels, for one.  And it doesn't generalize very well\nwhen pixel spacing changes.\n"}}