def setUp(self): homeDirectory = expanduser('~') self.dataDirectory = join(homeDirectory, '.dipy', 'datasets_multi-site_all_companies') if not isdir(self.dataDirectory): fetch_scil_b0()
segment.mask module. First import the necessary modules: """ import numpy as np import nibabel as nib """ Download and read the data for this tutorial. The scil_b0 dataset contains different data from different companies and models. For this example, the data comes from a 1.5 tesla Siemens MRI. """ from dipy.data.fetcher import fetch_scil_b0, read_siemens_scil_b0 fetch_scil_b0() img = read_siemens_scil_b0() data = np.squeeze(img.get_data()) """ ``img`` contains a nibabel Nifti1Image object. Data is the actual brain data as a numpy ndarray. Segment the brain using dipy's mask module. ``median_otsu`` returns the segmented brain data and a binary mask of the brain. It is possible to fine tune the parameters of ``median_otsu`` (``median_radius`` and ``num_pass``) if extraction yields incorrect results but the default parameters work well on most volumes. For this example, we used 2 as ``median_radius`` and 1 as ``num_pass`` """
First import the necessary modules: """ import numpy as np import nibabel as nib """ Download and read the data for this tutorial. The scil_b0 dataset contains different data from different companies and models. For this example, the data comes from a 1.5 tesla Siemens MRI. """ from dipy.data.fetcher import fetch_scil_b0, read_siemens_scil_b0 fetch_scil_b0() img = read_siemens_scil_b0() data = np.squeeze(img.get_data()) """ ``img`` contains a nibabel Nifti1Image object. Data is the actual brain data as a numpy ndarray. Segment the brain using dipy's mask module. ``median_otsu`` returns the segmented brain data and a binary mask of the brain. It is possible to fine tune the parameters of ``median_otsu`` (``median_radius`` and ``num_pass``) if extraction yields incorrect results but the default parameters work well on most volumes. For this example, we used 2 as ``median_radius`` and 1 as ``num_pass`` """