{"action":"created","comment":{"url":"https://api.github.com/repos/nipy/dipy/pulls/comments/78288203","id":78288203,"diff_hunk":"@@ -162,6 +161,176 @@ def streamline_mapping(streamlines, voxel_size=None, affine=None,\n \n @cython.boundscheck(False)\n @cython.wraparound(False)\n+cdef inline double norm(double x, double y, double z) nogil:\n+    cdef double val = sqrt(x*x + y*y + z*z)\n+    return val\n+\n+\n+# Changing this to a memview was slower.\n+@cython.boundscheck(False)\n+@cython.wraparound(False)\n+cdef inline void c_get_closest_edge(double p_x, double p_y, double p_z,","path":"dipy/tracking/vox2track.pyx","position":30,"original_position":30,"commit_id":"96fc465becb619b02db81b254897f7b25c7896e5","original_commit_id":"96fc465becb619b02db81b254897f7b25c7896e5","user":{"login":"Garyfallidis","id":134276,"avatar_url":"https://avatars.githubusercontent.com/u/134276?v=3","gravatar_id":"","url":"https://api.github.com/users/Garyfallidis","html_url":"https://github.com/Garyfallidis","followers_url":"https://api.github.com/users/Garyfallidis/followers","following_url":"https://api.github.com/users/Garyfallidis/following{/other_user}","gists_url":"https://api.github.com/users/Garyfallidis/gists{/gist_id}","starred_url":"https://api.github.com/users/Garyfallidis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Garyfallidis/subscriptions","organizations_url":"https://api.github.com/users/Garyfallidis/orgs","repos_url":"https://api.github.com/users/Garyfallidis/repos","events_url":"https://api.github.com/users/Garyfallidis/events{/privacy}","received_events_url":"https://api.github.com/users/Garyfallidis/received_events","type":"User","site_admin":false},"body":"Nice :)","created_at":"2016-09-11T05:30:57Z","updated_at":"2016-09-11T05:30:57Z","html_url":"https://github.com/nipy/dipy/pull/1092#discussion_r78288203","pull_request_url":"https://api.github.com/repos/nipy/dipy/pulls/1092","_links":{"self":{"href":"https://api.github.com/repos/nipy/dipy/pulls/comments/78288203"},"html":{"href":"https://github.com/nipy/dipy/pull/1092#discussion_r78288203"},"pull_request":{"href":"https://api.github.com/repos/nipy/dipy/pulls/1092"}}},"pull_request":{"url":"https://api.github.com/repos/nipy/dipy/pulls/1092","id":75837417,"html_url":"https://github.com/nipy/dipy/pull/1092","diff_url":"https://github.com/nipy/dipy/pull/1092.diff","patch_url":"https://github.com/nipy/dipy/pull/1092.patch","issue_url":"https://api.github.com/repos/nipy/dipy/issues/1092","number":1092,"state":"open","locked":false,"title":"Line-based target()","user":{"login":"nilgoyyou","id":2658640,"avatar_url":"https://avatars.githubusercontent.com/u/2658640?v=3","gravatar_id":"","url":"https://api.github.com/users/nilgoyyou","html_url":"https://github.com/nilgoyyou","followers_url":"https://api.github.com/users/nilgoyyou/followers","following_url":"https://api.github.com/users/nilgoyyou/following{/other_user}","gists_url":"https://api.github.com/users/nilgoyyou/gists{/gist_id}","starred_url":"https://api.github.com/users/nilgoyyou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nilgoyyou/subscriptions","organizations_url":"https://api.github.com/users/nilgoyyou/orgs","repos_url":"https://api.github.com/users/nilgoyyou/repos","events_url":"https://api.github.com/users/nilgoyyou/events{/privacy}","received_events_url":"https://api.github.com/users/nilgoyyou/received_events","type":"User","site_admin":false},"body":"A line-based version of `tracking/target()` because we will see more and more compressed fibers.\r\n\r\nI tried to mimick as much as possible `target()` and its test. The logic being: if `target()` was good enough for dipy, I guess my version will be too :)\r\nThe only difference is that I don't raise a `ValueError`. I could do it though, for a loss of speed.\r\n\r\nHere are some metrics that I compiled while I was testing. I used a small mask. I tested with non-compressed tck and their compressed version.\r\n```\r\n------------------ Actual results ------------------\r\n      target  target_comp  target_lb  target_lb_comp\r\n50k     137        135         138         138\r\n100k    292        281         299         299\r\n250k    685        674         695         695\r\n500k   1432       1400        1460        1459\r\n1000k  2845       2791        2893        2896\r\n```\r\nWe can see a small drop (~1%) from `target` to `target_comp`, which is normal because the standard `target()` function doesn't handle compressed fibers, so it may miss some voxels.\r\n\r\n`target_lb` always finds more tract than `target`, which may be suprising at first sight. The problem with `target` is that it misses some voxels where the line passes near the edge of a voxel. `target_lb` catches those voxels.\r\n\r\n`target_lb_comp` finds more tract than `target_lb` on large datasets. This also seems surprising, but the compression algorithm may change a little the position of some points, which may make some lines pass by different voxels.\r\n```\r\n----------- SPEED (s) -----------\r\n        target  target_lb  speedup\r\n50k      0.945    0.638      1.5\r\n100k     2.060    1.363      1.5\r\n250k     5.117    3.161      1.6\r\n500k    10.461    6.594      1.6\r\n1000k   20.663   12.722      1.6\r\n```\r\nWe can see that `target_lb` is about 1.6x faster. This version is heavily cythonized. This makes the code less readable, but it's faster than `target()`.","created_at":"2016-06-30T15:12:34Z","updated_at":"2016-09-11T05:30:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"98685a70a02d1d4f4aba98918ecc0051ef2abc34","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/nipy/dipy/pulls/1092/commits","review_comments_url":"https://api.github.com/repos/nipy/dipy/pulls/1092/comments","review_comment_url":"https://api.github.com/repos/nipy/dipy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nipy/dipy/issues/1092/comments","statuses_url":"https://api.github.com/repos/nipy/dipy/statuses/96fc465becb619b02db81b254897f7b25c7896e5","head":{"label":"nilgoyyou:target_line_based","ref":"target_line_based","sha":"96fc465becb619b02db81b254897f7b25c7896e5","user":{"login":"nilgoyyou","id":2658640,"avatar_url":"https://avatars.githubusercontent.com/u/2658640?v=3","gravatar_id":"","url":"https://api.github.com/users/nilgoyyou","html_url":"https://github.com/nilgoyyou","followers_url":"https://api.github.com/users/nilgoyyou/followers","following_url":"https://api.github.com/users/nilgoyyou/following{/other_user}","gists_url":"https://api.github.com/users/nilgoyyou/gists{/gist_id}","starred_url":"https://api.github.com/users/nilgoyyou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nilgoyyou/subscriptions","organizations_url":"https://api.github.com/users/nilgoyyou/orgs","repos_url":"https://api.github.com/users/nilgoyyou/repos","events_url":"https://api.github.com/users/nilgoyyou/events{/privacy}","received_events_url":"https://api.github.com/users/nilgoyyou/received_events","type":"User","site_admin":false},"repo":{"id":43706739,"name":"dipy","full_name":"nilgoyyou/dipy","owner":{"login":"nilgoyyou","id":2658640,"avatar_url":"https://avatars.githubusercontent.com/u/2658640?v=3","gravatar_id":"","url":"https://api.github.com/users/nilgoyyou","html_url":"https://github.com/nilgoyyou","followers_url":"https://api.github.com/users/nilgoyyou/followers","following_url":"https://api.github.com/users/nilgoyyou/following{/other_user}","gists_url":"https://api.github.com/users/nilgoyyou/gists{/gist_id}","starred_url":"https://api.github.com/users/nilgoyyou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nilgoyyou/subscriptions","organizations_url":"https://api.github.com/users/nilgoyyou/orgs","repos_url":"https://api.github.com/users/nilgoyyou/repos","events_url":"https://api.github.com/users/nilgoyyou/events{/privacy}","received_events_url":"https://api.github.com/users/nilgoyyou/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nilgoyyou/dipy","description":"Diffusion MR Imaging in Python","fork":true,"url":"https://api.github.com/repos/nilgoyyou/dipy","forks_url":"https://api.github.com/repos/nilgoyyou/dipy/forks","keys_url":"https://api.github.com/repos/nilgoyyou/dipy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nilgoyyou/dipy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nilgoyyou/dipy/teams","hooks_url":"https://api.github.com/repos/nilgoyyou/dipy/hooks","issue_events_url":"https://api.github.com/repos/nilgoyyou/dipy/issues/events{/number}","events_url":"https://api.github.com/repos/nilgoyyou/dipy/events","assignees_url":"https://api.github.com/repos/nilgoyyou/dipy/assignees{/user}","branches_url":"https://api.github.com/repos/nilgoyyou/dipy/branches{/branch}","tags_url":"https://api.github.com/repos/nilgoyyou/dipy/tags","blobs_url":"https://api.github.com/repos/nilgoyyou/dipy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nilgoyyou/dipy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nilgoyyou/dipy/git/refs{/sha}","trees_url":"https://api.github.com/repos/nilgoyyou/dipy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nilgoyyou/dipy/statuses/{sha}","languages_url":"https://api.github.com/repos/nilgoyyou/dipy/languages","stargazers_url":"https://api.github.com/repos/nilgoyyou/dipy/stargazers","contributors_url":"https://api.github.com/repos/nilgoyyou/dipy/contributors","subscribers_url":"https://api.github.com/repos/nilgoyyou/dipy/subscribers","subscription_url":"https://api.github.com/repos/nilgoyyou/dipy/subscription","commits_url":"https://api.github.com/repos/nilgoyyou/dipy/commits{/sha}","git_commits_url":"https://api.github.com/repos/nilgoyyou/dipy/git/commits{/sha}","comments_url":"https://api.github.com/repos/nilgoyyou/dipy/comments{/number}","issue_comment_url":"https://api.github.com/repos/nilgoyyou/dipy/issues/comments{/number}","contents_url":"https://api.github.com/repos/nilgoyyou/dipy/contents/{+path}","compare_url":"https://api.github.com/repos/nilgoyyou/dipy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nilgoyyou/dipy/merges","archive_url":"https://api.github.com/repos/nilgoyyou/dipy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nilgoyyou/dipy/downloads","issues_url":"https://api.github.com/repos/nilgoyyou/dipy/issues{/number}","pulls_url":"https://api.github.com/repos/nilgoyyou/dipy/pulls{/number}","milestones_url":"https://api.github.com/repos/nilgoyyou/dipy/milestones{/number}","notifications_url":"https://api.github.com/repos/nilgoyyou/dipy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nilgoyyou/dipy/labels{/name}","releases_url":"https://api.github.com/repos/nilgoyyou/dipy/releases{/id}","deployments_url":"https://api.github.com/repos/nilgoyyou/dipy/deployments","created_at":"2015-10-05T18:58:42Z","updated_at":"2016-06-30T14:39:27Z","pushed_at":"2016-08-31T19:42:28Z","git_url":"git://github.com/nilgoyyou/dipy.git","ssh_url":"git@github.com:nilgoyyou/dipy.git","clone_url":"https://github.com/nilgoyyou/dipy.git","svn_url":"https://github.com/nilgoyyou/dipy","homepage":"http://dipy.org","size":26698,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nipy:master","ref":"master","sha":"31bc6fefc9fc8ef44e604e10757c23af0939c3bd","user":{"login":"nipy","id":233707,"avatar_url":"https://avatars.githubusercontent.com/u/233707?v=3","gravatar_id":"","url":"https://api.github.com/users/nipy","html_url":"https://github.com/nipy","followers_url":"https://api.github.com/users/nipy/followers","following_url":"https://api.github.com/users/nipy/following{/other_user}","gists_url":"https://api.github.com/users/nipy/gists{/gist_id}","starred_url":"https://api.github.com/users/nipy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nipy/subscriptions","organizations_url":"https://api.github.com/users/nipy/orgs","repos_url":"https://api.github.com/users/nipy/repos","events_url":"https://api.github.com/users/nipy/events{/privacy}","received_events_url":"https://api.github.com/users/nipy/received_events","type":"Organization","site_admin":false},"repo":{"id":505209,"name":"dipy","full_name":"nipy/dipy","owner":{"login":"nipy","id":233707,"avatar_url":"https://avatars.githubusercontent.com/u/233707?v=3","gravatar_id":"","url":"https://api.github.com/users/nipy","html_url":"https://github.com/nipy","followers_url":"https://api.github.com/users/nipy/followers","following_url":"https://api.github.com/users/nipy/following{/other_user}","gists_url":"https://api.github.com/users/nipy/gists{/gist_id}","starred_url":"https://api.github.com/users/nipy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nipy/subscriptions","organizations_url":"https://api.github.com/users/nipy/orgs","repos_url":"https://api.github.com/users/nipy/repos","events_url":"https://api.github.com/users/nipy/events{/privacy}","received_events_url":"https://api.github.com/users/nipy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nipy/dipy","description":"Diffusion MR Imaging in Python","fork":false,"url":"https://api.github.com/repos/nipy/dipy","forks_url":"https://api.github.com/repos/nipy/dipy/forks","keys_url":"https://api.github.com/repos/nipy/dipy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nipy/dipy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nipy/dipy/teams","hooks_url":"https://api.github.com/repos/nipy/dipy/hooks","issue_events_url":"https://api.github.com/repos/nipy/dipy/issues/events{/number}","events_url":"https://api.github.com/repos/nipy/dipy/events","assignees_url":"https://api.github.com/repos/nipy/dipy/assignees{/user}","branches_url":"https://api.github.com/repos/nipy/dipy/branches{/branch}","tags_url":"https://api.github.com/repos/nipy/dipy/tags","blobs_url":"https://api.github.com/repos/nipy/dipy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nipy/dipy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nipy/dipy/git/refs{/sha}","trees_url":"https://api.github.com/repos/nipy/dipy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nipy/dipy/statuses/{sha}","languages_url":"https://api.github.com/repos/nipy/dipy/languages","stargazers_url":"https://api.github.com/repos/nipy/dipy/stargazers","contributors_url":"https://api.github.com/repos/nipy/dipy/contributors","subscribers_url":"https://api.github.com/repos/nipy/dipy/subscribers","subscription_url":"https://api.github.com/repos/nipy/dipy/subscription","commits_url":"https://api.github.com/repos/nipy/dipy/commits{/sha}","git_commits_url":"https://api.github.com/repos/nipy/dipy/git/commits{/sha}","comments_url":"https://api.github.com/repos/nipy/dipy/comments{/number}","issue_comment_url":"https://api.github.com/repos/nipy/dipy/issues/comments{/number}","contents_url":"https://api.github.com/repos/nipy/dipy/contents/{+path}","compare_url":"https://api.github.com/repos/nipy/dipy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nipy/dipy/merges","archive_url":"https://api.github.com/repos/nipy/dipy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nipy/dipy/downloads","issues_url":"https://api.github.com/repos/nipy/dipy/issues{/number}","pulls_url":"https://api.github.com/repos/nipy/dipy/pulls{/number}","milestones_url":"https://api.github.com/repos/nipy/dipy/milestones{/number}","notifications_url":"https://api.github.com/repos/nipy/dipy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nipy/dipy/labels{/name}","releases_url":"https://api.github.com/repos/nipy/dipy/releases{/id}","deployments_url":"https://api.github.com/repos/nipy/dipy/deployments","created_at":"2010-02-06T11:43:08Z","updated_at":"2016-09-10T01:26:08Z","pushed_at":"2016-09-11T04:46:55Z","git_url":"git://github.com/nipy/dipy.git","ssh_url":"git@github.com:nipy/dipy.git","clone_url":"https://github.com/nipy/dipy.git","svn_url":"https://github.com/nipy/dipy","homepage":"http://dipy.org","size":42028,"stargazers_count":97,"watchers_count":97,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":147,"mirror_url":null,"open_issues_count":155,"forks":147,"open_issues":155,"watchers":97,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nipy/dipy/pulls/1092"},"html":{"href":"https://github.com/nipy/dipy/pull/1092"},"issue":{"href":"https://api.github.com/repos/nipy/dipy/issues/1092"},"comments":{"href":"https://api.github.com/repos/nipy/dipy/issues/1092/comments"},"review_comments":{"href":"https://api.github.com/repos/nipy/dipy/pulls/1092/comments"},"review_comment":{"href":"https://api.github.com/repos/nipy/dipy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nipy/dipy/pulls/1092/commits"},"statuses":{"href":"https://api.github.com/repos/nipy/dipy/statuses/96fc465becb619b02db81b254897f7b25c7896e5"}}}}
{"actor":{"display_login":"Garyfallidis"}}