{"action":"created","comment":{"url":"https://api.github.com/repos/nilearn/nilearn/pulls/comments/37274391","id":37274391,"diff_hunk":"@@ -5,75 +5,85 @@\n # License: simplified BSD\n \n import warnings\n+import abc\n \n import numpy as np\n-import itertools\n \n from sklearn.base import BaseEstimator, TransformerMixin\n-from sklearn.externals.joblib import Memory, Parallel, delayed\n+from sklearn.externals.joblib import Memory\n \n from .. import masking\n from .. import image\n from .. import signal\n from .. import _utils\n from .._utils.cache_mixin import CacheMixin, cache\n-from .._utils.class_inspect import enclosing_scope_name, get_params\n-from .._utils.compat import _basestring, izip\n-from nilearn._utils.niimg_conversions import (\n-    _iter_check_niimg, _check_same_fov)\n-\n-\n-def filter_and_mask(imgs, mask_img_,\n-                    parameters,\n-                    memory_level=0,\n-                    memory=Memory(cachedir=None),\n-                    verbose=0,\n-                    confounds=None,\n-                    copy=True,\n-                    sample_mask=None):\n+from .._utils.class_inspect import enclosing_scope_name\n+from .._utils.compat import _basestring\n+\n+\n+def filter_and_extract(imgs, extraction_function,\n+                       parameters,\n+                       memory_level=0, memory=Memory(cachedir=None),\n+                       verbose=0,\n+                       confounds=None,\n+                       copy=True):\n+    \"\"\"Extract representative time series using given function.\n+\n+    Parameters\n+    ----------\n+    imgs: 3D/4D Niimg-like object\n+        Images to be masked. Can be 3-dimensional or 4-dimensional.\n+\n+    extraction_function: function\n+        Function used to extract the time series from 4D data.\n+\n+    For all other parameters refer to NiftiMasker documentation\n+    \"\"\"","path":"nilearn/input_data/base_masker.py","position":53,"original_position":53,"commit_id":"5e6b46818ba87dfe7872d08a092d46e7534cb5d5","original_commit_id":"5e6b46818ba87dfe7872d08a092d46e7534cb5d5","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":"Fixed.","created_at":"2015-08-18T08:20:16Z","updated_at":"2015-08-18T08:20:16Z","html_url":"https://github.com/nilearn/nilearn/pull/738#discussion_r37274391","pull_request_url":"https://api.github.com/repos/nilearn/nilearn/pulls/738","_links":{"self":{"href":"https://api.github.com/repos/nilearn/nilearn/pulls/comments/37274391"},"html":{"href":"https://github.com/nilearn/nilearn/pull/738#discussion_r37274391"},"pull_request":{"href":"https://api.github.com/repos/nilearn/nilearn/pulls/738"}}},"pull_request":{"url":"https://api.github.com/repos/nilearn/nilearn/pulls/738","id":41113578,"html_url":"https://github.com/nilearn/nilearn/pull/738","diff_url":"https://github.com/nilearn/nilearn/pull/738.diff","patch_url":"https://github.com/nilearn/nilearn/pull/738.patch","issue_url":"https://api.github.com/repos/nilearn/nilearn/issues/738","number":738,"state":"open","locked":false,"title":"[MRG] Use filter_and_extract as a basis signal extractor.","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":"Address #720 step 1.2, 1.3 and 3.1.\r\n\r\nThe goal here is to establish a common basis for NiftiMasker, NiftiLabelsMasker and NiftiMapsMasker. There are a lot of advantages:\r\n* NiftiMasker features come for free in Nifti*Maskers (sessions and sample masks)\r\n* If we design it well, MultiNifti*Masker flavors will come for free for all Nifti*Maskers.\r\n* Code is slightly more complicated (very slightly actually) but much smaller, making maintenance and bug tracking easier.\r\n\r\nSteps done:\r\n* [x] Make `filter_and_mask` rely on `filter_and_extract`\r\n* [x] Make NiftiSpheresMasker rely on `filter_and_extract`\r\n* [x] Make `BaseMasker` more generic. NiftiLabelsMasker and NiftiMapsMasker should inherit from it.\r\n* [x] Make `MultiNiftiMasker` independant by inheriting `NiftiMasker`","created_at":"2015-07-29T11:41:49Z","updated_at":"2015-08-18T08:20:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"15f36542adf9705e4170e0477fd25ecb75b722bd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nilearn/nilearn/pulls/738/commits","review_comments_url":"https://api.github.com/repos/nilearn/nilearn/pulls/738/comments","review_comment_url":"https://api.github.com/repos/nilearn/nilearn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nilearn/nilearn/issues/738/comments","statuses_url":"https://api.github.com/repos/nilearn/nilearn/statuses/5e6b46818ba87dfe7872d08a092d46e7534cb5d5","head":{"label":"AlexandreAbraham:factorize_code_2","ref":"factorize_code_2","sha":"5e6b46818ba87dfe7872d08a092d46e7534cb5d5","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-05-07T07:53:54Z","pushed_at":"2015-08-18T07:54:11Z","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":9091,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":6,"forks":1,"open_issues":6,"watchers":5,"default_branch":"master"}},"base":{"label":"nilearn:master","ref":"master","sha":"dfcae02965510f739478ecb1b826f062b30e66ad","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-08-18T01:13:14Z","pushed_at":"2015-08-18T07:54:12Z","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":14004,"stargazers_count":106,"watchers_count":106,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":74,"mirror_url":null,"open_issues_count":83,"forks":74,"open_issues":83,"watchers":106,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nilearn/nilearn/pulls/738"},"html":{"href":"https://github.com/nilearn/nilearn/pull/738"},"issue":{"href":"https://api.github.com/repos/nilearn/nilearn/issues/738"},"comments":{"href":"https://api.github.com/repos/nilearn/nilearn/issues/738/comments"},"review_comments":{"href":"https://api.github.com/repos/nilearn/nilearn/pulls/738/comments"},"review_comment":{"href":"https://api.github.com/repos/nilearn/nilearn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nilearn/nilearn/pulls/738/commits"},"statuses":{"href":"https://api.github.com/repos/nilearn/nilearn/statuses/5e6b46818ba87dfe7872d08a092d46e7534cb5d5"}}}}