Exemplo n.º 1
0
In the next step, we need to make sure that all the streamlines in each bundle
are oriented the same way. For example, for the CST, we want to make sure that
all the bundles have their cortical termination at one end of the streamline.
This is that when we later extract values from a volume, we won't have different
streamlines going in opposite directions.

To orient all the streamlines in each bundles, we will create standard
streamlines, by finding the centroids of the left AF and CST bundle models.

The advantage of using the model bundles is that we can use the same standard
for different subjects, which means that we'll get roughly the same orientation
"""

import dipy.data as dpd
from dipy.data.fetcher import get_two_hcp842_bundles
model_af_l_file, model_cst_l_file = get_two_hcp842_bundles()

model_af_l, hdr = load_trk(model_af_l_file)
model_cst_l, hdr = load_trk(model_cst_l_file)


from dipy.segment.metric import (AveragePointwiseEuclideanMetric,
                                 ResampleFeature)
from dipy.segment.clustering import QuickBundles

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

"""
Since we are going to include all of the streamlines in the single cluster
from the streamlines, we set the threshold to `np.inf`. We pull out the
Exemplo n.º 2
0
              size=(600, 600))
if interactive:
    window.show(ren)
"""
.. figure:: tractograms_after_registration.png
   :align: center

   Atlas and target after registration.

"""
"""
Read AF left and CST left bundles from already fetched atlas data to use them
as model bundles
"""

model_af_l_file, model_cst_l_file = get_two_hcp842_bundles()
"""
Extracting bundles using recobundles [Garyfallidis17]_
"""

sft_af_l = load_trk(model_af_l_file, "same", bbox_valid_check=False)
model_af_l = sft_af_l.streamlines

rb = RecoBundles(moved, verbose=True)

recognized_af_l, af_l_labels = rb.recognize(model_bundle=model_af_l,
                                            model_clust_thr=5.,
                                            reduction_thr=10,
                                            reduction_distance='mam',
                                            slr=True,
                                            slr_metric='asymmetric',
Exemplo n.º 3
0
if interactive:
    window.show(ren)
"""
.. figure:: tractograms_after_registration.png
   :align: center

   Atlas and target after registration.

"""
"""
Read AF left and CST left bundles from already fetched atlas data to use them
as model bundles
"""

from dipy.data.fetcher import get_two_hcp842_bundles
bundle1, bundle2 = get_two_hcp842_bundles()
"""
Extracting bundles using recobundles [Garyfallidis17]_
"""

model_bundle, _ = load_trk(bundle1)

rb = RecoBundles(moved, verbose=True)

recognized_bundle, rec_labels = rb.recognize(model_bundle=model_bundle,
                                             model_clust_thr=5.,
                                             reduction_thr=10,
                                             reduction_distance='mam',
                                             slr=True,
                                             slr_metric='asymmetric',
                                             pruning_distance='mam')