{"action":"created","issue":{"url":"https://api.github.com/repos/SimpleITK/SimpleITK/issues/106","repository_url":"https://api.github.com/repos/SimpleITK/SimpleITK","labels_url":"https://api.github.com/repos/SimpleITK/SimpleITK/issues/106/labels{/name}","comments_url":"https://api.github.com/repos/SimpleITK/SimpleITK/issues/106/comments","events_url":"https://api.github.com/repos/SimpleITK/SimpleITK/issues/106/events","html_url":"https://github.com/SimpleITK/SimpleITK/issues/106","id":208683639,"number":106,"title":"ResampleImageFilter.SetSize() does not accept numpy arrays in Python 3","user":{"login":"haarburger","id":2522480,"avatar_url":"https://avatars.githubusercontent.com/u/2522480?v=3","gravatar_id":"","url":"https://api.github.com/users/haarburger","html_url":"https://github.com/haarburger","followers_url":"https://api.github.com/users/haarburger/followers","following_url":"https://api.github.com/users/haarburger/following{/other_user}","gists_url":"https://api.github.com/users/haarburger/gists{/gist_id}","starred_url":"https://api.github.com/users/haarburger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haarburger/subscriptions","organizations_url":"https://api.github.com/users/haarburger/orgs","repos_url":"https://api.github.com/users/haarburger/repos","events_url":"https://api.github.com/users/haarburger/events{/privacy}","received_events_url":"https://api.github.com/users/haarburger/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-02-19T00:42:08Z","updated_at":"2017-02-20T08:25:13Z","closed_at":null,"body":"As reported [here](https://github.com/Radiomics/pyradiomics/issues/204), the following code works with Python 2 but not Python 3:\r\n\r\n```python\r\nrif = sitk.ResampleImageFilter()\r\nrif.SetSize(np.array([1, 2, 3], dtype='int'))\r\n```\r\nIn Python 3, SimpleITK throws\r\n```\r\nTypeError: in method 'ResampleImageFilter_SetSize', argument 2 of type 'std::vector< uint32_t,std::allocator< uint32_t > > const &'\r\n```\r\n\r\nPassing `dtype='uint32'` doesn't help. My temporary workaround is\r\n```python\r\nrif.SetSize(np.array([1, 2, 3], dtype='int').tolist())\r\n```\r\nI tested with both SimpleITK 0.10.0 and 1.0.0rc1+g57b8f\r\n\r\nSystem:\r\n* ubuntu 16.04 amd64\r\n* python 3.5.2 (anaconda)\r\n* numpy 1.12.0\r\n* SimpleITK 0.10.0 and 1.0.0rc1+g57b8f"},"comment":{"url":"https://api.github.com/repos/SimpleITK/SimpleITK/issues/comments/281015546","html_url":"https://github.com/SimpleITK/SimpleITK/issues/106#issuecomment-281015546","issue_url":"https://api.github.com/repos/SimpleITK/SimpleITK/issues/106","id":281015546,"user":{"login":"haarburger","id":2522480,"avatar_url":"https://avatars.githubusercontent.com/u/2522480?v=3","gravatar_id":"","url":"https://api.github.com/users/haarburger","html_url":"https://github.com/haarburger","followers_url":"https://api.github.com/users/haarburger/followers","following_url":"https://api.github.com/users/haarburger/following{/other_user}","gists_url":"https://api.github.com/users/haarburger/gists{/gist_id}","starred_url":"https://api.github.com/users/haarburger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haarburger/subscriptions","organizations_url":"https://api.github.com/users/haarburger/orgs","repos_url":"https://api.github.com/users/haarburger/repos","events_url":"https://api.github.com/users/haarburger/events{/privacy}","received_events_url":"https://api.github.com/users/haarburger/received_events","type":"User","site_admin":false},"created_at":"2017-02-20T08:25:13Z","updated_at":"2017-02-20T08:25:13Z","body":"@zivy Using numpy array was not my decision. It was [implemented](https://github.com/Radiomics/pyradiomics/blob/cc788414606f23b1bbd5c6327035ffb9c7bcadc3/radiomics/imageoperations.py#L187) like that in pyradiomics and as a pyradiomics user I stumbled upon this."}}
{"actor":{"display_login":"haarburger"}}