{"action":"created","comment":{"url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/comments/70154967","id":70154967,"diff_hunk":"@@ -0,0 +1,58 @@\n+import histomicstk as htk\n+import numpy as np\n+import scipy.ndimage.measurements as ms\n+\n+\n+def AreaOpenLabel(Label, Area):\n+    \"\"\"Removes small objects from label image.\n+\n+    Parameters:\n+    -----------\n+    Label : array_like\n+        A uint32 type label image generated by segmentation methods.\n+    Area : int\n+        Area threshold for objects. Objects with fewer than 'Area' pixels will\n+        be zeroed to merge with background.\n+\n+    Notes:\n+    ------\n+    Objects are assumed to have positive nonzero values. Label image will be\n+    condensed during processing.\n+\n+    Returns:\n+    --------\n+    Split : array_like\n+        A uint32 label where objects with pixels < Area are removed.\n+\n+    See Also:\n+    ---------\n+    CondenseLabel, ShuffleLabel, SplitLabel, MaxwidthOpenLabel\n+    \"\"\"\n+\n+    # copy input image\n+    Opened = Label.copy()\n+\n+    # condense label image\n+    if np.unique(Opened).size-1 != Opened.max():\n+        Opened = htk.CondenseLabel(Opened)\n+\n+    # count pixels in each object\n+    Counts, Edges = np.histogram(Opened, bins=Opened.max()+1)\n+\n+    # get locations of objects in initial image\n+    Locations = ms.find_objects(Opened)\n+\n+    # iterate through objects, zeroing where needed\n+    for i in np.arange(1, Counts.size):\n+        if Counts[i] < Area:\n+\n+            # extract object from label image\n+            Template = Opened[Locations[i-1]]\n+\n+            # label mask of object 'i'\n+            Template[Template == i] = 0\n+\n+    # condense to fill gaps\n+    Opened = htk.CondenseLabel(Opened)\n+\n+    return Opened","path":"histomicstk/AreaOpenLabel.py","position":58,"original_position":58,"commit_id":"0225e7cc489e8affafc7a994f3e4df8eefd06312","original_commit_id":"0225e7cc489e8affafc7a994f3e4df8eefd06312","user":{"login":"cooperlab","id":1437329,"avatar_url":"https://avatars.githubusercontent.com/u/1437329?v=3","gravatar_id":"","url":"https://api.github.com/users/cooperlab","html_url":"https://github.com/cooperlab","followers_url":"https://api.github.com/users/cooperlab/followers","following_url":"https://api.github.com/users/cooperlab/following{/other_user}","gists_url":"https://api.github.com/users/cooperlab/gists{/gist_id}","starred_url":"https://api.github.com/users/cooperlab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cooperlab/subscriptions","organizations_url":"https://api.github.com/users/cooperlab/orgs","repos_url":"https://api.github.com/users/cooperlab/repos","events_url":"https://api.github.com/users/cooperlab/events{/privacy}","received_events_url":"https://api.github.com/users/cooperlab/received_events","type":"User","site_admin":false},"body":"Yea - the scikit-image regionprops is fairly fast though. I think we are getting close to to having the functionality needed to replicate these features trivially.","created_at":"2016-07-08T23:30:57Z","updated_at":"2016-07-08T23:30:57Z","html_url":"https://github.com/DigitalSlideArchive/HistomicsTK/pull/119#discussion_r70154967","pull_request_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/119","_links":{"self":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/comments/70154967"},"html":{"href":"https://github.com/DigitalSlideArchive/HistomicsTK/pull/119#discussion_r70154967"},"pull_request":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/119"}}},"pull_request":{"url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/119","id":76626272,"html_url":"https://github.com/DigitalSlideArchive/HistomicsTK/pull/119","diff_url":"https://github.com/DigitalSlideArchive/HistomicsTK/pull/119.diff","patch_url":"https://github.com/DigitalSlideArchive/HistomicsTK/pull/119.patch","issue_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/issues/119","number":119,"state":"open","locked":false,"title":"Minimum-model nuclear segmentation","user":{"login":"cooperlab","id":1437329,"avatar_url":"https://avatars.githubusercontent.com/u/1437329?v=3","gravatar_id":"","url":"https://api.github.com/users/cooperlab","html_url":"https://github.com/cooperlab","followers_url":"https://api.github.com/users/cooperlab/followers","following_url":"https://api.github.com/users/cooperlab/following{/other_user}","gists_url":"https://api.github.com/users/cooperlab/gists{/gist_id}","starred_url":"https://api.github.com/users/cooperlab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cooperlab/subscriptions","organizations_url":"https://api.github.com/users/cooperlab/orgs","repos_url":"https://api.github.com/users/cooperlab/repos","events_url":"https://api.github.com/users/cooperlab/events{/privacy}","received_events_url":"https://api.github.com/users/cooperlab/received_events","type":"User","site_admin":false},"body":"Functions for minimum model nuclear segmentation and label image cleanup.","created_at":"2016-07-07T16:31:24Z","updated_at":"2016-07-08T23:30:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"825cfd3745d15684606ca7e356179d7493501121","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/119/commits","review_comments_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/119/comments","review_comment_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/issues/119/comments","statuses_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/statuses/0225e7cc489e8affafc7a994f3e4df8eefd06312","head":{"label":"DigitalSlideArchive:minimum-model","ref":"minimum-model","sha":"0225e7cc489e8affafc7a994f3e4df8eefd06312","user":{"login":"DigitalSlideArchive","id":13769637,"avatar_url":"https://avatars.githubusercontent.com/u/13769637?v=3","gravatar_id":"","url":"https://api.github.com/users/DigitalSlideArchive","html_url":"https://github.com/DigitalSlideArchive","followers_url":"https://api.github.com/users/DigitalSlideArchive/followers","following_url":"https://api.github.com/users/DigitalSlideArchive/following{/other_user}","gists_url":"https://api.github.com/users/DigitalSlideArchive/gists{/gist_id}","starred_url":"https://api.github.com/users/DigitalSlideArchive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DigitalSlideArchive/subscriptions","organizations_url":"https://api.github.com/users/DigitalSlideArchive/orgs","repos_url":"https://api.github.com/users/DigitalSlideArchive/repos","events_url":"https://api.github.com/users/DigitalSlideArchive/events{/privacy}","received_events_url":"https://api.github.com/users/DigitalSlideArchive/received_events","type":"Organization","site_admin":false},"repo":{"id":44324447,"name":"HistomicsTK","full_name":"DigitalSlideArchive/HistomicsTK","owner":{"login":"DigitalSlideArchive","id":13769637,"avatar_url":"https://avatars.githubusercontent.com/u/13769637?v=3","gravatar_id":"","url":"https://api.github.com/users/DigitalSlideArchive","html_url":"https://github.com/DigitalSlideArchive","followers_url":"https://api.github.com/users/DigitalSlideArchive/followers","following_url":"https://api.github.com/users/DigitalSlideArchive/following{/other_user}","gists_url":"https://api.github.com/users/DigitalSlideArchive/gists{/gist_id}","starred_url":"https://api.github.com/users/DigitalSlideArchive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DigitalSlideArchive/subscriptions","organizations_url":"https://api.github.com/users/DigitalSlideArchive/orgs","repos_url":"https://api.github.com/users/DigitalSlideArchive/repos","events_url":"https://api.github.com/users/DigitalSlideArchive/events{/privacy}","received_events_url":"https://api.github.com/users/DigitalSlideArchive/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DigitalSlideArchive/HistomicsTK","description":"A Python and REST API for Histopathology Image Analysis","fork":false,"url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK","forks_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/forks","keys_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/teams","hooks_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/hooks","issue_events_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/issues/events{/number}","events_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/events","assignees_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/assignees{/user}","branches_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/branches{/branch}","tags_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/tags","blobs_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/git/refs{/sha}","trees_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/statuses/{sha}","languages_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/languages","stargazers_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/stargazers","contributors_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/contributors","subscribers_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/subscribers","subscription_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/subscription","commits_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/commits{/sha}","git_commits_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/git/commits{/sha}","comments_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/comments{/number}","issue_comment_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/issues/comments{/number}","contents_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/contents/{+path}","compare_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/merges","archive_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/downloads","issues_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/issues{/number}","pulls_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls{/number}","milestones_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/milestones{/number}","notifications_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/labels{/name}","releases_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/releases{/id}","deployments_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/deployments","created_at":"2015-10-15T14:49:21Z","updated_at":"2016-07-05T15:24:59Z","pushed_at":"2016-07-08T22:48:22Z","git_url":"git://github.com/DigitalSlideArchive/HistomicsTK.git","ssh_url":"git@github.com:DigitalSlideArchive/HistomicsTK.git","clone_url":"https://github.com/DigitalSlideArchive/HistomicsTK.git","svn_url":"https://github.com/DigitalSlideArchive/HistomicsTK","homepage":"","size":14121,"stargazers_count":7,"watchers_count":7,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":18,"forks":3,"open_issues":18,"watchers":7,"default_branch":"master"}},"base":{"label":"DigitalSlideArchive:master","ref":"master","sha":"1010b418f7878576709019d6f0f08fdd50764831","user":{"login":"DigitalSlideArchive","id":13769637,"avatar_url":"https://avatars.githubusercontent.com/u/13769637?v=3","gravatar_id":"","url":"https://api.github.com/users/DigitalSlideArchive","html_url":"https://github.com/DigitalSlideArchive","followers_url":"https://api.github.com/users/DigitalSlideArchive/followers","following_url":"https://api.github.com/users/DigitalSlideArchive/following{/other_user}","gists_url":"https://api.github.com/users/DigitalSlideArchive/gists{/gist_id}","starred_url":"https://api.github.com/users/DigitalSlideArchive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DigitalSlideArchive/subscriptions","organizations_url":"https://api.github.com/users/DigitalSlideArchive/orgs","repos_url":"https://api.github.com/users/DigitalSlideArchive/repos","events_url":"https://api.github.com/users/DigitalSlideArchive/events{/privacy}","received_events_url":"https://api.github.com/users/DigitalSlideArchive/received_events","type":"Organization","site_admin":false},"repo":{"id":44324447,"name":"HistomicsTK","full_name":"DigitalSlideArchive/HistomicsTK","owner":{"login":"DigitalSlideArchive","id":13769637,"avatar_url":"https://avatars.githubusercontent.com/u/13769637?v=3","gravatar_id":"","url":"https://api.github.com/users/DigitalSlideArchive","html_url":"https://github.com/DigitalSlideArchive","followers_url":"https://api.github.com/users/DigitalSlideArchive/followers","following_url":"https://api.github.com/users/DigitalSlideArchive/following{/other_user}","gists_url":"https://api.github.com/users/DigitalSlideArchive/gists{/gist_id}","starred_url":"https://api.github.com/users/DigitalSlideArchive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DigitalSlideArchive/subscriptions","organizations_url":"https://api.github.com/users/DigitalSlideArchive/orgs","repos_url":"https://api.github.com/users/DigitalSlideArchive/repos","events_url":"https://api.github.com/users/DigitalSlideArchive/events{/privacy}","received_events_url":"https://api.github.com/users/DigitalSlideArchive/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DigitalSlideArchive/HistomicsTK","description":"A Python and REST API for Histopathology Image Analysis","fork":false,"url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK","forks_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/forks","keys_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/teams","hooks_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/hooks","issue_events_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/issues/events{/number}","events_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/events","assignees_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/assignees{/user}","branches_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/branches{/branch}","tags_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/tags","blobs_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/git/refs{/sha}","trees_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/statuses/{sha}","languages_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/languages","stargazers_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/stargazers","contributors_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/contributors","subscribers_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/subscribers","subscription_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/subscription","commits_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/commits{/sha}","git_commits_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/git/commits{/sha}","comments_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/comments{/number}","issue_comment_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/issues/comments{/number}","contents_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/contents/{+path}","compare_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/merges","archive_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/downloads","issues_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/issues{/number}","pulls_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls{/number}","milestones_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/milestones{/number}","notifications_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/labels{/name}","releases_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/releases{/id}","deployments_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/deployments","created_at":"2015-10-15T14:49:21Z","updated_at":"2016-07-05T15:24:59Z","pushed_at":"2016-07-08T22:48:22Z","git_url":"git://github.com/DigitalSlideArchive/HistomicsTK.git","ssh_url":"git@github.com:DigitalSlideArchive/HistomicsTK.git","clone_url":"https://github.com/DigitalSlideArchive/HistomicsTK.git","svn_url":"https://github.com/DigitalSlideArchive/HistomicsTK","homepage":"","size":14121,"stargazers_count":7,"watchers_count":7,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":18,"forks":3,"open_issues":18,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/119"},"html":{"href":"https://github.com/DigitalSlideArchive/HistomicsTK/pull/119"},"issue":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/issues/119"},"comments":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/issues/119/comments"},"review_comments":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/119/comments"},"review_comment":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/119/commits"},"statuses":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/statuses/0225e7cc489e8affafc7a994f3e4df8eefd06312"}}}}
{"actor":{"display_login":"cooperlab"}}