Callosal bundles using AFQ API#

An example using the AFQ API to find callosal bundles using the templates from: http://hdl.handle.net/1773/34926

import os.path as op

import plotly

from AFQ.api.group import GroupAFQ
import AFQ.api.bundle_dict as abd
from AFQ.definitions.image import RoiImage
import AFQ.data.fetch as afd

Get some example data#

Retrieves Stanford HARDI dataset.

afd.organize_stanford_data(clear_previous_afq=True)

Set tractography parameters (optional)#

We make this tracking_params which we will pass to the GroupAFQ object which specifies that we want 100,000 seeds randomly distributed in the ROIs of every bundle.

We only do this to make this example faster and consume less space.

tracking_params = dict(seed_mask=RoiImage(),
                       n_seeds=10000,
                       random_seeds=True,
                       rng_seed=42)

Set segmentation parameters (optional)#

We make this segmentation_params which we will pass to the GroupAFQ object which specifies that we want to clip the extracted tract profiles to only be between the two ROIs.

We do this because tract profiles become less reliable as the bundles approach the gray matter-white matter boundary. On some of the non-callosal bundles, ROIs are not in a good position to clip edges. In these cases, one can remove the first and last nodes in a tract profile.

segmentation_params = {"clip_edges": True}

Initialize a GroupAFQ object:#

We specify bundle_info as the callosal bundles only (abd.CALLOSUM_BUNDLES). If we want to segment both the callosum and the other bundles, we would pass abd.CALLOSUM_BUNDLES + abd.BUNDLES instead. This would tell the GroupAFQ object to use bundles from both the standard and callosal templates.

myafq = GroupAFQ(
    bids_path=op.join(afd.afq_home, 'stanford_hardi'),
    preproc_pipeline='vistasoft',
    bundle_info=abd.CALLOSUM_BUNDLES,
    tracking_params=tracking_params,
    segmentation_params=segmentation_params,
    viz_backend_spec='plotly_no_gif')

# Calling export all produces all of the outputs of processing, including
# tractography, scalar maps, tract profiles and visualizations:
myafq.export_all()

