{"action":"created","comment":{"url":"https://api.github.com/repos/nipy/dipy/pulls/comments/81178578","pull_request_review_id":2177504,"id":81178578,"diff_hunk":"@@ -0,0 +1,114 @@\n+import numpy as np\n+import scipy as sp\n+\n+\n+def localpca(arr, sigma, patch_radius=1):\n+    r\"\"\"Local PCA Based Denoising of Diffusion Datasets\n+\n+    Parameters\n+    ----------\n+    arr : A 4D array which is to be denoised\n+    sigma : float or 3D array\n+        standard deviation of the noise estimated from the data\n+    patch_radius : The radius of the local patch to\n+                be taken around each voxel\n+\n+    Returns\n+    -------\n+    denoised_arr : 4D array\n+        this is the denoised array of the same size as that of\n+        arr (input data)\n+\n+    References\n+    ----------\n+    .. [Manjon13] Manjon JV, Coupe P, Concha L, Buades A, Collins DL\n+                  Diffusion Weighted Image Denoising Using Overcomplete Local\n+                  PCA, PLOS 2013\n+    \"\"\"\n+\n+    if arr.ndim == 4:\n+\n+        tou = 2.3 * 2.3 * sigma\n+\n+        if isinstance(sigma, np.ndarray) and sigma.ndim == 3:\n+\n+            sigma = (np.ones(arr.shape, dtype=np.float64)\n+                     * sigma[..., np.newaxis])\n+            tou = (np.ones(arr.shape, dtype=np.float64) * tou[..., np.newaxis])\n+        else:\n+            sigma = np.ones(arr.shape, dtype=np.float64) * sigma\n+            tou = np.ones(arr.shape, dtype=np.float64) * tou\n+\n+        # loop around and find the 3D patch for each direction at each pixel\n+\n+        # declare arrays for theta and thetax\n+        theta = np.zeros(arr.shape, dtype=np.float64)\n+        thetax = np.zeros(arr.shape, dtype=np.float64)\n+\n+        patch_size = 2 * patch_radius + 1","path":"dipy/denoise/localpca.py","position":48,"original_position":48,"commit_id":"85763d2c29590656e6d0f36bd4b2f96fa35f90b4","original_commit_id":"5cecc6755dcbe9bf2c7525090fb94ade9895406c","user":{"login":"samuelstjean","id":3030760,"avatar_url":"https://avatars.githubusercontent.com/u/3030760?v=3","gravatar_id":"","url":"https://api.github.com/users/samuelstjean","html_url":"https://github.com/samuelstjean","followers_url":"https://api.github.com/users/samuelstjean/followers","following_url":"https://api.github.com/users/samuelstjean/following{/other_user}","gists_url":"https://api.github.com/users/samuelstjean/gists{/gist_id}","starred_url":"https://api.github.com/users/samuelstjean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samuelstjean/subscriptions","organizations_url":"https://api.github.com/users/samuelstjean/orgs","repos_url":"https://api.github.com/users/samuelstjean/repos","events_url":"https://api.github.com/users/samuelstjean/events{/privacy}","received_events_url":"https://api.github.com/users/samuelstjean/received_events","type":"User","site_admin":false},"body":"This also means you don't need padding nor playing with negatives indices, you can juts feed the blocks directly to the pca.","created_at":"2016-09-29T16:31:44Z","updated_at":"2016-09-29T16:37:00Z","html_url":"https://github.com/nipy/dipy/pull/1108#discussion_r81178578","pull_request_url":"https://api.github.com/repos/nipy/dipy/pulls/1108","_links":{"self":{"href":"https://api.github.com/repos/nipy/dipy/pulls/comments/81178578"},"html":{"href":"https://github.com/nipy/dipy/pull/1108#discussion_r81178578"},"pull_request":{"href":"https://api.github.com/repos/nipy/dipy/pulls/1108"}}},"pull_request":{"url":"https://api.github.com/repos/nipy/dipy/pulls/1108","id":80569974,"html_url":"https://github.com/nipy/dipy/pull/1108","diff_url":"https://github.com/nipy/dipy/pull/1108.diff","patch_url":"https://github.com/nipy/dipy/pull/1108.patch","issue_url":"https://api.github.com/repos/nipy/dipy/issues/1108","number":1108,"state":"open","locked":false,"title":"Local PCA Slow Version","user":{"login":"riddhishb","id":7941975,"avatar_url":"https://avatars.githubusercontent.com/u/7941975?v=3","gravatar_id":"","url":"https://api.github.com/users/riddhishb","html_url":"https://github.com/riddhishb","followers_url":"https://api.github.com/users/riddhishb/followers","following_url":"https://api.github.com/users/riddhishb/following{/other_user}","gists_url":"https://api.github.com/users/riddhishb/gists{/gist_id}","starred_url":"https://api.github.com/users/riddhishb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riddhishb/subscriptions","organizations_url":"https://api.github.com/users/riddhishb/orgs","repos_url":"https://api.github.com/users/riddhishb/repos","events_url":"https://api.github.com/users/riddhishb/events{/privacy}","received_events_url":"https://api.github.com/users/riddhishb/received_events","type":"User","site_admin":false},"body":"Only the python implementation of the localPCA algorithm which is without bugs and can be merged. A separate PR will be made very soon to incorporate the cythonized version of this algorithm.\r\n\r\n@Garyfallidis Do have a look at this","created_at":"2016-08-09T06:54:05Z","updated_at":"2016-09-29T16:37:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d932a89f0fc8f02765e01aa74a76dd895f05a76e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/nipy/dipy/pulls/1108/commits","review_comments_url":"https://api.github.com/repos/nipy/dipy/pulls/1108/comments","review_comment_url":"https://api.github.com/repos/nipy/dipy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nipy/dipy/issues/1108/comments","statuses_url":"https://api.github.com/repos/nipy/dipy/statuses/85763d2c29590656e6d0f36bd4b2f96fa35f90b4","head":{"label":"riddhishb:localpca_slow","ref":"localpca_slow","sha":"85763d2c29590656e6d0f36bd4b2f96fa35f90b4","user":{"login":"riddhishb","id":7941975,"avatar_url":"https://avatars.githubusercontent.com/u/7941975?v=3","gravatar_id":"","url":"https://api.github.com/users/riddhishb","html_url":"https://github.com/riddhishb","followers_url":"https://api.github.com/users/riddhishb/followers","following_url":"https://api.github.com/users/riddhishb/following{/other_user}","gists_url":"https://api.github.com/users/riddhishb/gists{/gist_id}","starred_url":"https://api.github.com/users/riddhishb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riddhishb/subscriptions","organizations_url":"https://api.github.com/users/riddhishb/orgs","repos_url":"https://api.github.com/users/riddhishb/repos","events_url":"https://api.github.com/users/riddhishb/events{/privacy}","received_events_url":"https://api.github.com/users/riddhishb/received_events","type":"User","site_admin":false},"repo":{"id":53270078,"name":"dipy","full_name":"riddhishb/dipy","owner":{"login":"riddhishb","id":7941975,"avatar_url":"https://avatars.githubusercontent.com/u/7941975?v=3","gravatar_id":"","url":"https://api.github.com/users/riddhishb","html_url":"https://github.com/riddhishb","followers_url":"https://api.github.com/users/riddhishb/followers","following_url":"https://api.github.com/users/riddhishb/following{/other_user}","gists_url":"https://api.github.com/users/riddhishb/gists{/gist_id}","starred_url":"https://api.github.com/users/riddhishb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riddhishb/subscriptions","organizations_url":"https://api.github.com/users/riddhishb/orgs","repos_url":"https://api.github.com/users/riddhishb/repos","events_url":"https://api.github.com/users/riddhishb/events{/privacy}","received_events_url":"https://api.github.com/users/riddhishb/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/riddhishb/dipy","description":"Diffusion MR Imaging in Python","fork":true,"url":"https://api.github.com/repos/riddhishb/dipy","forks_url":"https://api.github.com/repos/riddhishb/dipy/forks","keys_url":"https://api.github.com/repos/riddhishb/dipy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/riddhishb/dipy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/riddhishb/dipy/teams","hooks_url":"https://api.github.com/repos/riddhishb/dipy/hooks","issue_events_url":"https://api.github.com/repos/riddhishb/dipy/issues/events{/number}","events_url":"https://api.github.com/repos/riddhishb/dipy/events","assignees_url":"https://api.github.com/repos/riddhishb/dipy/assignees{/user}","branches_url":"https://api.github.com/repos/riddhishb/dipy/branches{/branch}","tags_url":"https://api.github.com/repos/riddhishb/dipy/tags","blobs_url":"https://api.github.com/repos/riddhishb/dipy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/riddhishb/dipy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/riddhishb/dipy/git/refs{/sha}","trees_url":"https://api.github.com/repos/riddhishb/dipy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/riddhishb/dipy/statuses/{sha}","languages_url":"https://api.github.com/repos/riddhishb/dipy/languages","stargazers_url":"https://api.github.com/repos/riddhishb/dipy/stargazers","contributors_url":"https://api.github.com/repos/riddhishb/dipy/contributors","subscribers_url":"https://api.github.com/repos/riddhishb/dipy/subscribers","subscription_url":"https://api.github.com/repos/riddhishb/dipy/subscription","commits_url":"https://api.github.com/repos/riddhishb/dipy/commits{/sha}","git_commits_url":"https://api.github.com/repos/riddhishb/dipy/git/commits{/sha}","comments_url":"https://api.github.com/repos/riddhishb/dipy/comments{/number}","issue_comment_url":"https://api.github.com/repos/riddhishb/dipy/issues/comments{/number}","contents_url":"https://api.github.com/repos/riddhishb/dipy/contents/{+path}","compare_url":"https://api.github.com/repos/riddhishb/dipy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/riddhishb/dipy/merges","archive_url":"https://api.github.com/repos/riddhishb/dipy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/riddhishb/dipy/downloads","issues_url":"https://api.github.com/repos/riddhishb/dipy/issues{/number}","pulls_url":"https://api.github.com/repos/riddhishb/dipy/pulls{/number}","milestones_url":"https://api.github.com/repos/riddhishb/dipy/milestones{/number}","notifications_url":"https://api.github.com/repos/riddhishb/dipy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/riddhishb/dipy/labels{/name}","releases_url":"https://api.github.com/repos/riddhishb/dipy/releases{/id}","deployments_url":"https://api.github.com/repos/riddhishb/dipy/deployments","created_at":"2016-03-06T18:41:58Z","updated_at":"2016-03-06T18:42:01Z","pushed_at":"2016-09-29T15:35:08Z","git_url":"git://github.com/riddhishb/dipy.git","ssh_url":"git@github.com:riddhishb/dipy.git","clone_url":"https://github.com/riddhishb/dipy.git","svn_url":"https://github.com/riddhishb/dipy","homepage":"http://dipy.org","size":30911,"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":"nipy:master","ref":"master","sha":"31bc6fefc9fc8ef44e604e10757c23af0939c3bd","user":{"login":"nipy","id":233707,"avatar_url":"https://avatars.githubusercontent.com/u/233707?v=3","gravatar_id":"","url":"https://api.github.com/users/nipy","html_url":"https://github.com/nipy","followers_url":"https://api.github.com/users/nipy/followers","following_url":"https://api.github.com/users/nipy/following{/other_user}","gists_url":"https://api.github.com/users/nipy/gists{/gist_id}","starred_url":"https://api.github.com/users/nipy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nipy/subscriptions","organizations_url":"https://api.github.com/users/nipy/orgs","repos_url":"https://api.github.com/users/nipy/repos","events_url":"https://api.github.com/users/nipy/events{/privacy}","received_events_url":"https://api.github.com/users/nipy/received_events","type":"Organization","site_admin":false},"repo":{"id":505209,"name":"dipy","full_name":"nipy/dipy","owner":{"login":"nipy","id":233707,"avatar_url":"https://avatars.githubusercontent.com/u/233707?v=3","gravatar_id":"","url":"https://api.github.com/users/nipy","html_url":"https://github.com/nipy","followers_url":"https://api.github.com/users/nipy/followers","following_url":"https://api.github.com/users/nipy/following{/other_user}","gists_url":"https://api.github.com/users/nipy/gists{/gist_id}","starred_url":"https://api.github.com/users/nipy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nipy/subscriptions","organizations_url":"https://api.github.com/users/nipy/orgs","repos_url":"https://api.github.com/users/nipy/repos","events_url":"https://api.github.com/users/nipy/events{/privacy}","received_events_url":"https://api.github.com/users/nipy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nipy/dipy","description":"Diffusion MR Imaging in Python","fork":false,"url":"https://api.github.com/repos/nipy/dipy","forks_url":"https://api.github.com/repos/nipy/dipy/forks","keys_url":"https://api.github.com/repos/nipy/dipy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nipy/dipy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nipy/dipy/teams","hooks_url":"https://api.github.com/repos/nipy/dipy/hooks","issue_events_url":"https://api.github.com/repos/nipy/dipy/issues/events{/number}","events_url":"https://api.github.com/repos/nipy/dipy/events","assignees_url":"https://api.github.com/repos/nipy/dipy/assignees{/user}","branches_url":"https://api.github.com/repos/nipy/dipy/branches{/branch}","tags_url":"https://api.github.com/repos/nipy/dipy/tags","blobs_url":"https://api.github.com/repos/nipy/dipy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nipy/dipy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nipy/dipy/git/refs{/sha}","trees_url":"https://api.github.com/repos/nipy/dipy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nipy/dipy/statuses/{sha}","languages_url":"https://api.github.com/repos/nipy/dipy/languages","stargazers_url":"https://api.github.com/repos/nipy/dipy/stargazers","contributors_url":"https://api.github.com/repos/nipy/dipy/contributors","subscribers_url":"https://api.github.com/repos/nipy/dipy/subscribers","subscription_url":"https://api.github.com/repos/nipy/dipy/subscription","commits_url":"https://api.github.com/repos/nipy/dipy/commits{/sha}","git_commits_url":"https://api.github.com/repos/nipy/dipy/git/commits{/sha}","comments_url":"https://api.github.com/repos/nipy/dipy/comments{/number}","issue_comment_url":"https://api.github.com/repos/nipy/dipy/issues/comments{/number}","contents_url":"https://api.github.com/repos/nipy/dipy/contents/{+path}","compare_url":"https://api.github.com/repos/nipy/dipy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nipy/dipy/merges","archive_url":"https://api.github.com/repos/nipy/dipy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nipy/dipy/downloads","issues_url":"https://api.github.com/repos/nipy/dipy/issues{/number}","pulls_url":"https://api.github.com/repos/nipy/dipy/pulls{/number}","milestones_url":"https://api.github.com/repos/nipy/dipy/milestones{/number}","notifications_url":"https://api.github.com/repos/nipy/dipy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nipy/dipy/labels{/name}","releases_url":"https://api.github.com/repos/nipy/dipy/releases{/id}","deployments_url":"https://api.github.com/repos/nipy/dipy/deployments","created_at":"2010-02-06T11:43:08Z","updated_at":"2016-09-29T12:30:11Z","pushed_at":"2016-09-29T15:35:09Z","git_url":"git://github.com/nipy/dipy.git","ssh_url":"git@github.com:nipy/dipy.git","clone_url":"https://github.com/nipy/dipy.git","svn_url":"https://github.com/nipy/dipy","homepage":"http://dipy.org","size":42064,"stargazers_count":98,"watchers_count":98,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":147,"mirror_url":null,"open_issues_count":154,"forks":147,"open_issues":154,"watchers":98,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nipy/dipy/pulls/1108"},"html":{"href":"https://github.com/nipy/dipy/pull/1108"},"issue":{"href":"https://api.github.com/repos/nipy/dipy/issues/1108"},"comments":{"href":"https://api.github.com/repos/nipy/dipy/issues/1108/comments"},"review_comments":{"href":"https://api.github.com/repos/nipy/dipy/pulls/1108/comments"},"review_comment":{"href":"https://api.github.com/repos/nipy/dipy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nipy/dipy/pulls/1108/commits"},"statuses":{"href":"https://api.github.com/repos/nipy/dipy/statuses/85763d2c29590656e6d0f36bd4b2f96fa35f90b4"}}}}
{"actor":{"display_login":"samuelstjean"}}