{"action":"created","issue":{"url":"https://api.github.com/repos/nilearn/nilearn/issues/418","labels_url":"https://api.github.com/repos/nilearn/nilearn/issues/418/labels{/name}","comments_url":"https://api.github.com/repos/nilearn/nilearn/issues/418/comments","events_url":"https://api.github.com/repos/nilearn/nilearn/issues/418/events","html_url":"https://github.com/nilearn/nilearn/issues/418","id":56954493,"number":418,"title":"Detrending 3D image puts all values to 0 (was Masking with detrend=True has an undocumented, unexpected semantic.)","user":{"login":"bcipolli","id":4072455,"avatar_url":"https://avatars.githubusercontent.com/u/4072455?v=3","gravatar_id":"","url":"https://api.github.com/users/bcipolli","html_url":"https://github.com/bcipolli","followers_url":"https://api.github.com/users/bcipolli/followers","following_url":"https://api.github.com/users/bcipolli/following{/other_user}","gists_url":"https://api.github.com/users/bcipolli/gists{/gist_id}","starred_url":"https://api.github.com/users/bcipolli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcipolli/subscriptions","organizations_url":"https://api.github.com/users/bcipolli/orgs","repos_url":"https://api.github.com/users/bcipolli/repos","events_url":"https://api.github.com/users/bcipolli/events{/privacy}","received_events_url":"https://api.github.com/users/bcipolli/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nilearn/nilearn/labels/Bug","name":"Bug","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/nilearn/nilearn/milestones/8","html_url":"https://github.com/nilearn/nilearn/milestones/0.1.2","labels_url":"https://api.github.com/repos/nilearn/nilearn/milestones/8/labels","id":997307,"number":8,"title":"0.1.2","description":"","creator":{"login":"lesteve","id":1680079,"avatar_url":"https://avatars.githubusercontent.com/u/1680079?v=3","gravatar_id":"","url":"https://api.github.com/users/lesteve","html_url":"https://github.com/lesteve","followers_url":"https://api.github.com/users/lesteve/followers","following_url":"https://api.github.com/users/lesteve/following{/other_user}","gists_url":"https://api.github.com/users/lesteve/gists{/gist_id}","starred_url":"https://api.github.com/users/lesteve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lesteve/subscriptions","organizations_url":"https://api.github.com/users/lesteve/orgs","repos_url":"https://api.github.com/users/lesteve/repos","events_url":"https://api.github.com/users/lesteve/events{/privacy}","received_events_url":"https://api.github.com/users/lesteve/received_events","type":"User","site_admin":false},"open_issues":13,"closed_issues":0,"state":"open","created_at":"2015-02-26T17:00:09Z","updated_at":"2015-02-26T17:01:11Z","due_on":null,"closed_at":null},"comments":10,"created_at":"2015-02-08T15:09:03Z","updated_at":"2015-02-27T09:51:37Z","closed_at":null,"body":"I looked at the docstring for the `NiftiMasker` class, and for `detrend` it says:\r\n```\r\n    detrend : boolean, optional\r\n        This parameter is passed to signal.clean. Please see the related\r\n        documentation for details\r\n```\r\n\r\nI expected that it would have one of the two semantics:\r\n1. `NiftiMasker` will detrend to compute the mask, then the detrending computed on the mask would be applied to the image passed to `transform`\r\n2. `NiftiMasker` will detrend to compute the mask, and will not detrend input data.\r\n\r\nInstead a third semantic was applied:\r\n* `NiftiMasker` detrends to compute the mask.  It then detrends any image that it receives (even if that image is 3D), *using the input images only*.\r\n\r\nI'm not sure what the designed behavior is (or why), but at the very least a warning would be helpful.  When I passed a 3D image into a masker with `detrend=True`, I got an image  back out that was all zeros.\r\n\r\nNote: this probably also applies to standardize."},"comment":{"url":"https://api.github.com/repos/nilearn/nilearn/issues/comments/76365856","html_url":"https://github.com/nilearn/nilearn/issues/418#issuecomment-76365856","issue_url":"https://api.github.com/repos/nilearn/nilearn/issues/418","id":76365856,"user":{"login":"eickenberg","id":1306635,"avatar_url":"https://avatars.githubusercontent.com/u/1306635?v=3","gravatar_id":"","url":"https://api.github.com/users/eickenberg","html_url":"https://github.com/eickenberg","followers_url":"https://api.github.com/users/eickenberg/followers","following_url":"https://api.github.com/users/eickenberg/following{/other_user}","gists_url":"https://api.github.com/users/eickenberg/gists{/gist_id}","starred_url":"https://api.github.com/users/eickenberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eickenberg/subscriptions","organizations_url":"https://api.github.com/users/eickenberg/orgs","repos_url":"https://api.github.com/users/eickenberg/repos","events_url":"https://api.github.com/users/eickenberg/events{/privacy}","received_events_url":"https://api.github.com/users/eickenberg/received_events","type":"User","site_admin":false},"created_at":"2015-02-27T09:51:37Z","updated_at":"2015-02-27T09:51:37Z","body":"crash or warn would be my first reflex. However, somebody masking a 3D image probably just wants a masked 3D image, so from that point of view a little magic from our side should actually be beneficial.\r\n\r\nHow about this: If `detrend == True or standardize == True` and the masker gets a call to transform a 3D image, we could warn that we are not going to detrend it, making the user aware of the problem, but returning what most users would expect, i.e. a masked image."}}