GitHub PullRequestReviewCommentEvent at 2014-12-17 01:44:50
Repository: dipy
Actor: arokem
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/nipy/dipy/pulls/comments/21947795","id":21947795,"diff_hunk":"@@ -0,0 +1,153 @@\n+\"\"\"\n+.. _sfm-track:\n+\n+==================================================\n+Tracking with the Sparse Fascicle Model\n+==================================================\n+\n+Tracking requires a per-voxel model. Here, the model is the Sparse Fascicle\n+Model, described in [Rokem2014]_. This model reconstructs the diffusion signal\n+as a combination of the signals from different fascicles (see also\n+:ref:`sfm-reconst`).\n+\n+To begin, we read the Stanford HARDI data-set into memory:\n+\"\"\"\n+\n+from dipy.data import read_stanford_labels\n+hardi_img, gtab, labels_img = read_stanford_labels()\n+data = hardi_img.get_data()\n+labels = labels_img.get_data()\n+affine = hardi_img.get_affine()\n+\n+\"\"\"\n+This dataset provides a label map (generated using Freesurfer), in which the\n+white matter voxels are labeled as either 1 or 2:\n+\"\"\"\n+\n+white_matter = (labels == 1) | (labels == 2)\n+\n+\"\"\"\n+The first step in tracking is generating a model from which tracking directions\n+can be extracted in every voxel.\n+\n+For the SFM, this requires first that we define a canonical response function\n+that will be used to deconvolve the signal in every voxel\n+\"\"\"\n+\n+from dipy.reconst.csdeconv import auto_response\n+response, ratio = auto_response(gtab, data, roi_radius=10, fa_thr=0.7)\n+\n+\n+\"\"\"\n+We initialize an SFM model object, using this response function and using the\n+default sphere (362  vertices, symmetrically distributed on the surface of the\n+sphere):\n+\"\"\"\n+\n+from dipy.data import get_sphere\n+sphere = get_sphere()\n+from dipy.reconst import sfm\n+sf_model = sfm.SparseFascicleModel(gtab, sphere=sphere,\n+                                   l1_ratio=0.5, alpha=0.001,\n+                                   response=response[0])\n+\n+\"\"\"\n+We fit this model to the data in each voxel in the white-matter mask, so that\n+we can use these directions in tracking:\n+\"\"\"\n+\n+from dipy.reconst.peaks import peaks_from_model\n+\n+pnm = peaks_from_model(sf_model, data, sphere,\n+                       relative_peak_threshold=.5,\n+                       min_separation_angle=25,\n+                       mask=white_matter,\n+                       parallel=True\n+                       )\n+\n+\"\"\"\n+A ThresholdTissueClassifier object is used to segment the data to track only\n+through areas in which the Generalized Fractional Anisotropy (GFA) is\n+sufficiently high.\n+\"\"\"\n+\n+from dipy.tracking.local import ThresholdTissueClassifier\n+classifier = ThresholdTissueClassifier(pnm.gfa, .25)\n+\n+\"\"\"\n+Tracking will be started from a set of seeds evenly distributed in the white\n+matter:\n+\"\"\"\n+\n+from dipy.tracking import utils\n+seeds = utils.seeds_from_mask(white_matter, density=[2, 2, 2], affine=affine)\n+\n+\"\"\"\n+For the sake of brevity, we will take only the first 1000 seeds, generating\n+only 1000 streamlines. Remove this line to track from many more points in all of\n+the white matter\n+\"\"\"\n+\n+seeds = seeds[:1000]\n+\n+\"\"\"\n+We now have the necessary components to construct a tracking pipeline and\n+execute the tracking\n+\"\"\"\n+\n+from dipy.tracking.local import LocalTracking\n+streamlines = LocalTracking(pnm, classifier, seeds, affine, step_size=.5)\n+\n+streamlines = list(streamlines)","path":"doc/examples/sfm_tracking.py","position":101,"original_position":101,"commit_id":"558ebf74e291819425d61e30682c8c9d643e2b6d","original_commit_id":"f9209cd6b2f2e1684a61bd9bd058badb7eab7036","user":{"login":"arokem","id":118582,"avatar_url":"https://avatars.githubusercontent.com/u/118582?v=3","gravatar_id":"","url":"https://api.github.com/users/arokem","html_url":"https://github.com/arokem","followers_url":"https://api.github.com/users/arokem/followers","following_url":"https://api.github.com/users/arokem/following{/other_user}","gists_url":"https://api.github.com/users/arokem/gists{/gist_id}","starred_url":"https://api.github.com/users/arokem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arokem/subscriptions","organizations_url":"https://api.github.com/users/arokem/orgs","repos_url":"https://api.github.com/users/arokem/repos","events_url":"https://api.github.com/users/arokem/events{/privacy}","received_events_url":"https://api.github.com/users/arokem/received_events","type":"User","site_admin":false},"body":"OK - all set - I think. Do it!\r\n\r\nOn Tue, Dec 16, 2014 at 4:49 PM, Ariel Rokem <arokem@gmail.com> wrote:\r\n>\r\n> Will do ASAP.\r\n>\r\n> On Tue, Dec 16, 2014 at 4:48 PM, Eleftherios Garyfallidis <\r\n> notifications@github.com> wrote:\r\n>>\r\n>> In doc/examples/sfm_tracking.py\r\n>> <https://github.com/nipy/dipy/pull/460#discussion-diff-21945407>:\r\n>>\r\n>> > +For the sake of brevity, we will take only the first 1000 seeds, generating\r\n>> > +only 1000 streamlines. Remove this line to track from many more points in all of\r\n>> > +the white matter\r\n>> > +\"\"\"\r\n>> > +\r\n>> > +seeds = seeds[:1000]\r\n>> > +\r\n>> > +\"\"\"\r\n>> > +We now have the necessary components to construct a tracking pipeline and\r\n>> > +execute the tracking\r\n>> > +\"\"\"\r\n>> > +\r\n>> > +from dipy.tracking.local import LocalTracking\r\n>> > +streamlines = LocalTracking(pnm, classifier, seeds, affine, step_size=.5)\r\n>> > +\r\n>> > +streamlines = list(streamlines)\r\n>>\r\n>> If someone does here what you suggest and remove that line it will crash\r\n>> his memory because later in fvtk.streamtube the program will try to create\r\n>> streamtubes for too many streamlines. What I would do is to use all the\r\n>> seeds here but later in the visualization I would use\r\n>> select_random_set_of_streamlines from dipy.tracking.streamline and\r\n>> visualize only a random set of all the streamlines generated. If you agree\r\n>> with the suggestion and change this I will merge this PR. Thx again.\r\n>>\r\n>> —\r\n>> Reply to this email directly or view it on GitHub\r\n>> <https://github.com/nipy/dipy/pull/460/files#r21945407>.\r\n>>\r\n>","created_at":"2014-12-17T01:44:50Z","updated_at":"2014-12-17T01:44:50Z","html_url":"https://github.com/nipy/dipy/pull/460#discussion_r21947795","pull_request_url":"https://api.github.com/repos/nipy/dipy/pulls/460","_links":{"self":{"href":"https://api.github.com/repos/nipy/dipy/pulls/comments/21947795"},"html":{"href":"https://github.com/nipy/dipy/pull/460#discussion_r21947795"},"pull_request":{"href":"https://api.github.com/repos/nipy/dipy/pulls/460"}}},"pull_request":{"url":"https://api.github.com/repos/nipy/dipy/pulls/460","id":24253002,"html_url":"https://github.com/nipy/dipy/pull/460","diff_url":"https://github.com/nipy/dipy/pull/460.diff","patch_url":"https://github.com/nipy/dipy/pull/460.patch","issue_url":"https://api.github.com/repos/nipy/dipy/issues/460","number":460,"state":"open","locked":false,"title":"Sparse Fascicle Model","user":{"login":"arokem","id":118582,"avatar_url":"https://avatars.githubusercontent.com/u/118582?v=3","gravatar_id":"","url":"https://api.github.com/users/arokem","html_url":"https://github.com/arokem","followers_url":"https://api.github.com/users/arokem/followers","following_url":"https://api.github.com/users/arokem/following{/other_user}","gists_url":"https://api.github.com/users/arokem/gists{/gist_id}","starred_url":"https://api.github.com/users/arokem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arokem/subscriptions","organizations_url":"https://api.github.com/users/arokem/orgs","repos_url":"https://api.github.com/users/arokem/repos","events_url":"https://api.github.com/users/arokem/events{/privacy}","received_events_url":"https://api.github.com/users/arokem/received_events","type":"User","site_admin":false},"body":"This is a start on an implementation of the model we describe here: \r\n\r\nhttp://arxiv.org/abs/1411.0721\r\n\r\nThe main current issue with this is that this will have a local dependency on scikit-learn, because it uses ElasticNet for the fit. How do people feel about that? ","created_at":"2014-11-11T21:53:31Z","updated_at":"2014-12-17T01:44:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"07e19aa5ed9cff1108d8af73dce34e5eb25fcaa2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nipy/dipy/pulls/460/commits","review_comments_url":"https://api.github.com/repos/nipy/dipy/pulls/460/comments","review_comment_url":"https://api.github.com/repos/nipy/dipy/pulls/comments/{number}","comments_url":"https://api.github.com/repos/nipy/dipy/issues/460/comments","statuses_url":"https://api.github.com/repos/nipy/dipy/statuses/558ebf74e291819425d61e30682c8c9d643e2b6d","head":{"label":"arokem:sparse-fascicle","ref":"sparse-fascicle","sha":"558ebf74e291819425d61e30682c8c9d643e2b6d","user":{"login":"arokem","id":118582,"avatar_url":"https://avatars.githubusercontent.com/u/118582?v=3","gravatar_id":"","url":"https://api.github.com/users/arokem","html_url":"https://github.com/arokem","followers_url":"https://api.github.com/users/arokem/followers","following_url":"https://api.github.com/users/arokem/following{/other_user}","gists_url":"https://api.github.com/users/arokem/gists{/gist_id}","starred_url":"https://api.github.com/users/arokem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arokem/subscriptions","organizations_url":"https://api.github.com/users/arokem/orgs","repos_url":"https://api.github.com/users/arokem/repos","events_url":"https://api.github.com/users/arokem/events{/privacy}","received_events_url":"https://api.github.com/users/arokem/received_events","type":"User","site_admin":false},"repo":{"id":2484790,"name":"dipy","full_name":"arokem/dipy","owner":{"login":"arokem","id":118582,"avatar_url":"https://avatars.githubusercontent.com/u/118582?v=3","gravatar_id":"","url":"https://api.github.com/users/arokem","html_url":"https://github.com/arokem","followers_url":"https://api.github.com/users/arokem/followers","following_url":"https://api.github.com/users/arokem/following{/other_user}","gists_url":"https://api.github.com/users/arokem/gists{/gist_id}","starred_url":"https://api.github.com/users/arokem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arokem/subscriptions","organizations_url":"https://api.github.com/users/arokem/orgs","repos_url":"https://api.github.com/users/arokem/repos","events_url":"https://api.github.com/users/arokem/events{/privacy}","received_events_url":"https://api.github.com/users/arokem/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/arokem/dipy","description":"Diffusion MR Imaging in Python","fork":true,"url":"https://api.github.com/repos/arokem/dipy","forks_url":"https://api.github.com/repos/arokem/dipy/forks","keys_url":"https://api.github.com/repos/arokem/dipy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/arokem/dipy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/arokem/dipy/teams","hooks_url":"https://api.github.com/repos/arokem/dipy/hooks","issue_events_url":"https://api.github.com/repos/arokem/dipy/issues/events{/number}","events_url":"https://api.github.com/repos/arokem/dipy/events","assignees_url":"https://api.github.com/repos/arokem/dipy/assignees{/user}","branches_url":"https://api.github.com/repos/arokem/dipy/branches{/branch}","tags_url":"https://api.github.com/repos/arokem/dipy/tags","blobs_url":"https://api.github.com/repos/arokem/dipy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/arokem/dipy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/arokem/dipy/git/refs{/sha}","trees_url":"https://api.github.com/repos/arokem/dipy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/arokem/dipy/statuses/{sha}","languages_url":"https://api.github.com/repos/arokem/dipy/languages","stargazers_url":"https://api.github.com/repos/arokem/dipy/stargazers","contributors_url":"https://api.github.com/repos/arokem/dipy/contributors","subscribers_url":"https://api.github.com/repos/arokem/dipy/subscribers","subscription_url":"https://api.github.com/repos/arokem/dipy/subscription","commits_url":"https://api.github.com/repos/arokem/dipy/commits{/sha}","git_commits_url":"https://api.github.com/repos/arokem/dipy/git/commits{/sha}","comments_url":"https://api.github.com/repos/arokem/dipy/comments{/number}","issue_comment_url":"https://api.github.com/repos/arokem/dipy/issues/comments/{number}","contents_url":"https://api.github.com/repos/arokem/dipy/contents/{+path}","compare_url":"https://api.github.com/repos/arokem/dipy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/arokem/dipy/merges","archive_url":"https://api.github.com/repos/arokem/dipy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/arokem/dipy/downloads","issues_url":"https://api.github.com/repos/arokem/dipy/issues{/number}","pulls_url":"https://api.github.com/repos/arokem/dipy/pulls{/number}","milestones_url":"https://api.github.com/repos/arokem/dipy/milestones{/number}","notifications_url":"https://api.github.com/repos/arokem/dipy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/arokem/dipy/labels{/name}","releases_url":"https://api.github.com/repos/arokem/dipy/releases{/id}","created_at":"2011-09-29T20:43:30Z","updated_at":"2014-12-12T22:50:23Z","pushed_at":"2014-12-17T01:40:31Z","git_url":"git://github.com/arokem/dipy.git","ssh_url":"git@github.com:arokem/dipy.git","clone_url":"https://github.com/arokem/dipy.git","svn_url":"https://github.com/arokem/dipy","homepage":"http://dipy.org","size":16750,"stargazers_count":3,"watchers_count":3,"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":3,"default_branch":"master"}},"base":{"label":"nipy:master","ref":"master","sha":"78b0b1cd736ee422230e91a3d82b03a581d40611","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}","created_at":"2010-02-06T11:43:08Z","updated_at":"2014-12-17T00:51:44Z","pushed_at":"2014-12-17T00:51:44Z","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":17918,"stargazers_count":48,"watchers_count":48,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":71,"mirror_url":null,"open_issues_count":53,"forks":71,"open_issues":53,"watchers":48,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nipy/dipy/pulls/460"},"html":{"href":"https://github.com/nipy/dipy/pull/460"},"issue":{"href":"https://api.github.com/repos/nipy/dipy/issues/460"},"comments":{"href":"https://api.github.com/repos/nipy/dipy/issues/460/comments"},"review_comments":{"href":"https://api.github.com/repos/nipy/dipy/pulls/460/comments"},"review_comment":{"href":"https://api.github.com/repos/nipy/dipy/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/nipy/dipy/pulls/460/commits"},"statuses":{"href":"https://api.github.com/repos/nipy/dipy/statuses/558ebf74e291819425d61e30682c8c9d643e2b6d"}}}}