{"action":"created","comment":{"url":"https://api.github.com/repos/nilearn/nilearn/pulls/comments/25416812","id":25416812,"diff_hunk":"@@ -0,0 +1,234 @@\n+\"\"\"\n+Transformer for computing seeds signals.\n+\"\"\"\n+\n+import numpy as np\n+\n+from sklearn.base import BaseEstimator, TransformerMixin\n+from sklearn.externals.joblib import Memory\n+\n+from .. import _utils\n+from .._utils import logger, CacheMixin\n+from .._utils.niimg_conversions import check_niimg\n+from .. import signal\n+from .. import image\n+from .. import masking\n+\n+\n+def _signals_from_seeds(seeds, niimg, radius=None, mask_img=None):\n+    \"\"\" Note: this function is sub-optimal for small radius\n+    \"\"\"\n+    n_seeds = len(seeds)\n+    niimg = check_niimg(niimg)\n+    shape = niimg.get_data().shape\n+    affine = niimg.get_affine()\n+    if mask_img is not None:\n+        mask_img = check_niimg(mask_img, ensure_3d=True)\n+        mask_img = image.resample_img(mask_img, target_affine=affine,\n+                                      target_shape=shape[:3],\n+                                      interpolation='nearest')\n+        mask, _ = masking._load_mask_img(mask_img)\n+    signals = np.empty((shape[3], n_seeds))\n+    # Create an array of shape (3, array.shape) containing the i, j, k indices\n+    # in voxel space","path":"nilearn/input_data/nifti_spheres_masker.py","position":33,"original_position":33,"commit_id":"492b7563d5fcc49f3b59ced8072e7f0bb661ee90","original_commit_id":"492b7563d5fcc49f3b59ced8072e7f0bb661ee90","user":{"login":"AlexandreAbraham","id":1647301,"avatar_url":"https://avatars.githubusercontent.com/u/1647301?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexandreAbraham","html_url":"https://github.com/AlexandreAbraham","followers_url":"https://api.github.com/users/AlexandreAbraham/followers","following_url":"https://api.github.com/users/AlexandreAbraham/following{/other_user}","gists_url":"https://api.github.com/users/AlexandreAbraham/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexandreAbraham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexandreAbraham/subscriptions","organizations_url":"https://api.github.com/users/AlexandreAbraham/orgs","repos_url":"https://api.github.com/users/AlexandreAbraham/repos","events_url":"https://api.github.com/users/AlexandreAbraham/events{/privacy}","received_events_url":"https://api.github.com/users/AlexandreAbraham/received_events","type":"User","site_admin":false},"body":"I don't get your remark. Can you elaborate?","created_at":"2015-02-26T10:22:58Z","updated_at":"2015-02-26T10:22:58Z","html_url":"https://github.com/nilearn/nilearn/pull/430#discussion_r25416812","pull_request_url":"https://api.github.com/repos/nilearn/nilearn/pulls/430","_links":{"self":{"href":"https://api.github.com/repos/nilearn/nilearn/pulls/comments/25416812"},"html":{"href":"https://github.com/nilearn/nilearn/pull/430#discussion_r25416812"},"pull_request":{"href":"https://api.github.com/repos/nilearn/nilearn/pulls/430"}}},"pull_request":{"url":"https://api.github.com/repos/nilearn/nilearn/pulls/430","id":29338196,"html_url":"https://github.com/nilearn/nilearn/pull/430","diff_url":"https://github.com/nilearn/nilearn/pull/430.diff","patch_url":"https://github.com/nilearn/nilearn/pull/430.patch","issue_url":"https://api.github.com/repos/nilearn/nilearn/issues/430","number":430,"state":"open","locked":false,"title":"Nifti spheres masker","user":{"login":"AlexandreAbraham","id":1647301,"avatar_url":"https://avatars.githubusercontent.com/u/1647301?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexandreAbraham","html_url":"https://github.com/AlexandreAbraham","followers_url":"https://api.github.com/users/AlexandreAbraham/followers","following_url":"https://api.github.com/users/AlexandreAbraham/following{/other_user}","gists_url":"https://api.github.com/users/AlexandreAbraham/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexandreAbraham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexandreAbraham/subscriptions","organizations_url":"https://api.github.com/users/AlexandreAbraham/orgs","repos_url":"https://api.github.com/users/AlexandreAbraham/repos","events_url":"https://api.github.com/users/AlexandreAbraham/events{/privacy}","received_events_url":"https://api.github.com/users/AlexandreAbraham/received_events","type":"User","site_admin":false},"body":"Addresses #353.\r\n\r\nWhat is left to do:\r\n- [x] Improve code coverage if possible\r\n- [x] Decide what to do if seed is outside of fov (ATM, it will select the closest voxel, meaning one valid voxel on the edge). Suggested behavior: if the seed is too far from the edge, raise an error.\r\n- [x] Edit: add mask handling. If some voxels are in a ball but outside of the mask, they shouldn't be considered.\r\n- [ ] Decide what to do in case of duplicate in the seeds (this can be an unwanted behavior if two seeds are close and the resolution of the data is low)\r\n- [ ] Add documentation\r\n- [ ] Add example","created_at":"2015-02-15T17:59:01Z","updated_at":"2015-02-26T10:22:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"387e255100f2e258c8bfa065649c38eebd07e050","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nilearn/nilearn/pulls/430/commits","review_comments_url":"https://api.github.com/repos/nilearn/nilearn/pulls/430/comments","review_comment_url":"https://api.github.com/repos/nilearn/nilearn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nilearn/nilearn/issues/430/comments","statuses_url":"https://api.github.com/repos/nilearn/nilearn/statuses/492b7563d5fcc49f3b59ced8072e7f0bb661ee90","head":{"label":"AlexandreAbraham:nifti_spheres_masker","ref":"nifti_spheres_masker","sha":"492b7563d5fcc49f3b59ced8072e7f0bb661ee90","user":{"login":"AlexandreAbraham","id":1647301,"avatar_url":"https://avatars.githubusercontent.com/u/1647301?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexandreAbraham","html_url":"https://github.com/AlexandreAbraham","followers_url":"https://api.github.com/users/AlexandreAbraham/followers","following_url":"https://api.github.com/users/AlexandreAbraham/following{/other_user}","gists_url":"https://api.github.com/users/AlexandreAbraham/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexandreAbraham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexandreAbraham/subscriptions","organizations_url":"https://api.github.com/users/AlexandreAbraham/orgs","repos_url":"https://api.github.com/users/AlexandreAbraham/repos","events_url":"https://api.github.com/users/AlexandreAbraham/events{/privacy}","received_events_url":"https://api.github.com/users/AlexandreAbraham/received_events","type":"User","site_admin":false},"repo":{"id":4038777,"name":"nilearn","full_name":"AlexandreAbraham/nilearn","owner":{"login":"AlexandreAbraham","id":1647301,"avatar_url":"https://avatars.githubusercontent.com/u/1647301?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexandreAbraham","html_url":"https://github.com/AlexandreAbraham","followers_url":"https://api.github.com/users/AlexandreAbraham/followers","following_url":"https://api.github.com/users/AlexandreAbraham/following{/other_user}","gists_url":"https://api.github.com/users/AlexandreAbraham/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexandreAbraham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexandreAbraham/subscriptions","organizations_url":"https://api.github.com/users/AlexandreAbraham/orgs","repos_url":"https://api.github.com/users/AlexandreAbraham/repos","events_url":"https://api.github.com/users/AlexandreAbraham/events{/privacy}","received_events_url":"https://api.github.com/users/AlexandreAbraham/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AlexandreAbraham/nilearn","description":"NeuroImaging with the Scikit-learn: fMRI inverse inference tutorial","fork":true,"url":"https://api.github.com/repos/AlexandreAbraham/nilearn","forks_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/forks","keys_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/teams","hooks_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/hooks","issue_events_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/issues/events{/number}","events_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/events","assignees_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/assignees{/user}","branches_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/branches{/branch}","tags_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/tags","blobs_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/git/refs{/sha}","trees_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/statuses/{sha}","languages_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/languages","stargazers_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/stargazers","contributors_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/contributors","subscribers_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/subscribers","subscription_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/subscription","commits_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/commits{/sha}","git_commits_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/git/commits{/sha}","comments_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/comments{/number}","issue_comment_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/issues/comments{/number}","contents_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/contents/{+path}","compare_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/merges","archive_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/downloads","issues_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/issues{/number}","pulls_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/pulls{/number}","milestones_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/milestones{/number}","notifications_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/labels{/name}","releases_url":"https://api.github.com/repos/AlexandreAbraham/nilearn/releases{/id}","created_at":"2012-04-16T08:08:33Z","updated_at":"2015-02-17T21:56:48Z","pushed_at":"2015-02-17T22:35:56Z","git_url":"git://github.com/AlexandreAbraham/nilearn.git","ssh_url":"git@github.com:AlexandreAbraham/nilearn.git","clone_url":"https://github.com/AlexandreAbraham/nilearn.git","svn_url":"https://github.com/AlexandreAbraham/nilearn","homepage":"http://nisl.github.com/","size":6633,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":7,"forks":1,"open_issues":7,"watchers":4,"default_branch":"master"}},"base":{"label":"nilearn:master","ref":"master","sha":"4ecf57695e3166f1157aa62220b25a0d00128200","user":{"login":"nilearn","id":4646912,"avatar_url":"https://avatars.githubusercontent.com/u/4646912?v=3","gravatar_id":"","url":"https://api.github.com/users/nilearn","html_url":"https://github.com/nilearn","followers_url":"https://api.github.com/users/nilearn/followers","following_url":"https://api.github.com/users/nilearn/following{/other_user}","gists_url":"https://api.github.com/users/nilearn/gists{/gist_id}","starred_url":"https://api.github.com/users/nilearn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nilearn/subscriptions","organizations_url":"https://api.github.com/users/nilearn/orgs","repos_url":"https://api.github.com/users/nilearn/repos","events_url":"https://api.github.com/users/nilearn/events{/privacy}","received_events_url":"https://api.github.com/users/nilearn/received_events","type":"Organization","site_admin":false},"repo":{"id":1235740,"name":"nilearn","full_name":"nilearn/nilearn","owner":{"login":"nilearn","id":4646912,"avatar_url":"https://avatars.githubusercontent.com/u/4646912?v=3","gravatar_id":"","url":"https://api.github.com/users/nilearn","html_url":"https://github.com/nilearn","followers_url":"https://api.github.com/users/nilearn/followers","following_url":"https://api.github.com/users/nilearn/following{/other_user}","gists_url":"https://api.github.com/users/nilearn/gists{/gist_id}","starred_url":"https://api.github.com/users/nilearn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nilearn/subscriptions","organizations_url":"https://api.github.com/users/nilearn/orgs","repos_url":"https://api.github.com/users/nilearn/repos","events_url":"https://api.github.com/users/nilearn/events{/privacy}","received_events_url":"https://api.github.com/users/nilearn/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nilearn/nilearn","description":"Machine learning for NeuroImaging in Python","fork":false,"url":"https://api.github.com/repos/nilearn/nilearn","forks_url":"https://api.github.com/repos/nilearn/nilearn/forks","keys_url":"https://api.github.com/repos/nilearn/nilearn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nilearn/nilearn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nilearn/nilearn/teams","hooks_url":"https://api.github.com/repos/nilearn/nilearn/hooks","issue_events_url":"https://api.github.com/repos/nilearn/nilearn/issues/events{/number}","events_url":"https://api.github.com/repos/nilearn/nilearn/events","assignees_url":"https://api.github.com/repos/nilearn/nilearn/assignees{/user}","branches_url":"https://api.github.com/repos/nilearn/nilearn/branches{/branch}","tags_url":"https://api.github.com/repos/nilearn/nilearn/tags","blobs_url":"https://api.github.com/repos/nilearn/nilearn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nilearn/nilearn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nilearn/nilearn/git/refs{/sha}","trees_url":"https://api.github.com/repos/nilearn/nilearn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nilearn/nilearn/statuses/{sha}","languages_url":"https://api.github.com/repos/nilearn/nilearn/languages","stargazers_url":"https://api.github.com/repos/nilearn/nilearn/stargazers","contributors_url":"https://api.github.com/repos/nilearn/nilearn/contributors","subscribers_url":"https://api.github.com/repos/nilearn/nilearn/subscribers","subscription_url":"https://api.github.com/repos/nilearn/nilearn/subscription","commits_url":"https://api.github.com/repos/nilearn/nilearn/commits{/sha}","git_commits_url":"https://api.github.com/repos/nilearn/nilearn/git/commits{/sha}","comments_url":"https://api.github.com/repos/nilearn/nilearn/comments{/number}","issue_comment_url":"https://api.github.com/repos/nilearn/nilearn/issues/comments{/number}","contents_url":"https://api.github.com/repos/nilearn/nilearn/contents/{+path}","compare_url":"https://api.github.com/repos/nilearn/nilearn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nilearn/nilearn/merges","archive_url":"https://api.github.com/repos/nilearn/nilearn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nilearn/nilearn/downloads","issues_url":"https://api.github.com/repos/nilearn/nilearn/issues{/number}","pulls_url":"https://api.github.com/repos/nilearn/nilearn/pulls{/number}","milestones_url":"https://api.github.com/repos/nilearn/nilearn/milestones{/number}","notifications_url":"https://api.github.com/repos/nilearn/nilearn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nilearn/nilearn/labels{/name}","releases_url":"https://api.github.com/repos/nilearn/nilearn/releases{/id}","created_at":"2011-01-09T19:02:23Z","updated_at":"2015-02-26T08:07:18Z","pushed_at":"2015-02-26T08:07:18Z","git_url":"git://github.com/nilearn/nilearn.git","ssh_url":"git@github.com:nilearn/nilearn.git","clone_url":"https://github.com/nilearn/nilearn.git","svn_url":"https://github.com/nilearn/nilearn","homepage":"http://nilearn.github.io","size":11248,"stargazers_count":72,"watchers_count":72,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":53,"mirror_url":null,"open_issues_count":73,"forks":53,"open_issues":73,"watchers":72,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nilearn/nilearn/pulls/430"},"html":{"href":"https://github.com/nilearn/nilearn/pull/430"},"issue":{"href":"https://api.github.com/repos/nilearn/nilearn/issues/430"},"comments":{"href":"https://api.github.com/repos/nilearn/nilearn/issues/430/comments"},"review_comments":{"href":"https://api.github.com/repos/nilearn/nilearn/pulls/430/comments"},"review_comment":{"href":"https://api.github.com/repos/nilearn/nilearn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nilearn/nilearn/pulls/430/commits"},"statuses":{"href":"https://api.github.com/repos/nilearn/nilearn/statuses/492b7563d5fcc49f3b59ced8072e7f0bb661ee90"}}}}