New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A few tractometry functions #1695
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this @arokem. I just have a few request:
- Can you rebase this PR?
- Can you add a short tutorial here?
- I think it will be better to avoid
list of array
promotion and useStreamlines
class everywhere. I do not understand why you convert yourStreamlines
object into anp.array
. It should be the opposite.
dipy/tracking/streamline.py
Outdated
Parameters | ||
---------- | ||
data : 3D volume | ||
bundle : StreamLines class instance, list of arrays, or array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
due to memory issue, I think we should avoid to promote list of arrays
and only use Streamlines class instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Changed here and in the docstring above.
I am trying to create an example, which would follow the bundle extraction example, using these bundles to do tractometry. For that, I will also need parameter maps for this subject. @Garyfallidis: Which of the HCP subjects was used to create the |
Sorry - @BramshQamar : I see that you made that tutorial. Do you know which subject |
Hello @arokem, we used subject 100206 from HCP data to create target tractogram for bundle extraction example. |
Codecov Report
@@ Coverage Diff @@
## master #1695 +/- ##
=========================================
Coverage ? 84.29%
=========================================
Files ? 115
Lines ? 13748
Branches ? 2176
=========================================
Hits ? 11589
Misses ? 1653
Partials ? 506
|
Hello @arokem, Thank you for updating !
Comment last updated on February 28, 2019 at 03:44 Hours UTC |
07cfef0
to
b938a61
Compare
I added an example usage in f727bde. I had to introduce some changes in the bundle extraction example, because I am reusing the bundles generated in that example. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the tutorial! I need to play a bit more with it but in overall, It looks good to me.
dipy/tracking/streamline.py
Outdated
# This should come back as a 3D covariance matrix with the spatial | ||
# variance covariance of this node across the different streamlines | ||
# This is a 3-by-3 array: | ||
node_coords = bundle.data[node::n_points] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[node::n_points]
Nice! 👍
After a rebase, this PR is ready to go, it will be good if someone could have a look on this one |
9577808
to
7fff8bd
Compare
Now rebased!
…On Mon, Jan 14, 2019 at 8:55 AM Serge Koudoro ***@***.***> wrote:
After a rebase, this PR is ready to go, it will be good if someone could
have a look on this one
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1695 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAHPNmqyyHZzBPIOvrp2Hx_zC_VtgfVhks5vDLabgaJpZM4ZXTgw>
.
|
Any more thoughts here? |
7dcbd28
to
011797a
Compare
Rebased again, after the #1652 merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will merge this on Wednesday if there is no other comment.
Can you fix the small rebase residue below @arokem?
doc/examples_index.rst
Outdated
@@ -167,6 +167,10 @@ Streamline analysis and connectivity | |||
- :ref:`example_streamline_length` | |||
- :ref:`example_cluster_confidence` | |||
- :ref:`example_path_length_map` | |||
<<<<<<< HEAD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rebase residue
doc/examples_index.rst
Outdated
<<<<<<< HEAD | ||
======= | ||
- :ref:`example_bundle_profiles` | ||
>>>>>>> Adds an example of bundle profile extraction (tractometry) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rebase residue
Oh - sorry about that - should be fixed now.
…On Fri, Feb 1, 2019 at 7:29 AM Serge Koudoro ***@***.***> wrote:
***@***.**** commented on this pull request.
I will merge this on Wednesday if there is no other comment.
Can you fix the small rebase residue below @arokem
<https://github.com/arokem>?
------------------------------
In doc/examples_index.rst
<#1695 (comment)>:
> @@ -167,6 +167,10 @@ Streamline analysis and connectivity
- :ref:`example_streamline_length`
- :ref:`example_cluster_confidence`
- :ref:`example_path_length_map`
+<<<<<<< HEAD
rebase residue
------------------------------
In doc/examples_index.rst
<#1695 (comment)>:
> @@ -167,6 +167,10 @@ Streamline analysis and connectivity
- :ref:`example_streamline_length`
- :ref:`example_cluster_confidence`
- :ref:`example_path_length_map`
+<<<<<<< HEAD
+=======
+- :ref:`example_bundle_profiles`
+>>>>>>> Adds an example of bundle profile extraction (tractometry)
rebase residue
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1695 (review)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAHPNutWecKLPDMpOyUHAeeJc6vv3pbgks5vJF1mgaJpZM4ZXTgw>
.
|
Does anyone else want to take a look? Any reason not to merge this? |
ping @Garyfallidis |
867ea80
to
8e95524
Compare
Looks like a new release of cvxpy is breaking MAPMRI. |
I just did a quick check on |
Hi @arokem, I just created this issue https://github.com/cvxgrp/cvxpy/issues/672 for our |
Pin the cvxpy version to the previous release for now? |
Implemented in cbf9275, I think. |
Great! Thanks! we have to put a reminder somewhere for coming back to normal later |
cbf9275
to
61271d9
Compare
This reverts commit cbf9275.
Also, add references, fix typo in documentation.
Also, multiple other changes according to review by @Garyfallidis.
f876c9e
to
4ca465a
Compare
Now also rebased. |
@arokem ready for final check? |
I believe so! |
dipy/segment/bundles.py
Outdated
return w / np.sum(w, 0) | ||
|
||
|
||
def afq_tract_profile(data, bundle, affine=None, n_points=100, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are already in bundles.py no need for tract. I would just say afq_profile.
I added a last comment. Please correct and ping me to merge! :) |
In general I use bundles to mean tracts, fascicles, muscle fibers etc. The tools are quite generic so I think bundles is good name to use. I don't think we need to specify tracts anymore. However, in the tutorial it is good to have some anatomical naming standards. Which you do 👍 |
Yeah - good call. Renamed! |
616abbe
to
f898e1a
Compare
For tractometry, we want to be able to extract the profiles along the length of a bundle
This PR introduces a couple of useful functions for that:
bundle_profile
takes a bundle and returns the values along the length of the bundle, resampled to 100 (or some other number of) nodes.gaussian_weights
allows you to weight the streamlines within a bundle, depending on how far they are from the core of the bundle.orient_by_streamline
will make sure that a bundle is all oriented in the same direction (using the other functions without doing this will result in erroneous results!), based on the trajectory of a "standard" streamline.Thanks to @jyeatman for guidance in implementing these in the prototype implementation we are using in pyAFQ!