<commit_before>
import os.path as op

import nibabel.tmpdirs as nbtmp

import dipy.data as dpd
import dipy.data.fetcher as fetcher


def test_segment():
    with nbtmp.InTemporaryDirectory() as tmpdir:
        MNI_T2 = dpd.read_mni_template()
        hardi_img, gtab = dpd.read_stanford_hardi()
        MNI_T2_data = MNI_T2.get_data()
        MNI_T2_affine = MNI_T2.get_affine()
        hardi_data = hardi_img.get_data()
        hardi_affine = hardi_img.get_affine()
        b0 = hardi_data[..., gtab.b0s_mask]
        mean_b0 = np.mean(b0, -1)
        subset_b0 = mean_b0[40:50, 40:50, 40:50]
        subset_t2 = MNI_T2_data[40:60, 40:60, 40:60]
        subset_b0_img = nib.Nifti1Image(subset_b0, hardi_affine)
        subset_t2_img = nib.Nifti1Image(subset_t2, MNI_T2_affine)
        dpd.fetch_stanford_hardi()
        hardi_dir = op.join(fetcher.dipy_home, "stanford_hardi")
        hardi_fdata = op.join(hardi_dir, "HARDI150.nii.gz")
        hardi_fbval = op.join(hardi_dir, "HARDI150.bval")
        hardi_fbvec = op.join(hardi_dir, "HARDI150.bvec")
        gtab = dpg.gradient_table(hardi_fbval, hardi_fbvec)
        mapping = seg._register_to_template(hardi_fdata, gtab)

        templates = dict()
        streamlines =

        fiber_groups = seg.segment(hardi_fdata, hardi_fbval, hardi_fbvec,
                                   streamlines,
                                   bundles=['FOO', 'BAR'],
                                   mapping=mapping)<commit_msg>This smoke test takes a long time to run, even if we had only a few streamlines.<commit_after>
import os.path as op

import nibabel.tmpdirs as nbtmp

import dipy.data as dpd
import dipy.data.fetcher as fetcher

import AFQ.data as afd

def test_segment():
    hardi_dir = op.join(fetcher.dipy_home, "stanford_hardi")
    hardi_fdata = op.join(hardi_dir, "HARDI150.nii.gz")
    hardi_fbval = op.join(hardi_dir, "HARDI150.bval")
    hardi_fbvec = op.join(hardi_dir, "HARDI150.bvec")
    gtab = dpg.gradient_table(hardi_fbval, hardi_fbvec)
    streamlines = afd.read_stanford_tracks()
    fiber_groups = seg.segment(hardi_fdata, hardi_fbval, hardi_fbvec,
                               streamlines)
{'fraction_non_alphanumeric': 0.0974145891043398, 'fraction_numerical': 0.029085872576177285, 'mean_word_length': 2.736206896551724, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5912358', 'n_tokens_mistral': 873, 'n_tokens_neox': 829, 'n_words': 146}