{"action":"created","comment":{"url":"https://api.github.com/repos/ukoethe/vigra/pulls/comments/53818865","id":53818865,"diff_hunk":"@@ -33,6 +33,49 @@ def test_labelMultiArray():\n     _impl_test_labelMultiArray(numpy.uint8)\n     _impl_test_labelMultiArray(numpy.uint32)\n     _impl_test_labelMultiArray(numpy.float32)\n+\n+\n+def _impl_test_applyMapping(dtype):\n+    original = numpy.arange(100, dtype=dtype ).reshape(10,10)\n+    mapping = { int(k) : int(k + 100) for k in original.flat[:] }\n+","path":"vigranumpy/test/test_segmentation.py","position":null,"original_position":9,"commit_id":"bf32637e123af58b470feca0d1da6c54901a6afe","original_commit_id":"f4477fcff969b085f743246e8d831806df3ef720","user":{"login":"stuarteberg","id":1655821,"avatar_url":"https://avatars.githubusercontent.com/u/1655821?v=3","gravatar_id":"","url":"https://api.github.com/users/stuarteberg","html_url":"https://github.com/stuarteberg","followers_url":"https://api.github.com/users/stuarteberg/followers","following_url":"https://api.github.com/users/stuarteberg/following{/other_user}","gists_url":"https://api.github.com/users/stuarteberg/gists{/gist_id}","starred_url":"https://api.github.com/users/stuarteberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stuarteberg/subscriptions","organizations_url":"https://api.github.com/users/stuarteberg/orgs","repos_url":"https://api.github.com/users/stuarteberg/repos","events_url":"https://api.github.com/users/stuarteberg/events{/privacy}","received_events_url":"https://api.github.com/users/stuarteberg/received_events","type":"User","site_admin":false},"body":">in case of the labelmap, you could use the promote type\r\n\r\nThat doesn't seem to work.  I don't think the problem here has to do with type widths, does it? After all, the `gaussianSmoothing()` example above is attempting to promote from float to double, which wouldn't lose any precision.\r\n\r\nI think it has to do with the fact that `extract<>()` doesn't seem to recognize that objects of type `np.uint32` are integers.  Maybe we need to augment `converters.cxx` to explicitly support scalars of type `np.uintXX`.","created_at":"2016-02-23T17:47:24Z","updated_at":"2016-02-23T17:47:24Z","html_url":"https://github.com/ukoethe/vigra/pull/330#discussion_r53818865","pull_request_url":"https://api.github.com/repos/ukoethe/vigra/pulls/330","_links":{"self":{"href":"https://api.github.com/repos/ukoethe/vigra/pulls/comments/53818865"},"html":{"href":"https://github.com/ukoethe/vigra/pull/330#discussion_r53818865"},"pull_request":{"href":"https://api.github.com/repos/ukoethe/vigra/pulls/330"}}},"pull_request":{"url":"https://api.github.com/repos/ukoethe/vigra/pulls/330","id":60253748,"html_url":"https://github.com/ukoethe/vigra/pull/330","diff_url":"https://github.com/ukoethe/vigra/pull/330.diff","patch_url":"https://github.com/ukoethe/vigra/pull/330.patch","issue_url":"https://api.github.com/repos/ukoethe/vigra/issues/330","number":330,"state":"open","locked":false,"title":"python: Added applyMapping() function","user":{"login":"stuarteberg","id":1655821,"avatar_url":"https://avatars.githubusercontent.com/u/1655821?v=3","gravatar_id":"","url":"https://api.github.com/users/stuarteberg","html_url":"https://github.com/stuarteberg","followers_url":"https://api.github.com/users/stuarteberg/followers","following_url":"https://api.github.com/users/stuarteberg/following{/other_user}","gists_url":"https://api.github.com/users/stuarteberg/gists{/gist_id}","starred_url":"https://api.github.com/users/stuarteberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stuarteberg/subscriptions","organizations_url":"https://api.github.com/users/stuarteberg/orgs","repos_url":"https://api.github.com/users/stuarteberg/repos","events_url":"https://api.github.com/users/stuarteberg/events{/privacy}","received_events_url":"https://api.github.com/users/stuarteberg/received_events","type":"User","site_admin":false},"body":"Here's the docstring:\r\n\r\n```\r\napplyMapping( (object)labels, (dict)mapping [, (bool)allow_incomplete_mapping=False [, (object)out=None]]) -> object :\r\n    Map all values in `labels` to new values using the given mapping (a dict).\r\n    Useful for maps with large values, for which a numpy index array would need too much RAM.\r\n    To relabel in-place, set `out=labels`.\r\n\r\n    Parameters\r\n    ----------\r\n    labels: ndarray\r\n    mapping: dict of ``{old_label : new_label}``\r\n    allow_incomplete_mapping: If True, then any voxel values in the original data that are missing\r\n                              from the mapping dict will be copied (and casted) into the output.\r\n                              Otherwise, an ``IndexError`` will be raised if the map is incomplete\r\n                              for the input data.\r\n    out: ndarray to hold the data. If None, it will be allocated for you.\r\n         The dtype of ``out`` is allowed to be smaller (or bigger) than the dtype of ``labels``.\r\n\r\n    Note: As with other vigra functions, you should provide accurate axistags for optimal performance.\r\n```\r\n\r\nEdit: This PR uses a C++11 lambda.  If that's not acceptable (until vigra 1.11), let me know.","created_at":"2016-02-22T22:35:21Z","updated_at":"2016-02-23T17:47:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"002c253eba2e8a71778030a43cc91c8c773d52a8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ukoethe/vigra/pulls/330/commits","review_comments_url":"https://api.github.com/repos/ukoethe/vigra/pulls/330/comments","review_comment_url":"https://api.github.com/repos/ukoethe/vigra/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ukoethe/vigra/issues/330/comments","statuses_url":"https://api.github.com/repos/ukoethe/vigra/statuses/bf32637e123af58b470feca0d1da6c54901a6afe","head":{"label":"stuarteberg:add-python-applymapping","ref":"add-python-applymapping","sha":"bf32637e123af58b470feca0d1da6c54901a6afe","user":{"login":"stuarteberg","id":1655821,"avatar_url":"https://avatars.githubusercontent.com/u/1655821?v=3","gravatar_id":"","url":"https://api.github.com/users/stuarteberg","html_url":"https://github.com/stuarteberg","followers_url":"https://api.github.com/users/stuarteberg/followers","following_url":"https://api.github.com/users/stuarteberg/following{/other_user}","gists_url":"https://api.github.com/users/stuarteberg/gists{/gist_id}","starred_url":"https://api.github.com/users/stuarteberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stuarteberg/subscriptions","organizations_url":"https://api.github.com/users/stuarteberg/orgs","repos_url":"https://api.github.com/users/stuarteberg/repos","events_url":"https://api.github.com/users/stuarteberg/events{/privacy}","received_events_url":"https://api.github.com/users/stuarteberg/received_events","type":"User","site_admin":false},"repo":{"id":6600667,"name":"vigra","full_name":"stuarteberg/vigra","owner":{"login":"stuarteberg","id":1655821,"avatar_url":"https://avatars.githubusercontent.com/u/1655821?v=3","gravatar_id":"","url":"https://api.github.com/users/stuarteberg","html_url":"https://github.com/stuarteberg","followers_url":"https://api.github.com/users/stuarteberg/followers","following_url":"https://api.github.com/users/stuarteberg/following{/other_user}","gists_url":"https://api.github.com/users/stuarteberg/gists{/gist_id}","starred_url":"https://api.github.com/users/stuarteberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stuarteberg/subscriptions","organizations_url":"https://api.github.com/users/stuarteberg/orgs","repos_url":"https://api.github.com/users/stuarteberg/repos","events_url":"https://api.github.com/users/stuarteberg/events{/privacy}","received_events_url":"https://api.github.com/users/stuarteberg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/stuarteberg/vigra","description":"a generic C++ library for image analysis","fork":true,"url":"https://api.github.com/repos/stuarteberg/vigra","forks_url":"https://api.github.com/repos/stuarteberg/vigra/forks","keys_url":"https://api.github.com/repos/stuarteberg/vigra/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stuarteberg/vigra/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stuarteberg/vigra/teams","hooks_url":"https://api.github.com/repos/stuarteberg/vigra/hooks","issue_events_url":"https://api.github.com/repos/stuarteberg/vigra/issues/events{/number}","events_url":"https://api.github.com/repos/stuarteberg/vigra/events","assignees_url":"https://api.github.com/repos/stuarteberg/vigra/assignees{/user}","branches_url":"https://api.github.com/repos/stuarteberg/vigra/branches{/branch}","tags_url":"https://api.github.com/repos/stuarteberg/vigra/tags","blobs_url":"https://api.github.com/repos/stuarteberg/vigra/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stuarteberg/vigra/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stuarteberg/vigra/git/refs{/sha}","trees_url":"https://api.github.com/repos/stuarteberg/vigra/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stuarteberg/vigra/statuses/{sha}","languages_url":"https://api.github.com/repos/stuarteberg/vigra/languages","stargazers_url":"https://api.github.com/repos/stuarteberg/vigra/stargazers","contributors_url":"https://api.github.com/repos/stuarteberg/vigra/contributors","subscribers_url":"https://api.github.com/repos/stuarteberg/vigra/subscribers","subscription_url":"https://api.github.com/repos/stuarteberg/vigra/subscription","commits_url":"https://api.github.com/repos/stuarteberg/vigra/commits{/sha}","git_commits_url":"https://api.github.com/repos/stuarteberg/vigra/git/commits{/sha}","comments_url":"https://api.github.com/repos/stuarteberg/vigra/comments{/number}","issue_comment_url":"https://api.github.com/repos/stuarteberg/vigra/issues/comments{/number}","contents_url":"https://api.github.com/repos/stuarteberg/vigra/contents/{+path}","compare_url":"https://api.github.com/repos/stuarteberg/vigra/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stuarteberg/vigra/merges","archive_url":"https://api.github.com/repos/stuarteberg/vigra/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stuarteberg/vigra/downloads","issues_url":"https://api.github.com/repos/stuarteberg/vigra/issues{/number}","pulls_url":"https://api.github.com/repos/stuarteberg/vigra/pulls{/number}","milestones_url":"https://api.github.com/repos/stuarteberg/vigra/milestones{/number}","notifications_url":"https://api.github.com/repos/stuarteberg/vigra/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stuarteberg/vigra/labels{/name}","releases_url":"https://api.github.com/repos/stuarteberg/vigra/releases{/id}","deployments_url":"https://api.github.com/repos/stuarteberg/vigra/deployments","created_at":"2012-11-08T18:05:59Z","updated_at":"2015-05-08T15:40:24Z","pushed_at":"2016-02-23T16:19:45Z","git_url":"git://github.com/stuarteberg/vigra.git","ssh_url":"git@github.com:stuarteberg/vigra.git","clone_url":"https://github.com/stuarteberg/vigra.git","svn_url":"https://github.com/stuarteberg/vigra","homepage":"http://hci.iwr.uni-heidelberg.de/vigra/","size":75082,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ukoethe:master","ref":"master","sha":"777f70b872751a3459aa405e294dd60c5227b2d9","user":{"login":"ukoethe","id":897680,"avatar_url":"https://avatars.githubusercontent.com/u/897680?v=3","gravatar_id":"","url":"https://api.github.com/users/ukoethe","html_url":"https://github.com/ukoethe","followers_url":"https://api.github.com/users/ukoethe/followers","following_url":"https://api.github.com/users/ukoethe/following{/other_user}","gists_url":"https://api.github.com/users/ukoethe/gists{/gist_id}","starred_url":"https://api.github.com/users/ukoethe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ukoethe/subscriptions","organizations_url":"https://api.github.com/users/ukoethe/orgs","repos_url":"https://api.github.com/users/ukoethe/repos","events_url":"https://api.github.com/users/ukoethe/events{/privacy}","received_events_url":"https://api.github.com/users/ukoethe/received_events","type":"User","site_admin":false},"repo":{"id":2005439,"name":"vigra","full_name":"ukoethe/vigra","owner":{"login":"ukoethe","id":897680,"avatar_url":"https://avatars.githubusercontent.com/u/897680?v=3","gravatar_id":"","url":"https://api.github.com/users/ukoethe","html_url":"https://github.com/ukoethe","followers_url":"https://api.github.com/users/ukoethe/followers","following_url":"https://api.github.com/users/ukoethe/following{/other_user}","gists_url":"https://api.github.com/users/ukoethe/gists{/gist_id}","starred_url":"https://api.github.com/users/ukoethe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ukoethe/subscriptions","organizations_url":"https://api.github.com/users/ukoethe/orgs","repos_url":"https://api.github.com/users/ukoethe/repos","events_url":"https://api.github.com/users/ukoethe/events{/privacy}","received_events_url":"https://api.github.com/users/ukoethe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ukoethe/vigra","description":"a generic C++ library for image analysis","fork":false,"url":"https://api.github.com/repos/ukoethe/vigra","forks_url":"https://api.github.com/repos/ukoethe/vigra/forks","keys_url":"https://api.github.com/repos/ukoethe/vigra/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ukoethe/vigra/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ukoethe/vigra/teams","hooks_url":"https://api.github.com/repos/ukoethe/vigra/hooks","issue_events_url":"https://api.github.com/repos/ukoethe/vigra/issues/events{/number}","events_url":"https://api.github.com/repos/ukoethe/vigra/events","assignees_url":"https://api.github.com/repos/ukoethe/vigra/assignees{/user}","branches_url":"https://api.github.com/repos/ukoethe/vigra/branches{/branch}","tags_url":"https://api.github.com/repos/ukoethe/vigra/tags","blobs_url":"https://api.github.com/repos/ukoethe/vigra/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ukoethe/vigra/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ukoethe/vigra/git/refs{/sha}","trees_url":"https://api.github.com/repos/ukoethe/vigra/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ukoethe/vigra/statuses/{sha}","languages_url":"https://api.github.com/repos/ukoethe/vigra/languages","stargazers_url":"https://api.github.com/repos/ukoethe/vigra/stargazers","contributors_url":"https://api.github.com/repos/ukoethe/vigra/contributors","subscribers_url":"https://api.github.com/repos/ukoethe/vigra/subscribers","subscription_url":"https://api.github.com/repos/ukoethe/vigra/subscription","commits_url":"https://api.github.com/repos/ukoethe/vigra/commits{/sha}","git_commits_url":"https://api.github.com/repos/ukoethe/vigra/git/commits{/sha}","comments_url":"https://api.github.com/repos/ukoethe/vigra/comments{/number}","issue_comment_url":"https://api.github.com/repos/ukoethe/vigra/issues/comments{/number}","contents_url":"https://api.github.com/repos/ukoethe/vigra/contents/{+path}","compare_url":"https://api.github.com/repos/ukoethe/vigra/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ukoethe/vigra/merges","archive_url":"https://api.github.com/repos/ukoethe/vigra/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ukoethe/vigra/downloads","issues_url":"https://api.github.com/repos/ukoethe/vigra/issues{/number}","pulls_url":"https://api.github.com/repos/ukoethe/vigra/pulls{/number}","milestones_url":"https://api.github.com/repos/ukoethe/vigra/milestones{/number}","notifications_url":"https://api.github.com/repos/ukoethe/vigra/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ukoethe/vigra/labels{/name}","releases_url":"https://api.github.com/repos/ukoethe/vigra/releases{/id}","deployments_url":"https://api.github.com/repos/ukoethe/vigra/deployments","created_at":"2011-07-06T08:34:57Z","updated_at":"2016-02-21T08:44:17Z","pushed_at":"2016-02-23T17:03:13Z","git_url":"git://github.com/ukoethe/vigra.git","ssh_url":"git@github.com:ukoethe/vigra.git","clone_url":"https://github.com/ukoethe/vigra.git","svn_url":"https://github.com/ukoethe/vigra","homepage":"http://hci.iwr.uni-heidelberg.de/vigra/","size":114201,"stargazers_count":146,"watchers_count":146,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":109,"mirror_url":null,"open_issues_count":63,"forks":109,"open_issues":63,"watchers":146,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ukoethe/vigra/pulls/330"},"html":{"href":"https://github.com/ukoethe/vigra/pull/330"},"issue":{"href":"https://api.github.com/repos/ukoethe/vigra/issues/330"},"comments":{"href":"https://api.github.com/repos/ukoethe/vigra/issues/330/comments"},"review_comments":{"href":"https://api.github.com/repos/ukoethe/vigra/pulls/330/comments"},"review_comment":{"href":"https://api.github.com/repos/ukoethe/vigra/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ukoethe/vigra/pulls/330/commits"},"statuses":{"href":"https://api.github.com/repos/ukoethe/vigra/statuses/bf32637e123af58b470feca0d1da6c54901a6afe"}}}}