{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/comments/27359330","id":27359330,"diff_hunk":"@@ -0,0 +1,34 @@\n+from skimage import transform\n+import numpy as np\n+from numpy import testing\n+\n+\n+def energy(img):\n+    if(img.ndim == 3):\n+        return np.ascontiguousarray(img[:, :, 0])\n+    return (1 - img)\n+\n+\n+def test_seam_carving():\n+    img = np.array([[0, 0, 1, 0, 0],\n+                    [0, 0, 1, 0, 0],\n+                    [0, 0, 1, 0, 0],\n+                    [0, 1, 0, 0, 0],\n+                    [1, 0, 0, 0, 0]], dtype=np.float)\n+\n+    out = transform.seam_carve(img, 'horizontal', 1, energy, border=0)\n+    testing.assert_allclose(out, 0)\n+\n+    img = img.T\n+    out = transform.seam_carve(img, 'vertical', 1, energy, border=0)\n+    testing.assert_allclose(out, 0)\n+\n+    img = img.T\n+\n+    img3 = np.dstack([img, img, img])\n+\n+    out = transform.seam_carve(img3, 'horizontal', 1, energy, border=0)\n+    testing.assert_allclose(out, 0)\n+\n+    out = transform.seam_carve(img3, 'vertical', 1, energy, border=0)\n+    testing.assert_allclose(out, 0)","path":"skimage/transform/tests/test_seam_carving.py","position":34,"original_position":34,"commit_id":"9add87226a83023258c1c00dc0bbf7ff9b8df294","original_commit_id":"9add87226a83023258c1c00dc0bbf7ff9b8df294","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},"body":"Not sure if it's strictly necessary, but we generally end `test_*.py` files with the motif\r\n```python\r\nif __name__ == '__main__':\r\n    np.testing.run_module_suite()\r\n```\r\nso the file can be executed, allowing a specific set of unit tests to be run locally as needed rather than the entire suite.","created_at":"2015-03-29T21:29:40Z","updated_at":"2015-03-29T21:29:40Z","html_url":"https://github.com/scikit-image/scikit-image/pull/1459#discussion_r27359330","pull_request_url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1459","_links":{"self":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/comments/27359330"},"html":{"href":"https://github.com/scikit-image/scikit-image/pull/1459#discussion_r27359330"},"pull_request":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1459"}}},"pull_request":{"url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1459","id":32179286,"html_url":"https://github.com/scikit-image/scikit-image/pull/1459","diff_url":"https://github.com/scikit-image/scikit-image/pull/1459.diff","patch_url":"https://github.com/scikit-image/scikit-image/pull/1459.patch","issue_url":"https://api.github.com/repos/scikit-image/scikit-image/issues/1459","number":1459,"state":"open","locked":false,"title":"Seam Carving","user":{"login":"vighneshbirodkar","id":3823490,"avatar_url":"https://avatars.githubusercontent.com/u/3823490?v=3","gravatar_id":"","url":"https://api.github.com/users/vighneshbirodkar","html_url":"https://github.com/vighneshbirodkar","followers_url":"https://api.github.com/users/vighneshbirodkar/followers","following_url":"https://api.github.com/users/vighneshbirodkar/following{/other_user}","gists_url":"https://api.github.com/users/vighneshbirodkar/gists{/gist_id}","starred_url":"https://api.github.com/users/vighneshbirodkar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vighneshbirodkar/subscriptions","organizations_url":"https://api.github.com/users/vighneshbirodkar/orgs","repos_url":"https://api.github.com/users/vighneshbirodkar/repos","events_url":"https://api.github.com/users/vighneshbirodkar/events{/privacy}","received_events_url":"https://api.github.com/users/vighneshbirodkar/received_events","type":"User","site_admin":false},"body":"This addresses #1372 \r\n![figure_1](https://cloud.githubusercontent.com/assets/3823490/6884977/bec71628-d629-11e4-9024-767fab3c536e.png)\r\n![figure_2](https://cloud.githubusercontent.com/assets/3823490/6884979/bece1658-d629-11e4-99ec-7b82d3cff6c6.png)\r\n![figure_3](https://cloud.githubusercontent.com/assets/3823490/6884978/bec939d0-d629-11e4-9ba8-7b19ce851eac.png)\r\n\r\n@stefanv I wanted to add an image into the repo to better demonstrate this algorithm.\r\n","created_at":"2015-03-29T10:10:35Z","updated_at":"2015-03-29T21:29:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1de0d17aa57d9d412cb4251b9eb53a2c794d4dc4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1459/commits","review_comments_url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1459/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/1459/comments","statuses_url":"https://api.github.com/repos/scikit-image/scikit-image/statuses/9add87226a83023258c1c00dc0bbf7ff9b8df294","head":{"label":"vighneshbirodkar:seam_carving","ref":"seam_carving","sha":"9add87226a83023258c1c00dc0bbf7ff9b8df294","user":{"login":"vighneshbirodkar","id":3823490,"avatar_url":"https://avatars.githubusercontent.com/u/3823490?v=3","gravatar_id":"","url":"https://api.github.com/users/vighneshbirodkar","html_url":"https://github.com/vighneshbirodkar","followers_url":"https://api.github.com/users/vighneshbirodkar/followers","following_url":"https://api.github.com/users/vighneshbirodkar/following{/other_user}","gists_url":"https://api.github.com/users/vighneshbirodkar/gists{/gist_id}","starred_url":"https://api.github.com/users/vighneshbirodkar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vighneshbirodkar/subscriptions","organizations_url":"https://api.github.com/users/vighneshbirodkar/orgs","repos_url":"https://api.github.com/users/vighneshbirodkar/repos","events_url":"https://api.github.com/users/vighneshbirodkar/events{/privacy}","received_events_url":"https://api.github.com/users/vighneshbirodkar/received_events","type":"User","site_admin":false},"repo":{"id":17216229,"name":"scikit-image","full_name":"vighneshbirodkar/scikit-image","owner":{"login":"vighneshbirodkar","id":3823490,"avatar_url":"https://avatars.githubusercontent.com/u/3823490?v=3","gravatar_id":"","url":"https://api.github.com/users/vighneshbirodkar","html_url":"https://github.com/vighneshbirodkar","followers_url":"https://api.github.com/users/vighneshbirodkar/followers","following_url":"https://api.github.com/users/vighneshbirodkar/following{/other_user}","gists_url":"https://api.github.com/users/vighneshbirodkar/gists{/gist_id}","starred_url":"https://api.github.com/users/vighneshbirodkar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vighneshbirodkar/subscriptions","organizations_url":"https://api.github.com/users/vighneshbirodkar/orgs","repos_url":"https://api.github.com/users/vighneshbirodkar/repos","events_url":"https://api.github.com/users/vighneshbirodkar/events{/privacy}","received_events_url":"https://api.github.com/users/vighneshbirodkar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vighneshbirodkar/scikit-image","description":"Image Processing SciKit (Toolbox for SciPy)","fork":true,"url":"https://api.github.com/repos/vighneshbirodkar/scikit-image","forks_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/forks","keys_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/teams","hooks_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/hooks","issue_events_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/issues/events{/number}","events_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/events","assignees_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/assignees{/user}","branches_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/branches{/branch}","tags_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/tags","blobs_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/git/refs{/sha}","trees_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/statuses/{sha}","languages_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/languages","stargazers_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/stargazers","contributors_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/contributors","subscribers_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/subscribers","subscription_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/subscription","commits_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/commits{/sha}","git_commits_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/git/commits{/sha}","comments_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/comments{/number}","issue_comment_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/issues/comments{/number}","contents_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/contents/{+path}","compare_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/merges","archive_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/downloads","issues_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/issues{/number}","pulls_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/pulls{/number}","milestones_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/milestones{/number}","notifications_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/labels{/name}","releases_url":"https://api.github.com/repos/vighneshbirodkar/scikit-image/releases{/id}","created_at":"2014-02-26T16:04:02Z","updated_at":"2015-03-28T19:00:36Z","pushed_at":"2015-03-29T10:25:45Z","git_url":"git://github.com/vighneshbirodkar/scikit-image.git","ssh_url":"git@github.com:vighneshbirodkar/scikit-image.git","clone_url":"https://github.com/vighneshbirodkar/scikit-image.git","svn_url":"https://github.com/vighneshbirodkar/scikit-image","homepage":"http://scikit-image.org","size":37981,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"scikit-image:master","ref":"master","sha":"65d525bcd5f30604c9a71c3480355580e9db7162","user":{"login":"scikit-image","id":897180,"avatar_url":"https://avatars.githubusercontent.com/u/897180?v=3","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,"name":"scikit-image","full_name":"scikit-image/scikit-image","owner":{"login":"scikit-image","id":897180,"avatar_url":"https://avatars.githubusercontent.com/u/897180?v=3","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},"private":false,"html_url":"https://github.com/scikit-image/scikit-image","description":"Image Processing SciKit (Toolbox for SciPy)","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}","created_at":"2011-07-07T22:07:20Z","updated_at":"2015-03-27T19:08:05Z","pushed_at":"2015-03-29T20:36:36Z","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":64820,"stargazers_count":659,"watchers_count":659,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":337,"mirror_url":null,"open_issues_count":167,"forks":337,"open_issues":167,"watchers":659,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1459"},"html":{"href":"https://github.com/scikit-image/scikit-image/pull/1459"},"issue":{"href":"https://api.github.com/repos/scikit-image/scikit-image/issues/1459"},"comments":{"href":"https://api.github.com/repos/scikit-image/scikit-image/issues/1459/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1459/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/1459/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-image/scikit-image/statuses/9add87226a83023258c1c00dc0bbf7ff9b8df294"}}}}