Out:

  0%|          | 0/145758.0 [00:00<?, ?it/s]
  0%|          | 67/145758.0 [00:00<03:37, 669.74it/s]
  0%|          | 208/145758.0 [00:00<02:11, 1103.53it/s]
  0%|          | 466/145758.0 [00:00<01:21, 1774.31it/s]
  1%|          | 762/145758.0 [00:00<01:04, 2241.57it/s]
  1%|          | 1076/145758.0 [00:00<00:56, 2562.61it/s]
  1%|          | 1373/145758.0 [00:00<00:53, 2700.64it/s]
  1%|1         | 1678/145758.0 [00:00<00:51, 2811.92it/s]
  1%|1         | 1997/145758.0 [00:00<00:49, 2930.49it/s]
  2%|1         | 2296/145758.0 [00:00<00:48, 2946.93it/s]
  2%|1         | 2611/145758.0 [00:01<00:47, 3009.35it/s]
  2%|2         | 2935/145758.0 [00:01<00:46, 3077.33it/s]
  2%|2         | 3255/145758.0 [00:01<00:45, 3111.71it/s]
  2%|2         | 3567/145758.0 [00:01<00:46, 3091.08it/s]
  3%|2         | 3885/145758.0 [00:01<00:45, 3115.78it/s]
  3%|2         | 4210/145758.0 [00:01<00:44, 3154.57it/s]
  3%|3         | 4526/145758.0 [00:01<00:44, 3145.83it/s]
  3%|3         | 4843/145758.0 [00:01<00:44, 3151.42it/s]
  4%|3         | 5178/145758.0 [00:01<00:43, 3209.30it/s]
  4%|3         | 5510/145758.0 [00:01<00:43, 3239.98it/s]
  4%|4         | 5835/145758.0 [00:02<00:43, 3241.33it/s]
  4%|4         | 6160/145758.0 [00:02<00:43, 3226.34it/s]
  4%|4         | 6496/145758.0 [00:02<00:42, 3264.25it/s]
  5%|4         | 6832/145758.0 [00:02<00:42, 3290.37it/s]
  5%|4         | 7181/145758.0 [00:02<00:41, 3348.80it/s]
  5%|5         | 7517/145758.0 [00:02<00:41, 3351.66it/s]
  5%|5         | 7853/145758.0 [00:02<00:41, 3290.47it/s]
  6%|5         | 8199/145758.0 [00:02<00:41, 3338.27it/s]
  6%|5         | 8543/145758.0 [00:02<00:40, 3368.12it/s]
  6%|6         | 8899/145758.0 [00:02<00:39, 3423.55it/s]
  6%|6         | 9242/145758.0 [00:03<00:39, 3423.76it/s]
  7%|6         | 9585/145758.0 [00:03<00:40, 3371.04it/s]
  7%|6         | 9928/145758.0 [00:03<00:40, 3388.11it/s]
  7%|7         | 10283/145758.0 [00:03<00:39, 3432.70it/s]
  7%|7         | 10643/145758.0 [00:03<00:38, 3481.09it/s]
  8%|7         | 11005/145758.0 [00:03<00:38, 3521.93it/s]
  8%|7         | 11358/145758.0 [00:03<00:38, 3498.34it/s]
  8%|8         | 11708/145758.0 [00:03<00:39, 3427.58it/s]
  8%|8         | 12065/145758.0 [00:03<00:38, 3467.95it/s]
  9%|8         | 12431/145758.0 [00:03<00:37, 3523.80it/s]
  9%|8         | 12802/145758.0 [00:04<00:37, 3575.13it/s]
  9%|9         | 13163/145758.0 [00:04<00:36, 3584.62it/s]
  9%|9         | 13522/145758.0 [00:04<00:37, 3561.86it/s]
 10%|9         | 13879/145758.0 [00:04<00:37, 3500.85it/s]
 10%|9         | 14239/145758.0 [00:04<00:37, 3527.77it/s]
 10%|#         | 14599/145758.0 [00:04<00:36, 3548.77it/s]
 10%|#         | 14970/145758.0 [00:04<00:36, 3594.83it/s]
 11%|#         | 15339/145758.0 [00:04<00:36, 3619.88it/s]
 11%|#         | 15702/145758.0 [00:04<00:36, 3583.82it/s]
 11%|#1        | 16061/145758.0 [00:04<00:36, 3530.37it/s]
 11%|#1        | 16420/145758.0 [00:05<00:36, 3544.47it/s]
 12%|#1        | 16801/145758.0 [00:05<00:35, 3621.93it/s]
 12%|#1        | 17169/145758.0 [00:05<00:35, 3637.69it/s]
 12%|#2        | 17537/145758.0 [00:05<00:35, 3649.32it/s]
 12%|#2        | 17903/145758.0 [00:05<00:35, 3598.48it/s]
 13%|#2        | 18264/145758.0 [00:05<00:35, 3579.75it/s]
 13%|#2        | 18629/145758.0 [00:05<00:35, 3599.28it/s]
 13%|#3        | 19011/145758.0 [00:05<00:34, 3662.85it/s]
 13%|#3        | 19387/145758.0 [00:05<00:34, 3687.09it/s]
 14%|#3        | 19759/145758.0 [00:05<00:34, 3695.97it/s]
 14%|#3        | 20129/145758.0 [00:06<00:34, 3689.12it/s]
 14%|#4        | 20498/145758.0 [00:06<00:33, 3685.58it/s]
 14%|#4        | 20867/145758.0 [00:06<00:34, 3598.96it/s]
 15%|#4        | 21261/145758.0 [00:06<00:33, 3698.02it/s]
 15%|#4        | 21640/145758.0 [00:06<00:33, 3722.68it/s]
 15%|#5        | 22020/145758.0 [00:06<00:33, 3745.25it/s]
 15%|#5        | 22397/145758.0 [00:06<00:32, 3750.92it/s]
 16%|#5        | 22774/145758.0 [00:06<00:32, 3755.24it/s]
 16%|#5        | 23150/145758.0 [00:06<00:33, 3702.80it/s]
 16%|#6        | 23521/145758.0 [00:06<00:33, 3628.08it/s]
 16%|#6        | 23891/145758.0 [00:07<00:33, 3648.85it/s]
 17%|#6        | 24271/145758.0 [00:07<00:32, 3691.91it/s]
 17%|#6        | 24657/145758.0 [00:07<00:32, 3738.47it/s]
 17%|#7        | 25032/145758.0 [00:07<00:32, 3741.47it/s]
 17%|#7        | 25411/145758.0 [00:07<00:32, 3755.43it/s]
 18%|#7        | 25787/145758.0 [00:07<00:32, 3702.11it/s]
 18%|#7        | 26158/145758.0 [00:07<00:32, 3657.70it/s]
 18%|#8        | 26525/145758.0 [00:07<00:33, 3608.59it/s]
 18%|#8        | 26892/145758.0 [00:07<00:32, 3626.37it/s]
 19%|#8        | 27272/145758.0 [00:07<00:32, 3676.32it/s]
 19%|#8        | 27649/145758.0 [00:08<00:31, 3701.99it/s]
 19%|#9        | 28035/145758.0 [00:08<00:31, 3748.33it/s]
 19%|#9        | 28411/145758.0 [00:08<00:31, 3740.52it/s]
 20%|#9        | 28786/145758.0 [00:08<00:31, 3717.12it/s]
 20%|##        | 29158/145758.0 [00:08<00:31, 3651.69it/s]
 20%|##        | 29524/145758.0 [00:08<00:31, 3634.87it/s]
 21%|##        | 29913/145758.0 [00:08<00:31, 3708.27it/s]
 21%|##        | 30298/145758.0 [00:08<00:30, 3747.86it/s]
 21%|##1       | 30688/145758.0 [00:08<00:30, 3791.83it/s]
 21%|##1       | 31068/145758.0 [00:09<00:30, 3787.75it/s]
 22%|##1       | 31447/145758.0 [00:09<00:30, 3776.59it/s]
 22%|##1       | 31825/145758.0 [00:09<00:30, 3693.88it/s]
 22%|##2       | 32195/145758.0 [00:09<00:30, 3669.23it/s]
 22%|##2       | 32563/145758.0 [00:09<00:30, 3670.04it/s]
 23%|##2       | 32954/145758.0 [00:09<00:30, 3739.97it/s]
 23%|##2       | 33352/145758.0 [00:09<00:29, 3809.52it/s]
 23%|##3       | 33744/145758.0 [00:09<00:29, 3840.09it/s]
 23%|##3       | 34129/145758.0 [00:09<00:29, 3830.47it/s]
 24%|##3       | 34513/145758.0 [00:09<00:29, 3788.12it/s]
 24%|##3       | 34892/145758.0 [00:10<00:29, 3727.67it/s]
 24%|##4       | 35266/145758.0 [00:10<00:29, 3708.04it/s]
 24%|##4       | 35648/145758.0 [00:10<00:29, 3739.82it/s]
 25%|##4       | 36048/145758.0 [00:10<00:28, 3815.75it/s]
 25%|##5       | 36452/145758.0 [00:10<00:28, 3880.31it/s]
 25%|##5       | 36841/145758.0 [00:10<00:28, 3833.99it/s]
 26%|##5       | 37225/145758.0 [00:10<00:28, 3834.94it/s]
 26%|##5       | 37609/145758.0 [00:10<00:29, 3725.55it/s]
 26%|##6       | 37986/145758.0 [00:10<00:28, 3738.37it/s]
 26%|##6       | 38377/145758.0 [00:10<00:28, 3788.76it/s]
 27%|##6       | 38782/145758.0 [00:11<00:27, 3865.92it/s]
 27%|##6       | 39197/145758.0 [00:11<00:26, 3948.33it/s]
 27%|##7       | 39593/145758.0 [00:11<00:27, 3895.06it/s]
 27%|##7       | 39983/145758.0 [00:11<00:27, 3842.66it/s]
 28%|##7       | 40368/145758.0 [00:11<00:27, 3826.36it/s]
 28%|##7       | 40751/145758.0 [00:11<00:27, 3761.85it/s]
 28%|##8       | 41128/145758.0 [00:11<00:28, 3727.60it/s]
 28%|##8       | 41532/145758.0 [00:11<00:27, 3817.83it/s]
 29%|##8       | 41930/145758.0 [00:11<00:26, 3864.08it/s]
 29%|##9       | 42321/145758.0 [00:11<00:26, 3876.88it/s]
 29%|##9       | 42709/145758.0 [00:12<00:26, 3845.37it/s]
 30%|##9       | 43094/145758.0 [00:12<00:26, 3832.14it/s]
 30%|##9       | 43478/145758.0 [00:12<00:27, 3763.89it/s]
 30%|###       | 43855/145758.0 [00:12<00:27, 3720.62it/s]
 30%|###       | 44228/145758.0 [00:12<00:27, 3687.71it/s]
 31%|###       | 44626/145758.0 [00:12<00:26, 3773.35it/s]
 31%|###       | 45021/145758.0 [00:12<00:26, 3825.32it/s]
 31%|###1      | 45411/145758.0 [00:12<00:26, 3845.72it/s]
 31%|###1      | 45799/145758.0 [00:12<00:25, 3854.86it/s]
 32%|###1      | 46185/145758.0 [00:12<00:25, 3836.43it/s]
 32%|###1      | 46569/145758.0 [00:13<00:26, 3774.32it/s]
 32%|###2      | 46947/145758.0 [00:13<00:26, 3708.73it/s]
 32%|###2      | 47326/145758.0 [00:13<00:26, 3731.95it/s]
 33%|###2      | 47738/145758.0 [00:13<00:25, 3844.93it/s]
 33%|###3      | 48136/145758.0 [00:13<00:25, 3882.47it/s]
 33%|###3      | 48547/145758.0 [00:13<00:24, 3949.80it/s]
 34%|###3      | 48946/145758.0 [00:13<00:24, 3959.71it/s]
 34%|###3      | 49343/145758.0 [00:13<00:24, 3950.44it/s]
 34%|###4      | 49739/145758.0 [00:13<00:25, 3827.89it/s]
 34%|###4      | 50123/145758.0 [00:14<00:25, 3776.28it/s]
 35%|###4      | 50502/145758.0 [00:14<00:25, 3762.87it/s]
 35%|###4      | 50905/145758.0 [00:14<00:24, 3840.02it/s]
 35%|###5      | 51322/145758.0 [00:14<00:23, 3935.82it/s]
 35%|###5      | 51717/145758.0 [00:14<00:23, 3936.36it/s]
 36%|###5      | 52111/145758.0 [00:14<00:23, 3919.50it/s]
 36%|###6      | 52504/145758.0 [00:14<00:24, 3879.72it/s]
 36%|###6      | 52893/145758.0 [00:14<00:24, 3753.53it/s]
 37%|###6      | 53274/145758.0 [00:14<00:24, 3766.42it/s]
 37%|###6      | 53677/145758.0 [00:14<00:23, 3842.06it/s]
 37%|###7      | 54075/145758.0 [00:15<00:23, 3881.43it/s]
 37%|###7      | 54483/145758.0 [00:15<00:23, 3938.63it/s]
 38%|###7      | 54890/145758.0 [00:15<00:22, 3974.84it/s]
 38%|###7      | 55288/145758.0 [00:15<00:23, 3922.55it/s]
 38%|###8      | 55681/145758.0 [00:15<00:23, 3806.06it/s]
 38%|###8      | 56063/145758.0 [00:15<00:23, 3743.65it/s]
 39%|###8      | 56449/145758.0 [00:15<00:23, 3776.61it/s]
 39%|###8      | 56841/145758.0 [00:15<00:23, 3817.38it/s]
 39%|###9      | 57228/145758.0 [00:15<00:23, 3830.78it/s]
 40%|###9      | 57635/145758.0 [00:15<00:22, 3900.71it/s]
 40%|###9      | 58030/145758.0 [00:16<00:22, 3914.44it/s]
 40%|####      | 58422/145758.0 [00:16<00:23, 3790.81it/s]
 40%|####      | 58803/145758.0 [00:16<00:23, 3759.95it/s]
 41%|####      | 59180/145758.0 [00:16<00:23, 3755.41it/s]
 41%|####      | 59581/145758.0 [00:16<00:22, 3828.61it/s]
 41%|####1     | 59965/145758.0 [00:16<00:22, 3830.76it/s]
 41%|####1     | 60349/145758.0 [00:16<00:22, 3802.52it/s]
 42%|####1     | 60730/145758.0 [00:16<00:34, 2499.20it/s]
 42%|####1     | 61091/145758.0 [00:17<00:30, 2740.64it/s]
 42%|####2     | 61437/145758.0 [00:17<00:28, 2910.83it/s]
 42%|####2     | 61799/145758.0 [00:17<00:27, 3088.16it/s]
 43%|####2     | 62173/145758.0 [00:17<00:25, 3259.84it/s]
 43%|####2     | 62555/145758.0 [00:17<00:24, 3413.45it/s]
 43%|####3     | 62945/145758.0 [00:17<00:23, 3550.11it/s]
 43%|####3     | 63327/145758.0 [00:17<00:22, 3623.90it/s]
 44%|####3     | 63700/145758.0 [00:17<00:22, 3635.42it/s]
 44%|####3     | 64071/145758.0 [00:17<00:23, 3538.09it/s]
 44%|####4     | 64431/145758.0 [00:17<00:23, 3513.78it/s]
 44%|####4     | 64799/145758.0 [00:18<00:22, 3559.89it/s]
 45%|####4     | 65188/145758.0 [00:18<00:22, 3654.98it/s]
 45%|####4     | 65556/145758.0 [00:18<00:21, 3661.60it/s]
 45%|####5     | 65926/145758.0 [00:18<00:21, 3672.73it/s]
 45%|####5     | 66295/145758.0 [00:18<00:21, 3652.42it/s]
 46%|####5     | 66662/145758.0 [00:18<00:21, 3599.60it/s]
 46%|####5     | 67023/145758.0 [00:18<00:22, 3535.93it/s]
 46%|####6     | 67378/145758.0 [00:18<00:22, 3497.76it/s]
 46%|####6     | 67743/145758.0 [00:18<00:22, 3541.43it/s]
 47%|####6     | 68117/145758.0 [00:18<00:21, 3596.68it/s]
 47%|####6     | 68485/145758.0 [00:19<00:21, 3620.44it/s]
 47%|####7     | 68848/145758.0 [00:19<00:21, 3611.56it/s]
 47%|####7     | 69210/145758.0 [00:19<00:21, 3522.77it/s]
 48%|####7     | 69577/145758.0 [00:19<00:21, 3564.19it/s]
 48%|####7     | 69934/145758.0 [00:19<00:21, 3553.61it/s]
 48%|####8     | 70302/145758.0 [00:19<00:21, 3589.76it/s]
 48%|####8     | 70669/145758.0 [00:19<00:20, 3612.40it/s]
 49%|####8     | 71043/145758.0 [00:19<00:20, 3646.10it/s]
 49%|####8     | 71408/145758.0 [00:19<00:20, 3635.71it/s]
 49%|####9     | 71772/145758.0 [00:20<00:20, 3591.57it/s]
 49%|####9     | 72132/145758.0 [00:20<00:21, 3492.67it/s]
 50%|####9     | 72482/145758.0 [00:20<00:21, 3460.20it/s]
 50%|####9     | 72834/145758.0 [00:20<00:20, 3474.50it/s]
 50%|#####     | 73202/145758.0 [00:20<00:20, 3534.34it/s]
 50%|#####     | 73589/145758.0 [00:20<00:19, 3633.17it/s]
 51%|#####     | 73982/145758.0 [00:20<00:19, 3718.93it/s]
 51%|#####1    | 74370/145758.0 [00:20<00:18, 3766.46it/s]
 51%|#####1    | 74747/145758.0 [00:20<00:19, 3633.14it/s]
 52%|#####1    | 75112/145758.0 [00:20<00:19, 3591.10it/s]
 52%|#####1    | 75472/145758.0 [00:21<00:19, 3518.64it/s]
 52%|#####2    | 75825/145758.0 [00:21<00:19, 3518.66it/s]
 52%|#####2    | 76205/145758.0 [00:21<00:19, 3599.63it/s]
 53%|#####2    | 76587/145758.0 [00:21<00:18, 3663.78it/s]
 53%|#####2    | 76963/145758.0 [00:21<00:18, 3689.07it/s]
 53%|#####3    | 77338/145758.0 [00:21<00:18, 3707.07it/s]
 53%|#####3    | 77709/145758.0 [00:21<00:18, 3652.60it/s]
 54%|#####3    | 78075/145758.0 [00:21<00:18, 3598.34it/s]
 54%|#####3    | 78436/145758.0 [00:21<00:18, 3562.79it/s]
 54%|#####4    | 78801/145758.0 [00:21<00:18, 3586.46it/s]
 54%|#####4    | 79177/145758.0 [00:22<00:18, 3636.01it/s]
 55%|#####4    | 79545/145758.0 [00:22<00:18, 3648.82it/s]
 55%|#####4    | 79911/145758.0 [00:22<00:18, 3614.73it/s]
 55%|#####5    | 80273/145758.0 [00:22<00:18, 3544.14it/s]
 55%|#####5    | 80628/145758.0 [00:22<00:18, 3490.76it/s]
 56%|#####5    | 80978/145758.0 [00:22<00:18, 3475.02it/s]
 56%|#####5    | 81326/145758.0 [00:22<00:18, 3475.34it/s]
 56%|#####6    | 81701/145758.0 [00:22<00:18, 3555.42it/s]
 56%|#####6    | 82084/145758.0 [00:22<00:17, 3634.80it/s]
 57%|#####6    | 82455/145758.0 [00:22<00:17, 3656.27it/s]
 57%|#####6    | 82829/145758.0 [00:23<00:17, 3680.50it/s]
 57%|#####7    | 83198/145758.0 [00:23<00:17, 3576.75it/s]
 57%|#####7    | 83557/145758.0 [00:23<00:17, 3575.55it/s]
 58%|#####7    | 83917/145758.0 [00:23<00:17, 3582.23it/s]
 58%|#####7    | 84284/145758.0 [00:23<00:17, 3606.88it/s]
 58%|#####8    | 84671/145758.0 [00:23<00:16, 3684.06it/s]
 58%|#####8    | 85053/145758.0 [00:23<00:16, 3721.73it/s]
 59%|#####8    | 85437/145758.0 [00:23<00:16, 3755.03it/s]
 59%|#####8    | 85814/145758.0 [00:23<00:15, 3756.19it/s]
 59%|#####9    | 86190/145758.0 [00:24<00:16, 3635.34it/s]
 59%|#####9    | 86556/145758.0 [00:24<00:16, 3640.54it/s]
 60%|#####9    | 86922/145758.0 [00:24<00:16, 3642.66it/s]
 60%|#####9    | 87313/145758.0 [00:24<00:15, 3720.34it/s]
 60%|######    | 87704/145758.0 [00:24<00:15, 3775.94it/s]
 60%|######    | 88087/145758.0 [00:24<00:15, 3788.80it/s]
 61%|######    | 88467/145758.0 [00:24<00:15, 3780.93it/s]
 61%|######    | 88849/145758.0 [00:24<00:15, 3790.90it/s]
 61%|######1   | 89229/145758.0 [00:24<00:15, 3727.97it/s]
 61%|######1   | 89603/145758.0 [00:24<00:15, 3727.55it/s]
 62%|######1   | 89986/145758.0 [00:25<00:14, 3754.76it/s]
 62%|######2   | 90386/145758.0 [00:25<00:14, 3826.86it/s]
 62%|######2   | 90782/145758.0 [00:25<00:14, 3865.35it/s]
 63%|######2   | 91176/145758.0 [00:25<00:14, 3885.70it/s]
 63%|######2   | 91577/145758.0 [00:25<00:13, 3921.74it/s]
 63%|######3   | 91970/145758.0 [00:25<00:13, 3863.01it/s]
 63%|######3   | 92357/145758.0 [00:25<00:14, 3798.49it/s]
 64%|######3   | 92738/145758.0 [00:25<00:13, 3790.33it/s]
 64%|######3   | 93134/145758.0 [00:25<00:13, 3839.39it/s]
 64%|######4   | 93531/145758.0 [00:25<00:13, 3875.89it/s]
 64%|######4   | 93940/145758.0 [00:26<00:13, 3939.11it/s]
 65%|######4   | 94335/145758.0 [00:26<00:13, 3908.21it/s]
 65%|######4   | 94733/145758.0 [00:26<00:12, 3925.49it/s]
 65%|######5   | 95126/145758.0 [00:26<00:13, 3844.43it/s]
 66%|######5   | 95511/145758.0 [00:26<00:13, 3816.72it/s]
 66%|######5   | 95916/145758.0 [00:26<00:12, 3884.07it/s]
 66%|######6   | 96316/145758.0 [00:26<00:12, 3916.74it/s]
 66%|######6   | 96712/145758.0 [00:26<00:12, 3928.22it/s]
 67%|######6   | 97106/145758.0 [00:26<00:12, 3918.75it/s]
 67%|######6   | 97524/145758.0 [00:26<00:12, 3994.21it/s]
 67%|######7   | 97924/145758.0 [00:27<00:12, 3935.00it/s]
 67%|######7   | 98318/145758.0 [00:27<00:12, 3904.23it/s]
 68%|######7   | 98713/145758.0 [00:27<00:12, 3915.89it/s]
 68%|######8   | 99127/145758.0 [00:27<00:11, 3980.76it/s]
 68%|######8   | 99528/145758.0 [00:27<00:11, 3988.89it/s]
 69%|######8   | 99928/145758.0 [00:27<00:11, 3981.26it/s]
 69%|######8   | 100334/145758.0 [00:27<00:11, 4003.70it/s]
 69%|######9   | 100735/145758.0 [00:27<00:11, 3966.70it/s]
 69%|######9   | 101132/145758.0 [00:27<00:11, 3897.33it/s]
 70%|######9   | 101523/145758.0 [00:27<00:11, 3874.08it/s]
 70%|######9   | 101933/145758.0 [00:28<00:11, 3938.20it/s]
 70%|#######   | 102337/145758.0 [00:28<00:10, 3966.07it/s]
 70%|#######   | 102734/145758.0 [00:28<00:10, 3954.07it/s]
 71%|#######   | 103130/145758.0 [00:28<00:10, 3944.51it/s]
 71%|#######1  | 103525/145758.0 [00:28<00:10, 3933.70it/s]
 71%|#######1  | 103919/145758.0 [00:28<00:10, 3831.39it/s]
 72%|#######1  | 104303/145758.0 [00:28<00:10, 3833.74it/s]
 72%|#######1  | 104700/145758.0 [00:28<00:10, 3872.04it/s]
 72%|#######2  | 105102/145758.0 [00:28<00:10, 3915.32it/s]
 72%|#######2  | 105496/145758.0 [00:28<00:10, 3919.23it/s]
 73%|#######2  | 105889/145758.0 [00:29<00:10, 3895.05it/s]
 73%|#######2  | 106279/145758.0 [00:29<00:10, 3883.38it/s]
 73%|#######3  | 106668/145758.0 [00:29<00:10, 3841.05it/s]
 73%|#######3  | 107053/145758.0 [00:29<00:10, 3797.96it/s]
 74%|#######3  | 107442/145758.0 [00:29<00:10, 3822.04it/s]
 74%|#######3  | 107836/145758.0 [00:29<00:09, 3855.35it/s]
 74%|#######4  | 108241/145758.0 [00:29<00:09, 3912.34it/s]
 75%|#######4  | 108633/145758.0 [00:29<00:09, 3904.64it/s]
 75%|#######4  | 109024/145758.0 [00:29<00:09, 3859.19it/s]
 75%|#######5  | 109411/145758.0 [00:29<00:09, 3839.95it/s]
 75%|#######5  | 109796/145758.0 [00:30<00:09, 3701.68it/s]
 76%|#######5  | 110168/145758.0 [00:30<00:09, 3697.94it/s]
 76%|#######5  | 110545/145758.0 [00:30<00:09, 3717.43it/s]
 76%|#######6  | 110931/145758.0 [00:30<00:09, 3755.00it/s]
 76%|#######6  | 111314/145758.0 [00:30<00:09, 3776.21it/s]
 77%|#######6  | 111692/145758.0 [00:30<00:09, 3775.65it/s]
 77%|#######6  | 112084/145758.0 [00:30<00:08, 3815.05it/s]
 77%|#######7  | 112466/145758.0 [00:30<00:08, 3744.05it/s]
 77%|#######7  | 112841/145758.0 [00:30<00:09, 3654.97it/s]
 78%|#######7  | 113217/145758.0 [00:31<00:08, 3684.12it/s]
 78%|#######7  | 113609/145758.0 [00:31<00:08, 3752.31it/s]
 78%|#######8  | 114004/145758.0 [00:31<00:08, 3807.38it/s]
 78%|#######8  | 114386/145758.0 [00:31<00:08, 3796.28it/s]
 79%|#######8  | 114766/145758.0 [00:31<00:08, 3796.57it/s]
 79%|#######8  | 115146/145758.0 [00:31<00:08, 3731.19it/s]
 79%|#######9  | 115520/145758.0 [00:31<00:08, 3589.03it/s]
 80%|#######9  | 115881/145758.0 [00:31<00:08, 3581.60it/s]
 80%|#######9  | 116269/145758.0 [00:31<00:08, 3667.60it/s]
 80%|########  | 116662/145758.0 [00:31<00:07, 3743.76it/s]
 80%|########  | 117050/145758.0 [00:32<00:07, 3783.83it/s]
 81%|########  | 117434/145758.0 [00:32<00:07, 3799.80it/s]
 81%|########  | 117815/145758.0 [00:32<00:07, 3775.47it/s]
 81%|########1 | 118193/145758.0 [00:32<00:07, 3648.31it/s]
 81%|########1 | 118570/145758.0 [00:32<00:07, 3682.76it/s]
 82%|########1 | 118951/145758.0 [00:32<00:07, 3719.96it/s]
 82%|########1 | 119339/145758.0 [00:32<00:07, 3766.31it/s]
 82%|########2 | 119738/145758.0 [00:32<00:06, 3831.84it/s]
 82%|########2 | 120128/145758.0 [00:32<00:06, 3850.07it/s]
 83%|########2 | 120514/145758.0 [00:32<00:06, 3811.50it/s]
 83%|########2 | 120896/145758.0 [00:33<00:06, 3750.22it/s]
 83%|########3 | 121296/145758.0 [00:33<00:06, 3822.29it/s]
 83%|########3 | 121685/145758.0 [00:33<00:06, 3836.57it/s]
 84%|########3 | 122071/145758.0 [00:33<00:06, 3843.28it/s]
 84%|########4 | 122477/145758.0 [00:33<00:05, 3907.29it/s]
 84%|########4 | 122868/145758.0 [00:33<00:05, 3834.65it/s]
 85%|########4 | 123252/145758.0 [00:33<00:05, 3757.84it/s]
 85%|########4 | 123629/145758.0 [00:33<00:06, 3672.03it/s]
 85%|########5 | 124019/145758.0 [00:33<00:05, 3737.29it/s]
 85%|########5 | 124401/145758.0 [00:33<00:05, 3760.47it/s]
 86%|########5 | 124790/145758.0 [00:34<00:05, 3798.24it/s]
 86%|########5 | 125175/145758.0 [00:34<00:05, 3813.09it/s]
 86%|########6 | 125557/145758.0 [00:34<00:05, 3760.10it/s]
 86%|########6 | 125934/145758.0 [00:34<00:05, 3681.82it/s]
 87%|########6 | 126312/145758.0 [00:34<00:05, 3708.77it/s]
 87%|########6 | 126684/145758.0 [00:34<00:05, 3700.09it/s]
 87%|########7 | 127062/145758.0 [00:34<00:05, 3722.16it/s]
 87%|########7 | 127440/145758.0 [00:34<00:04, 3738.33it/s]
 88%|########7 | 127815/145758.0 [00:34<00:04, 3695.27it/s]
 88%|########7 | 128185/145758.0 [00:35<00:04, 3653.92it/s]
 88%|########8 | 128551/145758.0 [00:35<00:04, 3595.82it/s]
 88%|########8 | 128920/145758.0 [00:35<00:04, 3622.93it/s]
 89%|########8 | 129299/145758.0 [00:35<00:04, 3670.33it/s]
 89%|########8 | 129672/145758.0 [00:35<00:04, 3687.37it/s]
 89%|########9 | 130041/145758.0 [00:35<00:04, 3669.68it/s]
 89%|########9 | 130411/145758.0 [00:35<00:04, 3678.63it/s]
 90%|########9 | 130779/145758.0 [00:35<00:04, 3579.98it/s]
 90%|########9 | 131138/145758.0 [00:35<00:04, 3578.06it/s]
 90%|######### | 131523/145758.0 [00:35<00:03, 3656.15it/s]
 91%|######### | 131914/145758.0 [00:36<00:03, 3728.07it/s]
 91%|######### | 132288/145758.0 [00:36<00:03, 3703.91it/s]
 91%|#########1| 132659/145758.0 [00:36<00:03, 3665.53it/s]
 91%|#########1| 133026/145758.0 [00:36<00:03, 3536.67it/s]
 92%|#########1| 133383/145758.0 [00:36<00:03, 3545.87it/s]
 92%|#########1| 133760/145758.0 [00:36<00:03, 3610.78it/s]
 92%|#########2| 134134/145758.0 [00:36<00:03, 3647.54it/s]
 92%|#########2| 134500/145758.0 [00:36<00:03, 3621.76it/s]
 93%|#########2| 134863/145758.0 [00:36<00:03, 3530.92it/s]
 93%|#########2| 135217/145758.0 [00:36<00:02, 3514.60it/s]
 93%|#########3| 135572/145758.0 [00:37<00:02, 3524.64it/s]
 93%|#########3| 135945/145758.0 [00:37<00:02, 3584.96it/s]
 94%|#########3| 136309/145758.0 [00:37<00:02, 3599.23it/s]
 94%|#########3| 136670/145758.0 [00:37<00:02, 3564.83it/s]
 94%|#########4| 137027/145758.0 [00:37<00:02, 3524.00it/s]
 94%|#########4| 137385/145758.0 [00:37<00:02, 3540.20it/s]
 95%|#########4| 137747/145758.0 [00:37<00:02, 3561.27it/s]
 95%|#########4| 138108/145758.0 [00:37<00:02, 3574.33it/s]
 95%|#########4| 138466/145758.0 [00:37<00:02, 3531.70it/s]
 95%|#########5| 138820/145758.0 [00:37<00:01, 3517.54it/s]
 95%|#########5| 139188/145758.0 [00:38<00:01, 3562.73it/s]
 96%|#########5| 139558/145758.0 [00:38<00:01, 3601.96it/s]
 96%|#########5| 139919/145758.0 [00:38<00:01, 3563.80it/s]
 96%|#########6| 140276/145758.0 [00:38<00:01, 3491.29it/s]
 96%|#########6| 140628/145758.0 [00:38<00:01, 3499.31it/s]
 97%|#########6| 140979/145758.0 [00:38<00:02, 2269.89it/s]
 97%|#########6| 141328/145758.0 [00:38<00:01, 2530.34it/s]
 97%|#########7| 141662/145758.0 [00:38<00:01, 2718.92it/s]
 97%|#########7| 142006/145758.0 [00:39<00:01, 2899.20it/s]
 98%|#########7| 142357/145758.0 [00:39<00:01, 3058.75it/s]
 98%|#########7| 142693/145758.0 [00:39<00:00, 3139.35it/s]
 98%|#########8| 143030/145758.0 [00:39<00:00, 3203.78it/s]
 98%|#########8| 143386/145758.0 [00:39<00:00, 3304.55it/s]
 99%|#########8| 143726/145758.0 [00:39<00:00, 3309.42it/s]
 99%|#########8| 144066/145758.0 [00:39<00:00, 3334.19it/s]
 99%|#########9| 144410/145758.0 [00:39<00:00, 3363.49it/s]
 99%|#########9| 144750/145758.0 [00:39<00:00, 3341.45it/s]
