{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/comments/31952126","id":31952126,"diff_hunk":"@@ -109,40 +116,29 @@ def _clahe(image, ntiles_x, ntiles_y, clip_limit, nbins=128):\n     minimum and maximum value as the input image. A clip limit smaller than 1\n     results in standard (non-contrast limited) AHE.\n     \"\"\"\n-    ntiles_x = min(ntiles_x, MAX_REG_X)\n-    ntiles_y = min(ntiles_y, MAX_REG_Y)\n \n     if clip_limit == 1.0:\n         return image  # is OK, immediately returns original image.\n \n-    h_inner = image.shape[0] - image.shape[0] % ntiles_y\n-    w_inner = image.shape[1] - image.shape[1] % ntiles_x\n+    # make sure we cover the whole image\n+    ny = int(np.ceil(image.shape[0] / kernel_size[0]))\n+    nx = int(np.ceil(image.shape[1] / kernel_size[1]))\n \n-    # make the tile size divisible by 2\n-    h_inner -= h_inner % (2 * ntiles_y)\n-    w_inner -= w_inner % (2 * ntiles_x)\n-\n-    orig_shape = image.shape\n-    width = w_inner // ntiles_x  # Actual size of contextual regions\n-    height = h_inner // ntiles_y\n-\n-    if h_inner != image.shape[0]:\n-        ntiles_y += 1\n-    if w_inner != image.shape[1]:\n-        ntiles_x += 1\n-    if h_inner != image.shape[1] or w_inner != image.shape[0]:\n-        h_pad = height * ntiles_y - image.shape[0]\n-        w_pad = width * ntiles_x - image.shape[1]\n-        image = pad(image, ((0, h_pad), (0, w_pad)), mode='reflect')\n-        h_inner, w_inner = image.shape\n+    # use same method as ``view_as_windows`` to determine stride size\n+    rem = np.array(image.shape) - np.array(kernel_size)\n+    height, width = kernel_size\n+    while height * (ny - 1) > rem[0]:\n+        height -= 1\n+    while width * (nx - 1) > rem[1]:\n+        width -= 1","path":"skimage/exposure/_adapthist.py","position":132,"original_position":132,"commit_id":"3bcbbc05c05d5d3ccffd88d98c7f1693788d1f63","original_commit_id":"3bcbbc05c05d5d3ccffd88d98c7f1693788d1f63","user":{"login":"blink1073","id":2096628,"avatar_url":"https://avatars.githubusercontent.com/u/2096628?v=3","gravatar_id":"","url":"https://api.github.com/users/blink1073","html_url":"https://github.com/blink1073","followers_url":"https://api.github.com/users/blink1073/followers","following_url":"https://api.github.com/users/blink1073/following{/other_user}","gists_url":"https://api.github.com/users/blink1073/gists{/gist_id}","starred_url":"https://api.github.com/users/blink1073/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blink1073/subscriptions","organizations_url":"https://api.github.com/users/blink1073/orgs","repos_url":"https://api.github.com/users/blink1073/repos","events_url":"https://api.github.com/users/blink1073/events{/privacy}","received_events_url":"https://api.github.com/users/blink1073/received_events","type":"User","site_admin":false},"body":"Perhaps add a `best_fit` kwarg option `view_as_windows` to allow it to choose a stepsize that gives full coverage with minimal overlap?","created_at":"2015-06-08T19:51:24Z","updated_at":"2015-06-08T19:51:24Z","html_url":"https://github.com/scikit-image/scikit-image/pull/1547#discussion_r31952126","pull_request_url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1547","_links":{"self":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/comments/31952126"},"html":{"href":"https://github.com/scikit-image/scikit-image/pull/1547#discussion_r31952126"},"pull_request":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1547"}}},"pull_request":{"url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1547","id":37118717,"html_url":"https://github.com/scikit-image/scikit-image/pull/1547","diff_url":"https://github.com/scikit-image/scikit-image/pull/1547.diff","patch_url":"https://github.com/scikit-image/scikit-image/pull/1547.patch","issue_url":"https://api.github.com/repos/scikit-image/scikit-image/issues/1547","number":1547,"state":"open","locked":false,"title":"[WIP] Update Adapthist to use new ``view_as_windows`` capability","user":{"login":"blink1073","id":2096628,"avatar_url":"https://avatars.githubusercontent.com/u/2096628?v=3","gravatar_id":"","url":"https://api.github.com/users/blink1073","html_url":"https://github.com/blink1073","followers_url":"https://api.github.com/users/blink1073/followers","following_url":"https://api.github.com/users/blink1073/following{/other_user}","gists_url":"https://api.github.com/users/blink1073/gists{/gist_id}","starred_url":"https://api.github.com/users/blink1073/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blink1073/subscriptions","organizations_url":"https://api.github.com/users/blink1073/orgs","repos_url":"https://api.github.com/users/blink1073/repos","events_url":"https://api.github.com/users/blink1073/events{/privacy}","received_events_url":"https://api.github.com/users/blink1073/received_events","type":"User","site_admin":false},"body":"Fixes #1541.\r\n\r\nUse a `kernel_size` and overlapping windows instead of the old, limited, error-prone blocks implementation.\r\nThis still needs some deprecation handling, I'm just putting it out there for discussion.","created_at":"2015-06-08T02:32:50Z","updated_at":"2015-06-08T19:51:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0f4873b6f1e77b64009823409d819f002d5ecc90","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1547/commits","review_comments_url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1547/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/1547/comments","statuses_url":"https://api.github.com/repos/scikit-image/scikit-image/statuses/3bcbbc05c05d5d3ccffd88d98c7f1693788d1f63","head":{"label":"blink1073:adapthist-window","ref":"adapthist-window","sha":"3bcbbc05c05d5d3ccffd88d98c7f1693788d1f63","user":{"login":"blink1073","id":2096628,"avatar_url":"https://avatars.githubusercontent.com/u/2096628?v=3","gravatar_id":"","url":"https://api.github.com/users/blink1073","html_url":"https://github.com/blink1073","followers_url":"https://api.github.com/users/blink1073/followers","following_url":"https://api.github.com/users/blink1073/following{/other_user}","gists_url":"https://api.github.com/users/blink1073/gists{/gist_id}","starred_url":"https://api.github.com/users/blink1073/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blink1073/subscriptions","organizations_url":"https://api.github.com/users/blink1073/orgs","repos_url":"https://api.github.com/users/blink1073/repos","events_url":"https://api.github.com/users/blink1073/events{/privacy}","received_events_url":"https://api.github.com/users/blink1073/received_events","type":"User","site_admin":false},"repo":{"id":5300173,"name":"scikit-image","full_name":"blink1073/scikit-image","owner":{"login":"blink1073","id":2096628,"avatar_url":"https://avatars.githubusercontent.com/u/2096628?v=3","gravatar_id":"","url":"https://api.github.com/users/blink1073","html_url":"https://github.com/blink1073","followers_url":"https://api.github.com/users/blink1073/followers","following_url":"https://api.github.com/users/blink1073/following{/other_user}","gists_url":"https://api.github.com/users/blink1073/gists{/gist_id}","starred_url":"https://api.github.com/users/blink1073/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blink1073/subscriptions","organizations_url":"https://api.github.com/users/blink1073/orgs","repos_url":"https://api.github.com/users/blink1073/repos","events_url":"https://api.github.com/users/blink1073/events{/privacy}","received_events_url":"https://api.github.com/users/blink1073/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/blink1073/scikit-image","description":"Image Processing SciKit (Toolbox for SciPy)","fork":true,"url":"https://api.github.com/repos/blink1073/scikit-image","forks_url":"https://api.github.com/repos/blink1073/scikit-image/forks","keys_url":"https://api.github.com/repos/blink1073/scikit-image/keys{/key_id}","collaborators_url":"https://api.github.com/repos/blink1073/scikit-image/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/blink1073/scikit-image/teams","hooks_url":"https://api.github.com/repos/blink1073/scikit-image/hooks","issue_events_url":"https://api.github.com/repos/blink1073/scikit-image/issues/events{/number}","events_url":"https://api.github.com/repos/blink1073/scikit-image/events","assignees_url":"https://api.github.com/repos/blink1073/scikit-image/assignees{/user}","branches_url":"https://api.github.com/repos/blink1073/scikit-image/branches{/branch}","tags_url":"https://api.github.com/repos/blink1073/scikit-image/tags","blobs_url":"https://api.github.com/repos/blink1073/scikit-image/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/blink1073/scikit-image/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/blink1073/scikit-image/git/refs{/sha}","trees_url":"https://api.github.com/repos/blink1073/scikit-image/git/trees{/sha}","statuses_url":"https://api.github.com/repos/blink1073/scikit-image/statuses/{sha}","languages_url":"https://api.github.com/repos/blink1073/scikit-image/languages","stargazers_url":"https://api.github.com/repos/blink1073/scikit-image/stargazers","contributors_url":"https://api.github.com/repos/blink1073/scikit-image/contributors","subscribers_url":"https://api.github.com/repos/blink1073/scikit-image/subscribers","subscription_url":"https://api.github.com/repos/blink1073/scikit-image/subscription","commits_url":"https://api.github.com/repos/blink1073/scikit-image/commits{/sha}","git_commits_url":"https://api.github.com/repos/blink1073/scikit-image/git/commits{/sha}","comments_url":"https://api.github.com/repos/blink1073/scikit-image/comments{/number}","issue_comment_url":"https://api.github.com/repos/blink1073/scikit-image/issues/comments{/number}","contents_url":"https://api.github.com/repos/blink1073/scikit-image/contents/{+path}","compare_url":"https://api.github.com/repos/blink1073/scikit-image/compare/{base}...{head}","merges_url":"https://api.github.com/repos/blink1073/scikit-image/merges","archive_url":"https://api.github.com/repos/blink1073/scikit-image/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/blink1073/scikit-image/downloads","issues_url":"https://api.github.com/repos/blink1073/scikit-image/issues{/number}","pulls_url":"https://api.github.com/repos/blink1073/scikit-image/pulls{/number}","milestones_url":"https://api.github.com/repos/blink1073/scikit-image/milestones{/number}","notifications_url":"https://api.github.com/repos/blink1073/scikit-image/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/blink1073/scikit-image/labels{/name}","releases_url":"https://api.github.com/repos/blink1073/scikit-image/releases{/id}","created_at":"2012-08-05T01:31:30Z","updated_at":"2015-05-07T01:25:01Z","pushed_at":"2015-06-08T02:39:18Z","git_url":"git://github.com/blink1073/scikit-image.git","ssh_url":"git@github.com:blink1073/scikit-image.git","clone_url":"https://github.com/blink1073/scikit-image.git","svn_url":"https://github.com/blink1073/scikit-image","homepage":"http://scikit-image.org","size":41437,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"scikit-image:master","ref":"master","sha":"46057c489be95f90c75c5439894ed691f4675d44","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-06-05T18:58:19Z","pushed_at":"2015-06-08T07:17:19Z","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":67184,"stargazers_count":726,"watchers_count":726,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":371,"mirror_url":null,"open_issues_count":175,"forks":371,"open_issues":175,"watchers":726,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1547"},"html":{"href":"https://github.com/scikit-image/scikit-image/pull/1547"},"issue":{"href":"https://api.github.com/repos/scikit-image/scikit-image/issues/1547"},"comments":{"href":"https://api.github.com/repos/scikit-image/scikit-image/issues/1547/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1547/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/1547/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-image/scikit-image/statuses/3bcbbc05c05d5d3ccffd88d98c7f1693788d1f63"}}}}