{"action":"created","comment":{"url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/comments/52106195","id":52106195,"diff_hunk":"@@ -0,0 +1,75 @@\n+from __future__ import division, print_function, absolute_import\n+\n+import numpy as np\n+from ..util import img_as_ubyte\n+from ._skeletonize_3d_cy import _compute_thin_image\n+\n+\n+def skeletonize_3d(img):\n+    \"\"\"Compute the skeleton of a binary image.\n+\n+    Thinning is used to reduce each connected component in a binary image\n+    to a single-pixel wide skeleton.\n+\n+    Parameters\n+    ----------\n+    img : ndarray, 2D or 3D\n+        A binary image containing the objects to be skeletonized. Zeros\n+        represent background, nonzero values are foreground.\n+\n+    Returns\n+    -------\n+    skeleton : ndarray\n+        The thinned image.\n+\n+    See also\n+    --------\n+    skeletonize, medial_axis\n+\n+    Notes\n+    -----\n+    The method of [Lee94]_ uses an octree data structure to examine a 3x3x3\n+    neighborhood of a pixel. The algorithm proceeds by iteratively sweeping\n+    over the image, and removing pixels at each iteration until the image\n+    stops changing. Each iteration consists of two steps: first, a list of\n+    candidates for removal is assembled; then pixels from this list are\n+    rechecked sequentially, to better preserve connectivity of the image.\n+\n+    The algorithm this function implements is different from the algorithms\n+    used by either `skeletonize` or `medial_axis`, thus for 2D images the\n+    results produced by this function are generally different.\n+\n+    References\n+    ----------\n+    .. [Lee94] T.-C. Lee, R.L. Kashyap and C.-N. Chu, Building skeleton models\n+           via 3-D medial surface/axis thinning algorithms.\n+           Computer Vision, Graphics, and Image Processing, 56(6):462-478, 1994.\n+\n+    \"\"\"\n+    # make sure the image is 3D or 2D (if it is, temporarily upcast to 3D)\n+    if img.ndim < 2 or img.ndim > 3:\n+        raise ValueError('expect 2D, got ndim = %s' % img.ndim)\n+\n+    img = np.ascontiguousarray(img)\n+    img = img_as_ubyte(img, force_copy=False)\n+\n+    # make an in image 3D pad w/ zeros to simplify dealing w/ boundaries\n+    # NB: careful to not clobber the original *and* minimize copying\n+    if img.ndim == 2:\n+        img_o = np.pad(img[None, ...], pad_width=1, mode='constant')","path":"skimage/morphology/_skeletonize_3d.py","position":null,"original_position":59,"commit_id":"e5a8851e424ddf01adc9b87aa498fe003d6d49ef","original_commit_id":"4c4232d40fe1394c6a22aa4a7b46a9993aec6419","user":{"login":"soupault","id":1315589,"avatar_url":"https://avatars.githubusercontent.com/u/1315589?v=3","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},"body":"Yes, I'm aware about that. I personally prefer suggested alternative as it has higher support in case of any further changes of `numpy`.","created_at":"2016-02-06T19:22:53Z","updated_at":"2016-02-06T19:22:53Z","html_url":"https://github.com/scikit-image/scikit-image/pull/1923#discussion_r52106195","pull_request_url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1923","_links":{"self":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/comments/52106195"},"html":{"href":"https://github.com/scikit-image/scikit-image/pull/1923#discussion_r52106195"},"pull_request":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1923"}}},"pull_request":{"url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1923","id":58018984,"html_url":"https://github.com/scikit-image/scikit-image/pull/1923","diff_url":"https://github.com/scikit-image/scikit-image/pull/1923.diff","patch_url":"https://github.com/scikit-image/scikit-image/pull/1923.patch","issue_url":"https://api.github.com/repos/scikit-image/scikit-image/issues/1923","number":1923,"state":"open","locked":false,"title":"MRG: 3D skeletonization","user":{"login":"ev-br","id":2133832,"avatar_url":"https://avatars.githubusercontent.com/u/2133832?v=3","gravatar_id":"","url":"https://api.github.com/users/ev-br","html_url":"https://github.com/ev-br","followers_url":"https://api.github.com/users/ev-br/followers","following_url":"https://api.github.com/users/ev-br/following{/other_user}","gists_url":"https://api.github.com/users/ev-br/gists{/gist_id}","starred_url":"https://api.github.com/users/ev-br/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ev-br/subscriptions","organizations_url":"https://api.github.com/users/ev-br/orgs","repos_url":"https://api.github.com/users/ev-br/repos","events_url":"https://api.github.com/users/ev-br/events{/privacy}","received_events_url":"https://api.github.com/users/ev-br/received_events","type":"User","site_admin":false},"body":"Add a skeletonization algorithm for 2D and 3D images, based on the ImageJ Skeletonize3D plugin, http://fiji.sc/Skeletonize3D\r\n\r\nAs suggested by Stefan, this PR is a continuation of https://github.com/scikit-image/skeleton_3D/pull/3. \r\n(b00c6be and further commits were added after the review in https://github.com/scikit-image/skeleton_3D/pull/3).\r\n\r\nThis is WIP, as it needs at least\r\n\r\n- [x] documentation\r\n- [x] some more tests\r\n- [x] possibly some better name for the algorithm :-).\r\n\r\nSince this is my first scikit-image contribution, I'm sure there are lots of issues :-). For starters, I'm adding several data files for testing --- what is the policy here?\r\n\r\nThis PR also includes a tweak to the build system, which I'll submit as a separate PR in a minute for the ease of reviewing. If that other PR is merged separately, I'll rebase this one.\r\n","created_at":"2016-02-02T17:17:11Z","updated_at":"2016-02-06T19:22:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bcf22ae81a2e9915f3aabce3ea145444da4e3dee","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1923/commits","review_comments_url":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1923/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/1923/comments","statuses_url":"https://api.github.com/repos/scikit-image/scikit-image/statuses/e5a8851e424ddf01adc9b87aa498fe003d6d49ef","head":{"label":"ev-br:skel3d","ref":"skel3d","sha":"e5a8851e424ddf01adc9b87aa498fe003d6d49ef","user":{"login":"ev-br","id":2133832,"avatar_url":"https://avatars.githubusercontent.com/u/2133832?v=3","gravatar_id":"","url":"https://api.github.com/users/ev-br","html_url":"https://github.com/ev-br","followers_url":"https://api.github.com/users/ev-br/followers","following_url":"https://api.github.com/users/ev-br/following{/other_user}","gists_url":"https://api.github.com/users/ev-br/gists{/gist_id}","starred_url":"https://api.github.com/users/ev-br/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ev-br/subscriptions","organizations_url":"https://api.github.com/users/ev-br/orgs","repos_url":"https://api.github.com/users/ev-br/repos","events_url":"https://api.github.com/users/ev-br/events{/privacy}","received_events_url":"https://api.github.com/users/ev-br/received_events","type":"User","site_admin":false},"repo":{"id":50934926,"name":"scikit-image","full_name":"ev-br/scikit-image","owner":{"login":"ev-br","id":2133832,"avatar_url":"https://avatars.githubusercontent.com/u/2133832?v=3","gravatar_id":"","url":"https://api.github.com/users/ev-br","html_url":"https://github.com/ev-br","followers_url":"https://api.github.com/users/ev-br/followers","following_url":"https://api.github.com/users/ev-br/following{/other_user}","gists_url":"https://api.github.com/users/ev-br/gists{/gist_id}","starred_url":"https://api.github.com/users/ev-br/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ev-br/subscriptions","organizations_url":"https://api.github.com/users/ev-br/orgs","repos_url":"https://api.github.com/users/ev-br/repos","events_url":"https://api.github.com/users/ev-br/events{/privacy}","received_events_url":"https://api.github.com/users/ev-br/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ev-br/scikit-image","description":"Image Processing SciKit (Toolbox for SciPy)","fork":true,"url":"https://api.github.com/repos/ev-br/scikit-image","forks_url":"https://api.github.com/repos/ev-br/scikit-image/forks","keys_url":"https://api.github.com/repos/ev-br/scikit-image/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ev-br/scikit-image/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ev-br/scikit-image/teams","hooks_url":"https://api.github.com/repos/ev-br/scikit-image/hooks","issue_events_url":"https://api.github.com/repos/ev-br/scikit-image/issues/events{/number}","events_url":"https://api.github.com/repos/ev-br/scikit-image/events","assignees_url":"https://api.github.com/repos/ev-br/scikit-image/assignees{/user}","branches_url":"https://api.github.com/repos/ev-br/scikit-image/branches{/branch}","tags_url":"https://api.github.com/repos/ev-br/scikit-image/tags","blobs_url":"https://api.github.com/repos/ev-br/scikit-image/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ev-br/scikit-image/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ev-br/scikit-image/git/refs{/sha}","trees_url":"https://api.github.com/repos/ev-br/scikit-image/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ev-br/scikit-image/statuses/{sha}","languages_url":"https://api.github.com/repos/ev-br/scikit-image/languages","stargazers_url":"https://api.github.com/repos/ev-br/scikit-image/stargazers","contributors_url":"https://api.github.com/repos/ev-br/scikit-image/contributors","subscribers_url":"https://api.github.com/repos/ev-br/scikit-image/subscribers","subscription_url":"https://api.github.com/repos/ev-br/scikit-image/subscription","commits_url":"https://api.github.com/repos/ev-br/scikit-image/commits{/sha}","git_commits_url":"https://api.github.com/repos/ev-br/scikit-image/git/commits{/sha}","comments_url":"https://api.github.com/repos/ev-br/scikit-image/comments{/number}","issue_comment_url":"https://api.github.com/repos/ev-br/scikit-image/issues/comments{/number}","contents_url":"https://api.github.com/repos/ev-br/scikit-image/contents/{+path}","compare_url":"https://api.github.com/repos/ev-br/scikit-image/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ev-br/scikit-image/merges","archive_url":"https://api.github.com/repos/ev-br/scikit-image/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ev-br/scikit-image/downloads","issues_url":"https://api.github.com/repos/ev-br/scikit-image/issues{/number}","pulls_url":"https://api.github.com/repos/ev-br/scikit-image/pulls{/number}","milestones_url":"https://api.github.com/repos/ev-br/scikit-image/milestones{/number}","notifications_url":"https://api.github.com/repos/ev-br/scikit-image/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ev-br/scikit-image/labels{/name}","releases_url":"https://api.github.com/repos/ev-br/scikit-image/releases{/id}","deployments_url":"https://api.github.com/repos/ev-br/scikit-image/deployments","created_at":"2016-02-02T16:36:45Z","updated_at":"2016-02-02T16:36:46Z","pushed_at":"2016-02-06T18:47:52Z","git_url":"git://github.com/ev-br/scikit-image.git","ssh_url":"git@github.com:ev-br/scikit-image.git","clone_url":"https://github.com/ev-br/scikit-image.git","svn_url":"https://github.com/ev-br/scikit-image","homepage":"http://scikit-image.org","size":40603,"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":"056028d1f3f4a46853eaa9a521c08d60d3cf7efa","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}","deployments_url":"https://api.github.com/repos/scikit-image/scikit-image/deployments","created_at":"2011-07-07T22:07:20Z","updated_at":"2016-02-05T01:54:15Z","pushed_at":"2016-02-06T18:47:53Z","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":71436,"stargazers_count":975,"watchers_count":975,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":494,"mirror_url":null,"open_issues_count":224,"forks":494,"open_issues":224,"watchers":975,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1923"},"html":{"href":"https://github.com/scikit-image/scikit-image/pull/1923"},"issue":{"href":"https://api.github.com/repos/scikit-image/scikit-image/issues/1923"},"comments":{"href":"https://api.github.com/repos/scikit-image/scikit-image/issues/1923/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-image/scikit-image/pulls/1923/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/1923/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-image/scikit-image/statuses/e5a8851e424ddf01adc9b87aa498fe003d6d49ef"}}}}