100%|#########9| 145087/145758.0 [00:39<00:00, 3348.67it/s]
100%|#########9| 145424/145758.0 [00:40<00:00, 3314.33it/s]
100%|#########9| 145757/145758.0 [00:40<00:00, 3281.20it/s]
100%|##########| 145758/145758.0 [00:40<00:00, 3624.68it/s]
Optimizing level 2 [max iter: 10000]
Optimizing level 1 [max iter: 1000]
Optimizing level 0 [max iter: 100]
Optimizing level 2 [max iter: 10000]
Optimizing level 1 [max iter: 1000]
Optimizing level 0 [max iter: 100]
Optimizing level 2 [max iter: 10000]
Optimizing level 1 [max iter: 1000]
Optimizing level 0 [max iter: 100]

  0%|          | 0/8114 [00:00<?, ?it/s]
  0%|          | 4/8114 [00:02<1:22:02,  1.65it/s]
  3%|2         | 204/8114 [00:02<01:10, 112.41it/s]
 13%|#2        | 1036/8114 [00:02<00:09, 710.05it/s]
 25%|##5       | 2060/8114 [00:02<00:03, 1588.68it/s]
 51%|#####     | 4108/8114 [00:02<00:01, 3458.90it/s]
 76%|#######5  | 6156/8114 [00:03<00:00, 5536.97it/s]
