Skip to content
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

Questions about a custom bundle #1162

Open
htakemur opened this issue Sep 11, 2024 · 3 comments
Open

Questions about a custom bundle #1162

htakemur opened this issue Sep 11, 2024 · 3 comments

Comments

@htakemur
Copy link

htakemur commented Sep 11, 2024

Hello @arokem

I follow your suggestions to read the tutorial below to calculate the tract profile for custom bundles.
https://github.com/dipy/dipy/blob/master/doc/examples/afq_tract_profiles.py

It looks like the following part of the code handle orientation of fiber tract consistent across subjects, based on comparison with known fiber tract orientation.

model_arc_l_file, model_cst_l_file = get_two_hcp842_bundles()

model_arc_l = load_trk(
model_arc_l_file, reference="same", bbox_valid_check=False
).streamlines
model_cst_l = load_trk(
model_cst_l_file, reference="same", bbox_valid_check=False
).streamlines

feature = ResampleFeature(nb_points=100)
metric = AveragePointwiseEuclideanMetric(feature)

qb = QuickBundles(threshold=np.inf, metric=metric)

cluster_cst_l = qb.cluster(model_cst_l)
standard_cst_l = cluster_cst_l.centroids[0]

cluster_af_l = qb.cluster(model_arc_l)
standard_af_l = cluster_af_l.centroids[0]

oriented_cst_l = dts.orient_by_streamline(cst_l, standard_cst_l)
oriented_arc_l = dts.orient_by_streamline(arc_l, standard_af_l)

However, if the bundle is not included in these widely studied bundles, do you have any suggestions on how to ensure the consistency of orientation of fiber tracts across subjects (to avoid that tract profile direction is not flipped across subjects)?

@arokem
Copy link
Collaborator

arokem commented Sep 11, 2024

Hi! That is indeed a challenge. One option I can think of is to use one subject as a "template" subject, using their bundles for the clustering and then using their centroids as the streamline according to which all the other subjects streamlines get oriented. You might want to play around with this a bit, for example to make sure that the bundles are oriented the same way in both hemispheres. Depending on the length of the bundle and its location in the brain, that might work well for all subjects. You'd probably want to check this, e.g., by plotting the node indices along the length of the bundle. See also this neurostars post for a couple of examples, and some code to do this: https://neurostars.org/t/putting-mrtrix-tractography-into-pyafq/26780/7?u=ariel_rokem.

@36000
Copy link
Collaborator

36000 commented Sep 11, 2024

This function could be useful:

def orient_by_streamline(sls, template_sl):

@htakemur
Copy link
Author

@arokem @36000 Thank you very much for your response! I will try to follow what you suggest and contact back to you in this thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants