{"action":"created","issue":{"url":"https://api.github.com/repos/nilearn/nilearn/issues/1620","repository_url":"https://api.github.com/repos/nilearn/nilearn","labels_url":"https://api.github.com/repos/nilearn/nilearn/issues/1620/labels{/name}","comments_url":"https://api.github.com/repos/nilearn/nilearn/issues/1620/comments","events_url":"https://api.github.com/repos/nilearn/nilearn/issues/1620/events","html_url":"https://github.com/nilearn/nilearn/issues/1620","id":305315699,"number":1620,"title":"Resampled image being padded with zeros","user":{"login":"ellisdg","id":8558995,"avatar_url":"https://avatars3.githubusercontent.com/u/8558995?v=4","gravatar_id":"","url":"https://api.github.com/users/ellisdg","html_url":"https://github.com/ellisdg","followers_url":"https://api.github.com/users/ellisdg/followers","following_url":"https://api.github.com/users/ellisdg/following{/other_user}","gists_url":"https://api.github.com/users/ellisdg/gists{/gist_id}","starred_url":"https://api.github.com/users/ellisdg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ellisdg/subscriptions","organizations_url":"https://api.github.com/users/ellisdg/orgs","repos_url":"https://api.github.com/users/ellisdg/repos","events_url":"https://api.github.com/users/ellisdg/events{/privacy}","received_events_url":"https://api.github.com/users/ellisdg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-03-14T20:25:24Z","updated_at":"2018-03-15T20:38:50Z","closed_at":null,"author_association":"NONE","body":"When I resample images using ```resample_img```, I'm noticing a weird padding behaviour. For example, I can create a 4x4x4 image as follows:\r\n```\r\nimport numpy as np\r\nimport nibabel as nib\r\nfrom nilearn.image import resample_img\r\n\r\nimage = nib.Nifti1Image(np.arange(4**3).reshape((4, 4, 4)), affine=np.diag(np.ones(4)))\r\n```\r\nI then want to downsample that image to half it's original size:\r\n```\r\nnew_image = resample_img(image, target_affine=np.diag(np.ones(3)*2))\r\n```\r\nI can then print out the data array from the new image as follows:\r\n```\r\nprint(np.round(new_image.get_data()))\r\n```\r\nAnd this gives me a 3x3x3 array. This array includes the 2x2x2 array that I was expecting, plus some extra zeros:\r\n```\r\n[[[  0.   2.   0.]\r\n  [  8.  10.   0.]\r\n  [  0.   0.   0.]]\r\n\r\n [[ 32.  34.   0.]\r\n  [ 40.  42.   0.]\r\n  [  0.   0.   0.]]\r\n\r\n [[  0.   0.   0.]\r\n  [  0.   0.   0.]\r\n  [  0.   0.   0.]]]\r\n```\r\nIs it expected behaviour for the output image to be padded with zeros?"},"comment":{"url":"https://api.github.com/repos/nilearn/nilearn/issues/comments/373515274","html_url":"https://github.com/nilearn/nilearn/issues/1620#issuecomment-373515274","issue_url":"https://api.github.com/repos/nilearn/nilearn/issues/1620","id":373515274,"user":{"login":"KamalakerDadi","id":11410385,"avatar_url":"https://avatars2.githubusercontent.com/u/11410385?v=4","gravatar_id":"","url":"https://api.github.com/users/KamalakerDadi","html_url":"https://github.com/KamalakerDadi","followers_url":"https://api.github.com/users/KamalakerDadi/followers","following_url":"https://api.github.com/users/KamalakerDadi/following{/other_user}","gists_url":"https://api.github.com/users/KamalakerDadi/gists{/gist_id}","starred_url":"https://api.github.com/users/KamalakerDadi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KamalakerDadi/subscriptions","organizations_url":"https://api.github.com/users/KamalakerDadi/orgs","repos_url":"https://api.github.com/users/KamalakerDadi/repos","events_url":"https://api.github.com/users/KamalakerDadi/events{/privacy}","received_events_url":"https://api.github.com/users/KamalakerDadi/received_events","type":"User","site_admin":false},"created_at":"2018-03-15T20:38:50Z","updated_at":"2018-03-15T20:38:50Z","author_association":"CONTRIBUTOR","body":"@eickenberg Do you have some inputs here ?\r\nThanks. "}}
{"actor":{"display_login":"KamalakerDadi"}}