{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/comments/219709394","pull_request_review_id":157949755,"id":219709394,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxOTcwOTM5NA==","diff_hunk":"@@ -0,0 +1,68 @@\n+\"\"\"\n+===================================\n+Masked Normalized Cross-Correlation\n+===================================\n+\n+In this example, we use the masked normalized cross-correlation to identify the relative shift\n+between two similar images containing invalid data.\n+\n+In this case, the images cannot simply be masked before computing the cross-correlation, \n+as the masks will influence the computation. The influence of the masks must be removed from\n+the cross-correlation, as is described in [1]_.\n+\n+In this example, we register the translation between two images. However, one of the \n+images has about 25% of the pixels which are corrupted.\n+\n+.. [1] D. Padfield, \"Masked object registration in the Fourier domain\" \n+       IEEE Transactions on Image Processing (2012). :DOI:`10.1109/TIP.2011.2181402`\n+\n+\"\"\"\n+import numpy as np\n+import matplotlib.pyplot as plt\n+\n+from skimage import data\n+from skimage.feature import masked_register_translation\n+from scipy.ndimage import fourier_shift\n+\n+image = data.camera()\n+shift = (-22, 13)\n+\n+# Define areas of the image which are invalid\n+# Probability of an invalid pixel is 25%\n+# This could be due to a faulty detector, or edges that\n+# are not affected by translation (e.g. moving object in a window)\n+# See reference paper for more examples\n+corruped_pixels = np.random.choice([False, True], size = image.shape, p = [0.25, 0.75])","path":"doc/examples/transform/plot_masked_register_translation.py","position":35,"original_position":35,"commit_id":"d8d38c3a4162864c06ba86c6508c6cb9395274c4","original_commit_id":"d8d38c3a4162864c06ba86c6508c6cb9395274c4","user":{"login":"emmanuelle","id":263366,"node_id":"MDQ6VXNlcjI2MzM2Ng==","avatar_url":"https://avatars3.githubusercontent.com/u/263366?v=4","gravatar_id":"","url":"https://api.github.com/users/emmanuelle","html_url":"https://github.com/emmanuelle","followers_url":"https://api.github.com/users/emmanuelle/followers","following_url":"https://api.github.com/users/emmanuelle/following{/other_user}","gists_url":"https://api.github.com/users/emmanuelle/gists{/gist_id}","starred_url":"https://api.github.com/users/emmanuelle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emmanuelle/subscriptions","organizations_url":"https://api.github.com/users/emmanuelle/orgs","repos_url":"https://api.github.com/users/emmanuelle/repos","events_url":"https://api.github.com/users/emmanuelle/events{/privacy}","received_events_url":"https://api.github.com/users/emmanuelle/received_events","type":"User","site_admin":false},"body":"corrupted_pixels ","created_at":"2018-09-23T19:53:06Z","updated_at":"2018-09-23T19:53:06Z","html_url":"https://github.com/scikit-image/scikit-image/pull/3334#discussion_r219709394","pull_request_url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/3334","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/comments/219709394"},"html":{"href":"https://github.com/scikit-image/scikit-image/pull/3334#discussion_r219709394"},"pull_request":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/3334"}}},"pull_request":{"url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/3334","id":207391722,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA3MzkxNzIy","html_url":"https://github.com/scikit-image/scikit-image/pull/3334","diff_url":"https://github.com/scikit-image/scikit-image/pull/3334.diff","patch_url":"https://github.com/scikit-image/scikit-image/pull/3334.patch","issue_url":"https://api.github.com/repos/scikit-image/scikit-image/issues/3334","number":3334,"state":"open","locked":false,"title":"Implementation of masked image translation registration","user":{"login":"LaurentRDC","id":16210338,"node_id":"MDQ6VXNlcjE2MjEwMzM4","avatar_url":"https://avatars0.githubusercontent.com/u/16210338?v=4","gravatar_id":"","url":"https://api.github.com/users/LaurentRDC","html_url":"https://github.com/LaurentRDC","followers_url":"https://api.github.com/users/LaurentRDC/followers","following_url":"https://api.github.com/users/LaurentRDC/following{/other_user}","gists_url":"https://api.github.com/users/LaurentRDC/gists{/gist_id}","starred_url":"https://api.github.com/users/LaurentRDC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LaurentRDC/subscriptions","organizations_url":"https://api.github.com/users/LaurentRDC/orgs","repos_url":"https://api.github.com/users/LaurentRDC/repos","events_url":"https://api.github.com/users/LaurentRDC/events{/privacy}","received_events_url":"https://api.github.com/users/LaurentRDC/received_events","type":"User","site_admin":false},"body":"## Description\r\nThis pull request is related to issue #3330. The main points are described below:\r\n\r\nI often have to register translation between diffraction patterns. However, there are static image elements that throw off standard approaches based on normalized cross-correlation, like `skimage.feature.register_translation`.\r\n\r\nI have implemented a normalized cross-correlation function that can take image masks as well, based on the following publication: [D. Padfield. Masked object registration in the Fourier domain. IEEE Transactions on Image Processing (2012)](http://www.dirkpadfield.com/Home/MaskedObjectRegistrationInTheFourierDomain.pdf?attredirects=0). The working principle is essentially the same as `skimage.feature.register_translation`, with the cross-correlation not taking into account the masked parts of images.\r\n\r\nThe function `skimage.feature.masked_register_translation` from this pull request passes the exact same tests as the MATLAB implementation from the original author. It also gives the same results as `skimage.feature.register_translation` in the case of trivial masks. \r\n\r\nYou can find a successful registration example [here](https://scikit-ued.readthedocs.io/en/master/tutorials/image.html#diffraction-pattern-alignment).\r\n\r\n## Checklist\r\n- [x] Clean style in [the spirit of PEP8](https://www.python.org/dev/peps/pep-0008/)\r\n- [x] [Docstrings for all functions](https://github.com/numpy/numpy/blob/master/doc/example.py)\r\n- [x] Gallery example in `./doc/examples` (new features only)\r\n- [ ] Benchmark in `./benchmarks`, if your changes aren't covered by an\r\n  existing benchmark\r\n- [x] Unit tests\r\n\r\n## For reviewers\r\n\r\n(Don't remove the checklist below.)\r\n\r\n- [ ] Check that the PR title is short, concise, and will make sense 1 year\r\n  later.\r\n- [ ] Check that new functions are imported in corresponding `__init__.py`.\r\n- [ ] Check that new features, API changes, and deprecations are mentioned in\r\n      `doc/release/release_dev.rst`.\r\n- [ ] Consider backporting the PR with `@meeseeksdev backport to v0.14.x`\r\n","created_at":"2018-08-09T17:40:32Z","updated_at":"2018-09-23T19:53:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3048ef59cd120aa06c1f609e17c13514722b0581","assignee":{"login":"soupault","id":1315589,"node_id":"MDQ6VXNlcjEzMTU1ODk=","avatar_url":"https://avatars0.githubusercontent.com/u/1315589?v=4","gravatar_id":"","url":"https://api.github.com/users/soupault","html_url":"https://github.com/soupault","followers_url":"https://api.github.com/users/soupault/followers","following_url":"https://api.github.com/users/soupault/following{/other_user}","gists_url":"https://api.github.com/users/soupault/gists{/gist_id}","starred_url":"https://api.github.com/users/soupault/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soupault/subscriptions","organizations_url":"https://api.github.com/users/soupault/orgs","repos_url":"https://api.github.com/users/soupault/repos","events_url":"https://api.github.com/users/soupault/events{/privacy}","received_events_url":"https://api.github.com/users/soupault/received_events","type":"User","site_admin":false},"assignees":[{"login":"soupault","id":1315589,"node_id":"MDQ6VXNlcjEzMTU1ODk=","avatar_url":"https://avatars0.githubusercontent.com/u/1315589?v=4","gravatar_id":"","url":"https://api.github.com/users/soupault","html_url":"https://github.com/soupault","followers_url":"https://api.github.com/users/soupault/followers","following_url":"https://api.github.com/users/soupault/following{/other_user}","gists_url":"https://api.github.com/users/soupault/gists{/gist_id}","starred_url":"https://api.github.com/users/soupault/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soupault/subscriptions","organizations_url":"https://api.github.com/users/soupault/orgs","repos_url":"https://api.github.com/users/soupault/repos","events_url":"https://api.github.com/users/soupault/events{/privacy}","received_events_url":"https://api.github.com/users/soupault/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":360222353,"node_id":"MDU6TGFiZWwzNjAyMjIzNTM=","url":"https://api.github.com/repos/scikit-image/scikit-image/labels/status:%20needs%20review","name":"status: needs review","color":"fef2c0","default":false},{"id":314658482,"node_id":"MDU6TGFiZWwzMTQ2NTg0ODI=","url":"https://api.github.com/repos/scikit-image/scikit-image/labels/type:%20new%20feature","name":"type: new feature","color":"8a64ae","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/3334/commits","review_comments_url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/3334/comments","review_comment_url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scikit-image/scikit-image/issues/3334/comments","statuses_url":"https://api.github.com/repos/scikit-image/scikit-image/statuses/d8d38c3a4162864c06ba86c6508c6cb9395274c4","head":{"label":"LaurentRDC:masked-registration","ref":"masked-registration","sha":"d8d38c3a4162864c06ba86c6508c6cb9395274c4","user":{"login":"LaurentRDC","id":16210338,"node_id":"MDQ6VXNlcjE2MjEwMzM4","avatar_url":"https://avatars0.githubusercontent.com/u/16210338?v=4","gravatar_id":"","url":"https://api.github.com/users/LaurentRDC","html_url":"https://github.com/LaurentRDC","followers_url":"https://api.github.com/users/LaurentRDC/followers","following_url":"https://api.github.com/users/LaurentRDC/following{/other_user}","gists_url":"https://api.github.com/users/LaurentRDC/gists{/gist_id}","starred_url":"https://api.github.com/users/LaurentRDC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LaurentRDC/subscriptions","organizations_url":"https://api.github.com/users/LaurentRDC/orgs","repos_url":"https://api.github.com/users/LaurentRDC/repos","events_url":"https://api.github.com/users/LaurentRDC/events{/privacy}","received_events_url":"https://api.github.com/users/LaurentRDC/received_events","type":"User","site_admin":false},"repo":{"id":144152039,"node_id":"MDEwOlJlcG9zaXRvcnkxNDQxNTIwMzk=","name":"scikit-image","full_name":"LaurentRDC/scikit-image","private":false,"owner":{"login":"LaurentRDC","id":16210338,"node_id":"MDQ6VXNlcjE2MjEwMzM4","avatar_url":"https://avatars0.githubusercontent.com/u/16210338?v=4","gravatar_id":"","url":"https://api.github.com/users/LaurentRDC","html_url":"https://github.com/LaurentRDC","followers_url":"https://api.github.com/users/LaurentRDC/followers","following_url":"https://api.github.com/users/LaurentRDC/following{/other_user}","gists_url":"https://api.github.com/users/LaurentRDC/gists{/gist_id}","starred_url":"https://api.github.com/users/LaurentRDC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LaurentRDC/subscriptions","organizations_url":"https://api.github.com/users/LaurentRDC/orgs","repos_url":"https://api.github.com/users/LaurentRDC/repos","events_url":"https://api.github.com/users/LaurentRDC/events{/privacy}","received_events_url":"https://api.github.com/users/LaurentRDC/received_events","type":"User","site_admin":false},"html_url":"https://github.com/LaurentRDC/scikit-image","description":"Image processing in Python","fork":true,"url":"https://api.github.com/repos/LaurentRDC/scikit-image","forks_url":"https://api.github.com/repos/LaurentRDC/scikit-image/forks","keys_url":"https://api.github.com/repos/LaurentRDC/scikit-image/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LaurentRDC/scikit-image/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LaurentRDC/scikit-image/teams","hooks_url":"https://api.github.com/repos/LaurentRDC/scikit-image/hooks","issue_events_url":"https://api.github.com/repos/LaurentRDC/scikit-image/issues/events{/number}","events_url":"https://api.github.com/repos/LaurentRDC/scikit-image/events","assignees_url":"https://api.github.com/repos/LaurentRDC/scikit-image/assignees{/user}","branches_url":"https://api.github.com/repos/LaurentRDC/scikit-image/branches{/branch}","tags_url":"https://api.github.com/repos/LaurentRDC/scikit-image/tags","blobs_url":"https://api.github.com/repos/LaurentRDC/scikit-image/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LaurentRDC/scikit-image/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LaurentRDC/scikit-image/git/refs{/sha}","trees_url":"https://api.github.com/repos/LaurentRDC/scikit-image/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LaurentRDC/scikit-image/statuses/{sha}","languages_url":"https://api.github.com/repos/LaurentRDC/scikit-image/languages","stargazers_url":"https://api.github.com/repos/LaurentRDC/scikit-image/stargazers","contributors_url":"https://api.github.com/repos/LaurentRDC/scikit-image/contributors","subscribers_url":"https://api.github.com/repos/LaurentRDC/scikit-image/subscribers","subscription_url":"https://api.github.com/repos/LaurentRDC/scikit-image/subscription","commits_url":"https://api.github.com/repos/LaurentRDC/scikit-image/commits{/sha}","git_commits_url":"https://api.github.com/repos/LaurentRDC/scikit-image/git/commits{/sha}","comments_url":"https://api.github.com/repos/LaurentRDC/scikit-image/comments{/number}","issue_comment_url":"https://api.github.com/repos/LaurentRDC/scikit-image/issues/comments{/number}","contents_url":"https://api.github.com/repos/LaurentRDC/scikit-image/contents/{+path}","compare_url":"https://api.github.com/repos/LaurentRDC/scikit-image/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LaurentRDC/scikit-image/merges","archive_url":"https://api.github.com/repos/LaurentRDC/scikit-image/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LaurentRDC/scikit-image/downloads","issues_url":"https://api.github.com/repos/LaurentRDC/scikit-image/issues{/number}","pulls_url":"https://api.github.com/repos/LaurentRDC/scikit-image/pulls{/number}","milestones_url":"https://api.github.com/repos/LaurentRDC/scikit-image/milestones{/number}","notifications_url":"https://api.github.com/repos/LaurentRDC/scikit-image/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LaurentRDC/scikit-image/labels{/name}","releases_url":"https://api.github.com/repos/LaurentRDC/scikit-image/releases{/id}","deployments_url":"https://api.github.com/repos/LaurentRDC/scikit-image/deployments","created_at":"2018-08-09T12:50:08Z","updated_at":"2018-08-09T12:50:13Z","pushed_at":"2018-09-19T14:45:31Z","git_url":"git://github.com/LaurentRDC/scikit-image.git","ssh_url":"git@github.com:LaurentRDC/scikit-image.git","clone_url":"https://github.com/LaurentRDC/scikit-image.git","svn_url":"https://github.com/LaurentRDC/scikit-image","homepage":"http://scikit-image.org","size":55613,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"scikit-image:master","ref":"master","sha":"b91fa66a50bfa600efabf19e69575d92cec269e6","user":{"login":"scikit-image","id":897180,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg5NzE4MA==","avatar_url":"https://avatars0.githubusercontent.com/u/897180?v=4","gravatar_id":"","url":"https://api.github.com/users/scikit-image","html_url":"https://github.com/scikit-image","followers_url":"https://api.github.com/users/scikit-image/followers","following_url":"https://api.github.com/users/scikit-image/following{/other_user}","gists_url":"https://api.github.com/users/scikit-image/gists{/gist_id}","starred_url":"https://api.github.com/users/scikit-image/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scikit-image/subscriptions","organizations_url":"https://api.github.com/users/scikit-image/orgs","repos_url":"https://api.github.com/users/scikit-image/repos","events_url":"https://api.github.com/users/scikit-image/events{/privacy}","received_events_url":"https://api.github.com/users/scikit-image/received_events","type":"Organization","site_admin":false},"repo":{"id":2014929,"node_id":"MDEwOlJlcG9zaXRvcnkyMDE0OTI5","name":"scikit-image","full_name":"scikit-image/scikit-image","private":false,"owner":{"login":"scikit-image","id":897180,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg5NzE4MA==","avatar_url":"https://avatars0.githubusercontent.com/u/897180?v=4","gravatar_id":"","url":"https://api.github.com/users/scikit-image","html_url":"https://github.com/scikit-image","followers_url":"https://api.github.com/users/scikit-image/followers","following_url":"https://api.github.com/users/scikit-image/following{/other_user}","gists_url":"https://api.github.com/users/scikit-image/gists{/gist_id}","starred_url":"https://api.github.com/users/scikit-image/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scikit-image/subscriptions","organizations_url":"https://api.github.com/users/scikit-image/orgs","repos_url":"https://api.github.com/users/scikit-image/repos","events_url":"https://api.github.com/users/scikit-image/events{/privacy}","received_events_url":"https://api.github.com/users/scikit-image/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/scikit-image/scikit-image","description":"Image processing in Python","fork":false,"url":"https://api.github.com/repos/scikit-image/scikit-image","forks_url":"https://api.github.com/repos/scikit-image/scikit-image/forks","keys_url":"https://api.github.com/repos/scikit-image/scikit-image/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scikit-image/scikit-image/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scikit-image/scikit-image/teams","hooks_url":"https://api.github.com/repos/scikit-image/scikit-image/hooks","issue_events_url":"https://api.github.com/repos/scikit-image/scikit-image/issues/events{/number}","events_url":"https://api.github.com/repos/scikit-image/scikit-image/events","assignees_url":"https://api.github.com/repos/scikit-image/scikit-image/assignees{/user}","branches_url":"https://api.github.com/repos/scikit-image/scikit-image/branches{/branch}","tags_url":"https://api.github.com/repos/scikit-image/scikit-image/tags","blobs_url":"https://api.github.com/repos/scikit-image/scikit-image/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scikit-image/scikit-image/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scikit-image/scikit-image/git/refs{/sha}","trees_url":"https://api.github.com/repos/scikit-image/scikit-image/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scikit-image/scikit-image/statuses/{sha}","languages_url":"https://api.github.com/repos/scikit-image/scikit-image/languages","stargazers_url":"https://api.github.com/repos/scikit-image/scikit-image/stargazers","contributors_url":"https://api.github.com/repos/scikit-image/scikit-image/contributors","subscribers_url":"https://api.github.com/repos/scikit-image/scikit-image/subscribers","subscription_url":"https://api.github.com/repos/scikit-image/scikit-image/subscription","commits_url":"https://api.github.com/repos/scikit-image/scikit-image/commits{/sha}","git_commits_url":"https://api.github.com/repos/scikit-image/scikit-image/git/commits{/sha}","comments_url":"https://api.github.com/repos/scikit-image/scikit-image/comments{/number}","issue_comment_url":"https://api.github.com/repos/scikit-image/scikit-image/issues/comments{/number}","contents_url":"https://api.github.com/repos/scikit-image/scikit-image/contents/{+path}","compare_url":"https://api.github.com/repos/scikit-image/scikit-image/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scikit-image/scikit-image/merges","archive_url":"https://api.github.com/repos/scikit-image/scikit-image/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scikit-image/scikit-image/downloads","issues_url":"https://api.github.com/repos/scikit-image/scikit-image/issues{/number}","pulls_url":"https://api.github.com/repos/scikit-image/scikit-image/pulls{/number}","milestones_url":"https://api.github.com/repos/scikit-image/scikit-image/milestones{/number}","notifications_url":"https://api.github.com/repos/scikit-image/scikit-image/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scikit-image/scikit-image/labels{/name}","releases_url":"https://api.github.com/repos/scikit-image/scikit-image/releases{/id}","deployments_url":"https://api.github.com/repos/scikit-image/scikit-image/deployments","created_at":"2011-07-07T22:07:20Z","updated_at":"2018-09-23T05:21:29Z","pushed_at":"2018-09-23T15:27:21Z","git_url":"git://github.com/scikit-image/scikit-image.git","ssh_url":"git@github.com:scikit-image/scikit-image.git","clone_url":"https://github.com/scikit-image/scikit-image.git","svn_url":"https://github.com/scikit-image/scikit-image","homepage":"http://scikit-image.org","size":55633,"stargazers_count":2516,"watchers_count":2516,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1099,"mirror_url":null,"archived":false,"open_issues_count":487,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1099,"open_issues":487,"watchers":2516,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/3334"},"html":{"href":"https://github.com/scikit-image/scikit-image/pull/3334"},"issue":{"href":"https://api.github.com/repos/scikit-image/scikit-image/issues/3334"},"comments":{"href":"https://api.github.com/repos/scikit-image/scikit-image/issues/3334/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/3334/comments"},"review_comment":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/3334/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-image/scikit-image/statuses/d8d38c3a4162864c06ba86c6508c6cb9395274c4"}},"author_association":"NONE"}}
{"actor":{"display_login":"emmanuelle"}}