100%|##########| 8114/8114 [00:03<00:00, 2647.30it/s]

  0%|          | 0/8114 [00:00<?, ?it/s]
 25%|##5       | 2040/8114 [00:00<00:00, 15157.40it/s]
 50%|#####     | 4088/8114 [00:00<00:00, 16513.43it/s]
100%|##########| 8114/8114 [00:00<00:00, 25168.45it/s]

  0%|          | 0/8114 [00:00<?, ?it/s]
  3%|3         | 252/8114 [00:00<00:03, 2481.09it/s]
 19%|#8        | 1532/8114 [00:00<00:00, 8489.73it/s]
 38%|###7      | 3068/8114 [00:00<00:00, 10586.84it/s]
 51%|#####     | 4110/8114 [00:00<00:00, 9874.04it/s]
 76%|#######5  | 6140/8114 [00:00<00:00, 12869.92it/s]
100%|##########| 8114/8114 [00:00<00:00, 14674.91it/s]

  0%|          | 0/8114 [00:00<?, ?it/s]
 25%|##5       | 2040/8114 [00:00<00:00, 15569.03it/s]
 50%|#####     | 4088/8114 [00:00<00:00, 14878.29it/s]
100%|##########| 8114/8114 [00:00<00:00, 22761.80it/s]

  0%|          | 0/8114 [00:00<?, ?it/s]
  5%|4         | 380/8114 [00:00<00:02, 3623.98it/s]
 25%|##5       | 2044/8114 [00:00<00:00, 8647.40it/s]
 50%|#####     | 4092/8114 [00:00<00:00, 10068.92it/s]
