{"action":"created","comment":{"url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/comments/61089608","id":61089608,"diff_hunk":"@@ -129,6 +144,157 @@ def FeatureExtraction(Label, I, K=128, Fs=6, Delta=8):\n     df['Extent'] = Extent\n     df['Solidity'] = Solidity\n \n-    # df.insert(0, 'Slide', SlideName)\n+    FSDGroup = FSDGroup.reshape(Num, Fs)\n+\n+    df['FSD1'] = FSDGroup[:, 0]\n+    df['FSD2'] = FSDGroup[:, 1]\n+    df['FSD3'] = FSDGroup[:, 2]\n+    df['FSD4'] = FSDGroup[:, 3]\n+    df['FSD5'] = FSDGroup[:, 4]\n+    df['FSD6'] = FSDGroup[:, 5]\n \n     return df\n+\n+\n+def GetBounds(bbox, delta, N):\n+    \"\"\"\n+    Returns bounds of object in global label image.\n+    \"\"\"\n+    bounds = np.zeros(4, dtype=np.int8)\n+    bounds[0] = max(0, math.floor(bbox[0] - delta))\n+    bounds[1] = min(N-1, math.ceil(bbox[0] + bbox[2] + delta))\n+    bounds[2] = max(0, math.floor(bbox[1] - delta))\n+    bounds[3] = min(N-1, math.ceil(bbox[1] + bbox[3] + delta))\n+\n+    return bounds\n+\n+\n+def InterpolateArcLength(X, Y, L):\n+    \"\"\"\n+    Resamples boundary points [X, Y] at L total equal arc-length locations.\n+\n+    Returns\n+    -------\n+    iX - L-length vector of horizontal interpolated coordinates with equal\n+         arc-length spacing.\n+    iY - L-length vector of vertical interpolated coordinates with equal\n+         arc-length spacing.\n+    \"\"\"\n+\n+    # length of X\n+    K = len(X)\n+\n+    # generate spaced points\n+    Interval = np.linspace(0, 1, L)\n+\n+    # get segment lengths\n+    Lengths = np.sqrt(\n+        np.power(np.diff(X), 2) + np.power(np.diff(Y), 2)\n+    )\n+\n+    # normalize to unit length\n+    Lengths = Lengths / Lengths.sum()\n+\n+    # calculate cumulative length along boundary\n+    Cumulative = np.hstack((0., np.cumsum(Lengths)))\n+\n+    # place points in 'Interval' along boundary\n+    Locations = np.digitize(Interval, Cumulative)\n+\n+    # clip to ends\n+    Locations[Locations < 1] = 1\n+    Locations[Locations >= K] = K - 1\n+    Locations = Locations - 1\n+\n+    # linear interpolation\n+    Lie = np.divide(\n+        (Interval - [Cumulative[i] for i in Locations]),\n+        [Lengths[i] for i in Locations]\n+    )\n+\n+    tX = np.array([X[i] for i in Locations])\n+    tY = np.array([Y[i] for i in Locations])\n+    iX = tX + np.multiply(\n+        np.array([X[i+1] for i in Locations]) - tX, Lie\n+    )\n+    iY = tY + np.multiply(\n+        np.array([Y[i+1] for i in Locations]) - tY, Lie\n+    )\n+\n+    iXY = collections.namedtuple('iXY', ['iX', 'iY'])\n+    Output = iXY(iX, iY)\n+\n+    return Output\n+\n+\n+def log2space(a, b, n):\n+    \"\"\"\n+    Returns n logarithmically-spaced points from 2^a to 2^b.\n+    \"\"\"\n+\n+    A = np.power(\n+        2, [a + x*(b-a)/(n-1) for x in range(0, n-1)]\n+    )\n+\n+    B = np.power(\n+        2, b\n+    )\n+\n+    A = np.hstack((A, B))\n+\n+    return A\n+\n+\n+def FSDs(X, Y, K, Intervals):\n+    \"\"\"\n+    Calculated FSDs from boundary points X,Y. Boundaries are resampled to have\n+    K equally spaced points (arclength) around the shape. The curvature is\n+    calculated using the cumulative angular function, measuring the\n+    displacement of the tangent angle from the starting point of the boundary.\n+    The K-length fft of the cumulative angular function is calculated, and\n+    then the elements of 'F' are summed as the spectral energy over\n+    'Intervals'.\n+","path":"histomicstk/FeatureExtraction.py","position":264,"original_position":264,"commit_id":"f419ac6d333b9f0e05c7a47e4e2346af32cdb439","original_commit_id":"f419ac6d333b9f0e05c7a47e4e2346af32cdb439","user":{"login":"cdeepakroy","id":1923534,"avatar_url":"https://avatars.githubusercontent.com/u/1923534?v=3","gravatar_id":"","url":"https://api.github.com/users/cdeepakroy","html_url":"https://github.com/cdeepakroy","followers_url":"https://api.github.com/users/cdeepakroy/followers","following_url":"https://api.github.com/users/cdeepakroy/following{/other_user}","gists_url":"https://api.github.com/users/cdeepakroy/gists{/gist_id}","starred_url":"https://api.github.com/users/cdeepakroy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdeepakroy/subscriptions","organizations_url":"https://api.github.com/users/cdeepakroy/orgs","repos_url":"https://api.github.com/users/cdeepakroy/repos","events_url":"https://api.github.com/users/cdeepakroy/events{/privacy}","received_events_url":"https://api.github.com/users/cdeepakroy/received_events","type":"User","site_admin":false},"body":"Add documentation/docstring for the inputs ","created_at":"2016-04-26T13:57:35Z","updated_at":"2016-04-26T13:57:35Z","html_url":"https://github.com/DigitalSlideArchive/HistomicsTK/pull/82#discussion_r61089608","pull_request_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/82","_links":{"self":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/comments/61089608"},"html":{"href":"https://github.com/DigitalSlideArchive/HistomicsTK/pull/82#discussion_r61089608"},"pull_request":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/82"}}},"pull_request":{"url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/82","id":67655770,"html_url":"https://github.com/DigitalSlideArchive/HistomicsTK/pull/82","diff_url":"https://github.com/DigitalSlideArchive/HistomicsTK/pull/82.diff","patch_url":"https://github.com/DigitalSlideArchive/HistomicsTK/pull/82.patch","issue_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/issues/82","number":82,"state":"open","locked":false,"title":"Feature extraction","user":{"login":"slee172","id":16363501,"avatar_url":"https://avatars.githubusercontent.com/u/16363501?v=3","gravatar_id":"","url":"https://api.github.com/users/slee172","html_url":"https://github.com/slee172","followers_url":"https://api.github.com/users/slee172/followers","following_url":"https://api.github.com/users/slee172/following{/other_user}","gists_url":"https://api.github.com/users/slee172/gists{/gist_id}","starred_url":"https://api.github.com/users/slee172/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slee172/subscriptions","organizations_url":"https://api.github.com/users/slee172/orgs","repos_url":"https://api.github.com/users/slee172/repos","events_url":"https://api.github.com/users/slee172/events{/privacy}","received_events_url":"https://api.github.com/users/slee172/received_events","type":"User","site_admin":false},"body":"- Update __init__.py\r\n- Update FeatureExtraction.py","created_at":"2016-04-25T00:50:24Z","updated_at":"2016-04-26T13:57:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"183518ffe3eaaf6355ee2879f2aca77b7e02ccb5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/82/commits","review_comments_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/82/comments","review_comment_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/issues/82/comments","statuses_url":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/statuses/f419ac6d333b9f0e05c7a47e4e2346af32cdb439","head":{"label":"DigitalSlideArchive:feature-extraction","ref":"feature-extraction","sha":"f419ac6d333b9f0e05c7a47e4e2346af32cdb439","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":"","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-04-15T17:44:05Z","pushed_at":"2016-04-25T21:22:55Z","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":null,"size":458,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":21,"forks":2,"open_issues":21,"watchers":4,"default_branch":"master"}},"base":{"label":"DigitalSlideArchive:master","ref":"master","sha":"f64304734f4a60c4a66eba4a3f6f9760a2fb7ae8","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":"","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-04-15T17:44:05Z","pushed_at":"2016-04-25T21:22:55Z","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":null,"size":458,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":21,"forks":2,"open_issues":21,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/82"},"html":{"href":"https://github.com/DigitalSlideArchive/HistomicsTK/pull/82"},"issue":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/issues/82"},"comments":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/issues/82/comments"},"review_comments":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/82/comments"},"review_comment":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/pulls/82/commits"},"statuses":{"href":"https://api.github.com/repos/DigitalSlideArchive/HistomicsTK/statuses/f419ac6d333b9f0e05c7a47e4e2346af32cdb439"}}}}