100%|##########| 8114/8114 [00:00<00:00, 15156.28it/s]

  0%|          | 0/8114 [00:00<?, ?it/s]
  2%|2         | 184/8114 [00:00<00:04, 1761.80it/s]
 13%|#2        | 1016/8114 [00:00<00:01, 4372.54it/s]
 25%|##5       | 2040/8114 [00:00<00:01, 5024.64it/s]
 38%|###7      | 3064/8114 [00:00<00:00, 6281.71it/s]
 50%|#####     | 4088/8114 [00:00<00:00, 5527.67it/s]
 63%|######3   | 5112/8114 [00:00<00:00, 5208.38it/s]
 76%|#######5  | 6136/8114 [00:01<00:00, 4837.83it/s]
 88%|########8 | 7160/8114 [00:01<00:00, 4200.16it/s]
100%|##########| 8114/8114 [00:01<00:00, 5278.60it/s]

  0%|          | 0/8114 [00:00<?, ?it/s]
  3%|3         | 252/8114 [00:00<00:03, 2415.90it/s]
 25%|##5       | 2044/8114 [00:00<00:00, 9521.16it/s]
 50%|#####     | 4092/8114 [00:00<00:00, 11930.67it/s]
100%|##########| 8114/8114 [00:00<00:00, 16950.13it/s]

  0%|          | 0/8114 [00:00<?, ?it/s]
  3%|3         | 252/8114 [00:00<00:03, 2491.18it/s]
 25%|##5       | 2044/8114 [00:00<00:00, 9599.60it/s]
 50%|#####     | 4092/8114 [00:00<00:00, 10612.02it/s]
100%|##########| 8114/8114 [00:00<00:00, 15812.83it/s]

  0%|          | 0/8 [00:00<?, ?it/s]
 12%|#2        | 1/8 [00:00<00:01,  6.35it/s]
 25%|##5       | 2/8 [00:00<00:00,  6.63it/s]
 38%|###7      | 3/8 [00:00<00:01,  4.18it/s]
 50%|#####     | 4/8 [00:00<00:00,  4.90it/s]
 62%|######2   | 5/8 [00:00<00:00,  5.57it/s]
 75%|#######5  | 6/8 [00:01<00:00,  6.01it/s]
 88%|########7 | 7/8 [00:01<00:00,  6.25it/s]
100%|##########| 8/8 [00:01<00:00,  6.57it/s]
100%|##########| 8/8 [00:01<00:00,  5.89it/s]

  0%|          | 0/8 [00:00<?, ?it/s]
 12%|#2        | 1/8 [00:00<00:01,  6.52it/s]
 25%|##5       | 2/8 [00:00<00:00,  6.97it/s]
 38%|###7      | 3/8 [00:00<00:00,  6.90it/s]
 50%|#####     | 4/8 [00:00<00:00,  6.86it/s]
 62%|######2   | 5/8 [00:00<00:00,  6.83it/s]
 75%|#######5  | 6/8 [00:00<00:00,  6.83it/s]
 88%|########7 | 7/8 [00:01<00:00,  6.84it/s]
100%|##########| 8/8 [00:01<00:00,  7.00it/s]
100%|##########| 8/8 [00:01<00:00,  6.90it/s]

Visualizing bundles and tract profiles:#

This would run the script and visualize the bundles using the plotly interactive visualization, which should automatically open in a new browser window.

bundle_html = myafq.export("all_bundles_figure")
plotly.io.show(bundle_html["01"])