data
Read test or example data.
DataError
|
|
GradientTable (gradients[, big_delta, ...])
|
Diffusion gradient information |
HemiSphere ([x, y, z, theta, phi, xyz, ...])
|
Points on the unit sphere. |
Sphere ([x, y, z, theta, phi, xyz, faces, edges])
|
Points on the unit sphere. |
as_native_array (arr)
|
Return arr as native byteordered array |
dirname (p)
|
Returns the directory component of a pathname |
dsi_deconv_voxels ()
|
|
dsi_voxels ()
|
|
exists (path)
|
Test whether a path exists. |
fetch_bundle_atlas_hcp842 ()
|
Download atlas tractogram from the hcp842 dataset with 80 bundles |
fetch_bundle_fa_hcp ()
|
Download map of FA within two bundles in oneof the hcp dataset subjects |
fetch_bundles_2_subjects ()
|
Download 2 subjects from the SNAIL dataset with their bundles |
fetch_cenir_multib ([with_raw])
|
Fetch 'HCP-like' data, collected at multiple b-values. |
fetch_cfin_multib ()
|
Download CFIN multi b-value diffusion data |
fetch_gold_standard_io ()
|
Downloads the gold standard for streamlines io testing. |
fetch_hbn (subjects[, path])
|
Fetch preprocessed data from the Healthy Brain Network POD2 study [1, 2]_. |
fetch_isbi2013_2shell ()
|
Download a 2-shell software phantom dataset |
fetch_ivim ()
|
Download IVIM dataset |
fetch_mni_template ()
|
fetch the MNI 2009a T1 and T2, and 2009c T1 and T1 mask files Notes ----- The templates were downloaded from the MNI (McGill University) website in July 2015. |
fetch_resdnn_weights ()
|
Download ResDNN model weights for Nath et. |
fetch_scil_b0 ()
|
Download b=0 datasets from multiple MR systems (GE, Philips, Siemens) and different magnetic fields (1.5T and 3T) |
fetch_sherbrooke_3shell ()
|
Download a 3shell HARDI dataset with 192 gradient direction |
fetch_stanford_hardi ()
|
Download a HARDI dataset with 160 gradient directions |
fetch_stanford_labels ()
|
Download reduced freesurfer aparc image from stanford web site |
fetch_stanford_pve_maps ()
|
|
fetch_stanford_t1 ()
|
|
fetch_syn_data ()
|
Download t1 and b0 volumes from the same session |
fetch_taiwan_ntu_dsi ()
|
Download a DSI dataset with 203 gradient directions |
fetch_target_tractogram_hcp ()
|
Download tractogram of one of the hcp dataset subjects |
fetch_tissue_data ()
|
Download images to be used for tissue classification |
get_3shell_gtab ()
|
|
get_bundle_atlas_hcp842 ()
|
- Returns:
|
get_cmap (name)
|
Make a callable, similar to maptlotlib.pyplot.get_cmap. |
get_fnames ([name])
|
Provide full paths to example or test datasets. |
get_gtab_taiwan_dsi ()
|
|
get_isbi2013_2shell_gtab ()
|
|
get_sim_voxels ([name])
|
provide some simulated voxel data |
get_skeleton ([name])
|
Provide skeletons generated from Local Skeleton Clustering (LSC). |
get_sphere ([name])
|
provide triangulated spheres |
get_target_tractogram_hcp ()
|
- Returns:
|
get_two_hcp842_bundles ()
|
- Returns:
|
gradient_table (bvals[, bvecs, big_delta, ...])
|
A general function for creating diffusion MR gradients. |
load_nifti (fname[, return_img, ...])
|
Load data and other information from a nifti file. |
load_npz (file)
|
Load a sparse matrix from a file using .npz format. |
load_sdp_constraints (model_name[, order])
|
Import semidefinite programming constraint matrices for different models, generated as described for example in [1]. |
loads_compat (byte_data)
|
|
matlab_life_results ()
|
|
mrtrix_spherical_functions ()
|
Spherical functions represented by spherical harmonic coefficients and evaluated on a discrete sphere. |
pjoin (a, *p)
|
Join two or more pathname components, inserting '/' as needed. |
read_DiB_217_lte_pte_ste ()
|
Read q-space trajectory encoding data with 217 between linear, planar, and spherical tensor encoding. |
read_DiB_70_lte_pte_ste ()
|
Read q-space trajectory encoding data with 70 between linear, planar, and spherical tensor encoding measurements. |
read_bundles_2_subjects ([subj_id, metrics, ...])
|
Read images and streamlines from 2 subjects of the SNAIL dataset. |
read_cenir_multib ([bvals])
|
Read CENIR multi b-value data. |
read_cfin_dwi ()
|
Load CFIN multi b-value DWI data. |
read_cfin_t1 ()
|
Load CFIN T1-weighted data. |
read_five_af_bundles ()
|
Load 5 small left arcuate fasciculus bundles. |
read_isbi2013_2shell ()
|
Load ISBI 2013 2-shell synthetic dataset. |
read_ivim ()
|
Load IVIM dataset. |
read_mni_template ([version, contrast])
|
Read the MNI template from disk. |
read_qte_lte_pte ()
|
Read q-space trajectory encoding data with linear and planar tensor encoding. |
read_scil_b0 ()
|
Load GE 3T b0 image form the scil b0 dataset. |
read_sherbrooke_3shell ()
|
Load Sherbrooke 3-shell HARDI dataset. |
read_stanford_hardi ()
|
Load Stanford HARDI dataset. |
read_stanford_labels ()
|
Read stanford hardi data and label map. |
read_stanford_pve_maps ()
|
|
read_stanford_t1 ()
|
|
read_syn_data ()
|
Load t1 and b0 volumes from the same session. |
read_taiwan_ntu_dsi ()
|
Load Taiwan NTU dataset. |
read_tissue_data ([contrast])
|
Load images to be used for tissue classification |
relist_streamlines (points, offsets)
|
Given a representation of a set of streamlines as a large array and an offsets array return the streamlines as a list of shorter arrays. |
two_cingulum_bundles ()
|
|
Module: data.fetcher
FetcherError
|
|
TripWire (msg)
|
Class raising error if used |
tqdm
|
alias of tqdm_asyncio |
check_md5 (filename[, stored_md5])
|
Computes the md5 of filename and check if it matches with the supplied string md5 |
copyfileobj (fsrc, fdst[, length])
|
copy data from file-like object fsrc to file-like object fdst |
copyfileobj_withprogress (fsrc, fdst, ...[, ...])
|
|
extract_example_tracts (out_dir)
|
Extract 5 'AF_L','CST_R' and 'CC_ForcepsMajor' trk files in out_dir folder. |
fetch_DiB_217_lte_pte_ste ()
|
Download QTE data with linear, planar, and spherical tensor encoding. |
fetch_DiB_70_lte_pte_ste ()
|
Download QTE data with linear, planar, and spherical tensor encoding. |
fetch_bundle_atlas_hcp842 ()
|
Download atlas tractogram from the hcp842 dataset with 80 bundles |
fetch_bundle_fa_hcp ()
|
Download map of FA within two bundles in oneof the hcp dataset subjects |
fetch_bundles_2_subjects ()
|
Download 2 subjects from the SNAIL dataset with their bundles |
fetch_cenir_multib ([with_raw])
|
Fetch 'HCP-like' data, collected at multiple b-values. |
fetch_cfin_multib ()
|
Download CFIN multi b-value diffusion data |
fetch_data (files, folder[, data_size])
|
Downloads files to folder and checks their md5 checksums |
fetch_file_formats ()
|
Download 5 bundles in various file formats and their reference |
fetch_fury_surface ()
|
Surface for testing and examples |
fetch_gold_standard_io ()
|
Downloads the gold standard for streamlines io testing. |
fetch_hbn (subjects[, path])
|
Fetch preprocessed data from the Healthy Brain Network POD2 study [1, 2]_. |
fetch_hcp (subjects[, hcp_bucket, ...])
|
Fetch HCP diffusion data and arrange it in a manner that resembles the BIDS [1] specification. |
fetch_isbi2013_2shell ()
|
Download a 2-shell software phantom dataset |
fetch_ivim ()
|
Download IVIM dataset |
fetch_mni_template ()
|
fetch the MNI 2009a T1 and T2, and 2009c T1 and T1 mask files Notes ----- The templates were downloaded from the MNI (McGill University) website in July 2015.
|
fetch_qtdMRI_test_retest_2subjects ()
|
Downloads test-retest qt-dMRI acquisitions of two C57Bl6 mice. |
fetch_qte_lte_pte ()
|
Download QTE data with linear and planar tensor encoding. |
fetch_resdnn_weights ()
|
Download ResDNN model weights for Nath et. |
fetch_scil_b0 ()
|
Download b=0 datasets from multiple MR systems (GE, Philips, Siemens) and different magnetic fields (1.5T and 3T) |
fetch_sherbrooke_3shell ()
|
Download a 3shell HARDI dataset with 192 gradient direction |
fetch_stanford_hardi ()
|
Download a HARDI dataset with 160 gradient directions |
fetch_stanford_labels ()
|
Download reduced freesurfer aparc image from stanford web site |
fetch_stanford_pve_maps ()
|
|
fetch_stanford_t1 ()
|
|
fetch_syn_data ()
|
Download t1 and b0 volumes from the same session |
fetch_taiwan_ntu_dsi ()
|
Download a DSI dataset with 203 gradient directions |
fetch_target_tractogram_hcp ()
|
Download tractogram of one of the hcp dataset subjects |
fetch_tissue_data ()
|
Download images to be used for tissue classification |
get_bundle_atlas_hcp842 ()
|
- Returns:
|
get_file_formats ()
|
- Returns:
|
get_fnames ([name])
|
Provide full paths to example or test datasets. |
get_target_tractogram_hcp ()
|
- Returns:
|
get_two_hcp842_bundles ()
|
- Returns:
|
gradient_table (bvals[, bvecs, big_delta, ...])
|
A general function for creating diffusion MR gradients. |
gradient_table_from_gradient_strength_bvecs (...)
|
A general function for creating diffusion MR gradients. |
load_nifti (fname[, return_img, ...])
|
Load data and other information from a nifti file. |
load_nifti_data (fname[, as_ndarray])
|
Load only the data array from a nifti file. |
load_trk (filename, reference[, to_space, ...])
|
Load the stateful tractogram of the .trk format |
md5 (/[, string, usedforsecurity])
|
Returns a md5 hash object; optionally initialized with a string |
optional_package (name[, trip_msg])
|
Return package-like thing and module setup for package name |
pjoin (a, *p)
|
Join two or more pathname components, inserting '/' as needed. |
read_DiB_217_lte_pte_ste ()
|
Read q-space trajectory encoding data with 217 between linear, planar, and spherical tensor encoding. |
read_DiB_70_lte_pte_ste ()
|
Read q-space trajectory encoding data with 70 between linear, planar, and spherical tensor encoding measurements. |
read_bundles_2_subjects ([subj_id, metrics, ...])
|
Read images and streamlines from 2 subjects of the SNAIL dataset. |
read_bvals_bvecs (fbvals, fbvecs)
|
Read b-values and b-vectors from disk. |
read_cenir_multib ([bvals])
|
Read CENIR multi b-value data. |
read_cfin_dwi ()
|
Load CFIN multi b-value DWI data. |
read_cfin_t1 ()
|
Load CFIN T1-weighted data. |
read_five_af_bundles ()
|
Load 5 small left arcuate fasciculus bundles. |
read_isbi2013_2shell ()
|
Load ISBI 2013 2-shell synthetic dataset. |
read_ivim ()
|
Load IVIM dataset. |
read_mni_template ([version, contrast])
|
Read the MNI template from disk. |
read_qtdMRI_test_retest_2subjects ()
|
Load test-retest qt-dMRI acquisitions of two C57Bl6 mice. |
read_qte_lte_pte ()
|
Read q-space trajectory encoding data with linear and planar tensor encoding. |
read_scil_b0 ()
|
Load GE 3T b0 image form the scil b0 dataset. |
read_sherbrooke_3shell ()
|
Load Sherbrooke 3-shell HARDI dataset. |
read_siemens_scil_b0 ()
|
Load Siemens 1.5T b0 image from the scil b0 dataset. |
read_stanford_hardi ()
|
Load Stanford HARDI dataset. |
read_stanford_labels ()
|
Read stanford hardi data and label map. |
read_stanford_pve_maps ()
|
|
read_stanford_t1 ()
|
|
read_syn_data ()
|
Load t1 and b0 volumes from the same session. |
read_taiwan_ntu_dsi ()
|
Load Taiwan NTU dataset. |
read_tissue_data ([contrast])
|
Load images to be used for tissue classification |
save_nifti (fname, data, affine[, hdr, dtype])
|
Save a data array into a nifti file. |
to_bids_description (path[, fname, BIDSVersion])
|
Dumps a dict into a bids description at the given location |
urlopen (url[, data, timeout, cafile, ...])
|
Open the URL url, which can be either a string or a Request object. |
-
class dipy.data.DataError
Bases: Exception
- Attributes:
- args
Methods
with_traceback
|
Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self. |
-
__init__(*args, **kwargs)
-
class dipy.data.GradientTable(gradients, big_delta=None, small_delta=None, b0_threshold=50, btens=None)
Bases: object
Diffusion gradient information
- Parameters:
- gradientsarray_like (N, 3)
Diffusion gradients. The direction of each of these vectors corresponds
to the b-vector, and the length corresponds to the b-value.
- b0_thresholdfloat
Gradients with b-value less than or equal to b0_threshold are
considered as b0s i.e. without diffusion weighting.
Notes
The GradientTable object is immutable. Do NOT assign attributes.
If you have your gradient table in a bval & bvec format, we recommend
using the factory function gradient_table
- Attributes:
- gradients(N,3) ndarray
diffusion gradients
- bvals(N,) ndarray
The b-value, or magnitude, of each gradient direction.
- qvals: (N,) ndarray
The q-value for each gradient direction. Needs big and small
delta.
- bvecs(N,3) ndarray
The direction, represented as a unit vector, of each gradient.
- b0s_mask(N,) ndarray
Boolean array indicating which gradients have no diffusion
weighting, ie b-value is close to 0.
- b0_thresholdfloat
Gradients with b-value less than or equal to b0_threshold are
considered to not have diffusion weighting.
- btens(N,3,3) ndarray
The b-tensor of each gradient direction.
Methods
b0s_mask |
|
bvals |
|
bvecs |
|
gradient_strength |
|
qvals |
|
tau |
|
-
__init__(gradients, big_delta=None, small_delta=None, b0_threshold=50, btens=None)
Constructor for GradientTable class
-
b0s_mask()
-
bvals()
-
bvecs()
-
gradient_strength()
-
property info
-
qvals()
-
tau()
-
class dipy.data.HemiSphere(x=None, y=None, z=None, theta=None, phi=None, xyz=None, faces=None, edges=None, tol=1e-05)
Bases: Sphere
Points on the unit sphere.
A HemiSphere is similar to a Sphere but it takes antipodal symmetry into
account. Antipodal symmetry means that point v on a HemiSphere is the same
as the point -v. Duplicate points are discarded when constructing a
HemiSphere (including antipodal duplicates). edges and faces are
remapped to the remaining points as closely as possible.
The HemiSphere can be constructed using one of three conventions:
HemiSphere(x, y, z)
HemiSphere(xyz=xyz)
HemiSphere(theta=theta, phi=phi)
- Parameters:
- x, y, z1-D array_like
Vertices as x-y-z coordinates.
- theta, phi1-D array_like
Vertices as spherical coordinates. Theta and phi are the inclination
and azimuth angles respectively.
- xyz(N, 3) ndarray
Vertices as x-y-z coordinates.
- faces(N, 3) ndarray
Indices into vertices that form triangular faces. If unspecified,
the faces are computed using a Delaunay triangulation.
- edges(N, 2) ndarray
Edges between vertices. If unspecified, the edges are
derived from the faces.
- tolfloat
Angle in degrees. Vertices that are less than tol degrees apart are
treated as duplicates.
- Attributes:
- x
- y
- z
Methods
find_closest (xyz)
|
Find the index of the vertex in the Sphere closest to the input vector, taking into account antipodal symmetry |
from_sphere (sphere[, tol])
|
Create instance from a Sphere |
mirror ()
|
Create a full Sphere from a HemiSphere |
subdivide ([n])
|
Create a more subdivided HemiSphere |
-
__init__(x=None, y=None, z=None, theta=None, phi=None, xyz=None, faces=None, edges=None, tol=1e-05)
Create a HemiSphere from points
-
faces()
-
find_closest(xyz)
Find the index of the vertex in the Sphere closest to the input vector,
taking into account antipodal symmetry
- Parameters:
- xyzarray-like, 3 elements
A unit vector
- Returns:
- idxint
The index into the Sphere.vertices array that gives the closest
vertex (in angle).
-
classmethod from_sphere(sphere, tol=1e-05)
Create instance from a Sphere
-
mirror()
Create a full Sphere from a HemiSphere
-
subdivide(n=1)
Create a more subdivided HemiSphere
See Sphere.subdivide for full documentation.
-
class dipy.data.Sphere(x=None, y=None, z=None, theta=None, phi=None, xyz=None, faces=None, edges=None)
Bases: object
Points on the unit sphere.
The sphere can be constructed using one of three conventions:
Sphere(x, y, z)
Sphere(xyz=xyz)
Sphere(theta=theta, phi=phi)
- Parameters:
- x, y, z1-D array_like
Vertices as x-y-z coordinates.
- theta, phi1-D array_like
Vertices as spherical coordinates. Theta and phi are the inclination
and azimuth angles respectively.
- xyz(N, 3) ndarray
Vertices as x-y-z coordinates.
- faces(N, 3) ndarray
Indices into vertices that form triangular faces. If unspecified,
the faces are computed using a Delaunay triangulation.
- edges(N, 2) ndarray
Edges between vertices. If unspecified, the edges are
derived from the faces.
- Attributes:
- x
- y
- z
Methods
find_closest (xyz)
|
Find the index of the vertex in the Sphere closest to the input vector |
subdivide ([n])
|
Subdivides each face of the sphere into four new faces. |
-
__init__(x=None, y=None, z=None, theta=None, phi=None, xyz=None, faces=None, edges=None)
-
edges()
-
faces()
-
find_closest(xyz)
Find the index of the vertex in the Sphere closest to the input vector
- Parameters:
- xyzarray-like, 3 elements
A unit vector
- Returns:
- idxint
The index into the Sphere.vertices array that gives the closest
vertex (in angle).
-
subdivide(n=1)
Subdivides each face of the sphere into four new faces.
New vertices are created at a, b, and c. Then each face [x, y, z] is
divided into faces [x, a, c], [y, a, b], [z, b, c], and [a, b, c].
y
/\
/ \
a/____\b
/\ /\
/ \ / \
/____\/____\
x c z
- Parameters:
- nint, optional
The number of subdivisions to preform.
- Returns:
- new_sphereSphere
The subdivided sphere.
-
vertices()
-
property x
-
property y
-
property z
as_native_array
-
dipy.data.as_native_array(arr)
Return arr as native byteordered array
If arr is already native byte ordered, return unchanged. If it is opposite
endian, then make a native byte ordered copy and return that
- Parameters:
- arrndarray
- Returns:
- native_arrndarray
If arr was native order, this is just arr. Otherwise it’s a new
array such that np.all(native_arr == arr)
, with native byte
ordering.
dirname
-
dipy.data.dirname(p)
Returns the directory component of a pathname
dsi_deconv_voxels
-
dipy.data.dsi_deconv_voxels()
dsi_voxels
-
dipy.data.dsi_voxels()
exists
-
dipy.data.exists(path)
Test whether a path exists. Returns False for broken symbolic links
fetch_bundle_atlas_hcp842
-
dipy.data.fetch_bundle_atlas_hcp842()
Download atlas tractogram from the hcp842 dataset with 80 bundles
fetch_bundle_fa_hcp
-
dipy.data.fetch_bundle_fa_hcp()
Download map of FA within two bundles in oneof the hcp dataset subjects
fetch_bundles_2_subjects
-
dipy.data.fetch_bundles_2_subjects()
Download 2 subjects from the SNAIL dataset with their bundles
fetch_cenir_multib
-
dipy.data.fetch_cenir_multib(with_raw=False)
Fetch ‘HCP-like’ data, collected at multiple b-values.
- Parameters:
- with_rawbool
Whether to fetch the raw data. Per default, this is False, which means
that only eddy-current/motion corrected data is fetched
Notes
Details of the acquisition and processing, and additional meta-data are
available through UW researchworks:
https://digital.lib.washington.edu/researchworks/handle/1773/33311
fetch_cfin_multib
-
dipy.data.fetch_cfin_multib()
Download CFIN multi b-value diffusion data
fetch_gold_standard_io
-
dipy.data.fetch_gold_standard_io()
Downloads the gold standard for streamlines io testing.
fetch_hbn
-
dipy.data.fetch_hbn(subjects, path=None)
Fetch preprocessed data from the Healthy Brain Network POD2 study [1, 2]_.
- Parameters:
- subjectslist
Identifiers of the subjects to download.
For example: [“NDARAA948VFH”, “NDAREK918EC2”].
- pathstring, optional
Path to save files into. Default: ‘~/.dipy’
- Returns:
- dict with remote and local names of these files,
- path to BIDS derivative dataset
Notes
[1]
Alexander LM, Escalera J, Ai L, et al. An open resource for
transdiagnostic research in pediatric mental health and learning
disorders. Sci Data. 2017;4:170181.
[2]
Richie-Halford A, Cieslak M, Ai L, et al. An analysis-ready and
quality controlled resource for pediatric brain white-matter research.
Scientific Data. 2022;9(1):1-27.
fetch_isbi2013_2shell
-
dipy.data.fetch_isbi2013_2shell()
Download a 2-shell software phantom dataset
fetch_ivim
-
dipy.data.fetch_ivim()
Download IVIM dataset
fetch_mni_template
-
dipy.data.fetch_mni_template()
fetch the MNI 2009a T1 and T2, and 2009c T1 and T1 mask files
Notes
—–
The templates were downloaded from the MNI (McGill University)
website
in July 2015.
The following publications should be referenced when using these templates:
[1]
VS Fonov, AC Evans, K Botteron, CR Almli, RC McKinstry, DL Collins
and BDCG, Unbiased average age-appropriate atlases for pediatric
studies, NeuroImage, 54:1053-8119,
DOI: 10.1016/j.neuroimage.2010.07.033
[2]
VS Fonov, AC Evans, RC McKinstry, CR Almli and DL Collins,
Unbiased nonlinear average age-appropriate brain templates from
birth to adulthood, NeuroImage, 47:S102
Organization for Human Brain Mapping 2009 Annual Meeting,
DOI: https://doi.org/10.1016/S1053-8119(09)70884-5
License for the MNI templates:
Copyright (C) 1993-2004, Louis Collins McConnell Brain Imaging Centre,
Montreal Neurological Institute, McGill University. Permission to use,
copy, modify, and distribute this software and its documentation for any
purpose and without fee is hereby granted, provided that the above
copyright notice appear in all copies. The authors and McGill University
make no representations about the suitability of this software for any
purpose. It is provided “as is” without express or implied warranty. The
authors are not responsible for any data loss, equipment damage, property
loss, or injury to subjects or patients resulting from the use or misuse
of this software package.
fetch_resdnn_weights
-
dipy.data.fetch_resdnn_weights()
Download ResDNN model weights for Nath et. al 2018
fetch_scil_b0
-
dipy.data.fetch_scil_b0()
Download b=0 datasets from multiple MR systems (GE, Philips, Siemens) and different magnetic fields (1.5T and 3T)
fetch_sherbrooke_3shell
-
dipy.data.fetch_sherbrooke_3shell()
Download a 3shell HARDI dataset with 192 gradient direction
fetch_stanford_hardi
-
dipy.data.fetch_stanford_hardi()
Download a HARDI dataset with 160 gradient directions
fetch_stanford_labels
-
dipy.data.fetch_stanford_labels()
Download reduced freesurfer aparc image from stanford web site
fetch_stanford_pve_maps
-
dipy.data.fetch_stanford_pve_maps()
fetch_stanford_t1
-
dipy.data.fetch_stanford_t1()
fetch_syn_data
-
dipy.data.fetch_syn_data()
Download t1 and b0 volumes from the same session
fetch_taiwan_ntu_dsi
-
dipy.data.fetch_taiwan_ntu_dsi()
Download a DSI dataset with 203 gradient directions
fetch_target_tractogram_hcp
-
dipy.data.fetch_target_tractogram_hcp()
Download tractogram of one of the hcp dataset subjects
fetch_tissue_data
-
dipy.data.fetch_tissue_data()
Download images to be used for tissue classification
get_3shell_gtab
-
dipy.data.get_3shell_gtab()
get_bundle_atlas_hcp842
-
dipy.data.get_bundle_atlas_hcp842()
- Returns:
- file1string
- file2string
get_cmap
-
dipy.data.get_cmap(name)
Make a callable, similar to maptlotlib.pyplot.get_cmap.
get_fnames
-
dipy.data.get_fnames(name='small_64D')
Provide full paths to example or test datasets.
- Parameters:
- namestr
the filename/s of which dataset to return, one of:
‘small_64D’ small region of interest nifti,bvecs,bvals 64 directions
‘small_101D’ small region of interest nifti, bvecs, bvals
101 directions
‘aniso_vox’ volume with anisotropic voxel size as Nifti
‘fornix’ 300 tracks in Trackvis format (from Pittsburgh
Brain Competition)
‘gqi_vectors’ the scanner wave vectors needed for a GQI acquisitions
of 101 directions tested on Siemens 3T Trio
‘small_25’ small ROI (10x8x2) DTI data (b value 2000, 25 directions)
‘test_piesno’ slice of N=8, K=14 diffusion data
‘reg_c’ small 2D image used for validating registration
‘reg_o’ small 2D image used for validation registration
‘cb_2’ two vectorized cingulum bundles
- Returns:
- fnamestuple
filenames for dataset
Examples
>>> import numpy as np
>>> from dipy.io.image import load_nifti
>>> from dipy.data import get_fnames
>>> fimg, fbvals, fbvecs = get_fnames('small_101D')
>>> bvals=np.loadtxt(fbvals)
>>> bvecs=np.loadtxt(fbvecs).T
>>> data, affine = load_nifti(fimg)
>>> data.shape == (6, 10, 10, 102)
True
>>> bvals.shape == (102,)
True
>>> bvecs.shape == (102, 3)
True
get_gtab_taiwan_dsi
-
dipy.data.get_gtab_taiwan_dsi()
get_isbi2013_2shell_gtab
-
dipy.data.get_isbi2013_2shell_gtab()
get_sim_voxels
-
dipy.data.get_sim_voxels(name='fib1')
provide some simulated voxel data
- Parameters:
- namestr, which file?
‘fib0’, ‘fib1’ or ‘fib2’
- Returns:
- dixdictionary, where dix[‘data’] returns a 2d array
where every row is a simulated voxel with different orientation
Notes
These sim voxels were provided by M.M. Correia using Rician noise.
Examples
>>> from dipy.data import get_sim_voxels
>>> sv=get_sim_voxels('fib1')
>>> sv['data'].shape == (100, 102)
True
>>> sv['fibres']
'1'
>>> sv['gradients'].shape == (102, 3)
True
>>> sv['bvals'].shape == (102,)
True
>>> sv['snr']
'60'
>>> sv2=get_sim_voxels('fib2')
>>> sv2['fibres']
'2'
>>> sv2['snr']
'80'
get_skeleton
-
dipy.data.get_skeleton(name='C1')
Provide skeletons generated from Local Skeleton Clustering (LSC).
- Parameters:
- namestr, ‘C1’ or ‘C3’
- Returns:
- dixdictionary
Examples
>>> from dipy.data import get_skeleton
>>> C=get_skeleton('C1')
>>> len(C.keys())
117
>>> for c in C: break
>>> sorted(C[c].keys())
['N', 'hidden', 'indices', 'most']
get_sphere
-
dipy.data.get_sphere(name='symmetric362')
provide triangulated spheres
- Parameters:
- namestr
which sphere - one of:
* ‘symmetric362’
* ‘symmetric642’
* ‘symmetric724’
* ‘repulsion724’
* ‘repulsion100’
* ‘repulsion200’
- Returns:
- spherea dipy.core.sphere.Sphere class instance
Examples
>>> import numpy as np
>>> from dipy.data import get_sphere
>>> sphere = get_sphere('symmetric362')
>>> verts, faces = sphere.vertices, sphere.faces
>>> verts.shape == (362, 3)
True
>>> faces.shape == (720, 3)
True
>>> verts, faces = get_sphere('not a sphere name')
Traceback (most recent call last):
...
DataError: No sphere called "not a sphere name"
get_target_tractogram_hcp
-
dipy.data.get_target_tractogram_hcp()
- Returns:
- file1string
get_two_hcp842_bundles
-
dipy.data.get_two_hcp842_bundles()
- Returns:
- file1string
- file2string
gradient_table
-
dipy.data.gradient_table(bvals, bvecs=None, big_delta=None, small_delta=None, b0_threshold=50, atol=0.01, btens=None)
A general function for creating diffusion MR gradients.
It reads, loads and prepares scanner parameters like the b-values and
b-vectors so that they can be useful during the reconstruction process.
- Parameters:
- bvalscan be any of the four options
an array of shape (N,) or (1, N) or (N, 1) with the b-values.
a path for the file which contains an array like the above (1).
an array of shape (N, 4) or (4, N). Then this parameter is
considered to be a b-table which contains both bvals and bvecs. In
this case the next parameter is skipped.
a path for the file which contains an array like the one at (3).
- bvecscan be any of two options
an array of shape (N, 3) or (3, N) with the b-vectors.
a path for the file which contains an array like the previous.
- big_deltafloat
acquisition pulse separation time in seconds (default None)
- small_deltafloat
acquisition pulse duration time in seconds (default None)
- b0_thresholdfloat
All b-values with values less than or equal to bo_threshold are
considered as b0s i.e. without diffusion weighting.
- atolfloat
All b-vectors need to be unit vectors up to a tolerance.
- btenscan be any of three options
a string specifying the shape of the encoding tensor for all volumes
in data. Options: ‘LTE’, ‘PTE’, ‘STE’, ‘CTE’ corresponding to
linear, planar, spherical, and “cigar-shaped” tensor encoding.
Tensors are rotated so that linear and cigar tensors are aligned
with the corresponding gradient direction and the planar tensor’s
normal is aligned with the corresponding gradient direction.
Magnitude is scaled to match the b-value.
an array of strings of shape (N,), (N, 1), or (1, N) specifying
encoding tensor shape for each volume separately. N corresponds to
the number volumes in data. Options for elements in array: ‘LTE’,
‘PTE’, ‘STE’, ‘CTE’ corresponding to linear, planar, spherical, and
“cigar-shaped” tensor encoding. Tensors are rotated so that linear
and cigar tensors are aligned with the corresponding gradient
direction and the planar tensor’s normal is aligned with the
corresponding gradient direction. Magnitude is scaled to match the
b-value.
an array of shape (N,3,3) specifying the b-tensor of each volume
exactly. N corresponds to the number volumes in data. No rotation or
scaling is performed.
- Returns:
- gradientsGradientTable
A GradientTable with all the gradient information.
Notes
Often b0s (b-values which correspond to images without diffusion
weighting) have 0 values however in some cases the scanner cannot
provide b0s of an exact 0 value and it gives a bit higher values
e.g. 6 or 12. This is the purpose of the b0_threshold in the __init__.
We assume that the minimum number of b-values is 7.
B-vectors should be unit vectors.
Examples
>>> from dipy.core.gradients import gradient_table
>>> bvals = 1500 * np.ones(7)
>>> bvals[0] = 0
>>> sq2 = np.sqrt(2) / 2
>>> bvecs = np.array([[0, 0, 0],
... [1, 0, 0],
... [0, 1, 0],
... [0, 0, 1],
... [sq2, sq2, 0],
... [sq2, 0, sq2],
... [0, sq2, sq2]])
>>> gt = gradient_table(bvals, bvecs)
>>> gt.bvecs.shape == bvecs.shape
True
>>> gt = gradient_table(bvals, bvecs.T)
>>> gt.bvecs.shape == bvecs.T.shape
False
load_nifti
-
dipy.data.load_nifti(fname, return_img=False, return_voxsize=False, return_coords=False, as_ndarray=True)
Load data and other information from a nifti file.
- Parameters:
- fnamestr
Full path to a nifti file.
- return_imgbool, optional
Whether to return the nibabel nifti img object. Default: False
- return_voxsize: bool, optional
Whether to return the nifti header zooms. Default: False
- return_coordsbool, optional
Whether to return the nifti header aff2axcodes. Default: False
- as_ndarray: bool, optional
convert nibabel ArrayProxy to a numpy.ndarray.
If you want to save memory and delay this casting, just turn this
option to False (default: True)
- Returns:
- A tuple, with (at the most, if all keyword args are set to True):
- (data, img.affine, img, vox_size, nib.aff2axcodes(img.affine))
load_npz
-
dipy.data.load_npz(file)
Load a sparse matrix from a file using .npz
format.
- Parameters:
- filestr or file-like object
Either the file name (string) or an open file (file-like object)
where the data will be loaded.
- Returns:
- resultcsc_matrix, csr_matrix, bsr_matrix, dia_matrix or coo_matrix
A sparse matrix containing the loaded data.
- Raises:
- OSError
If the input file does not exist or cannot be read.
See also
scipy.sparse.save_npz
Save a sparse matrix to a file using .npz
format.
numpy.load
Load several arrays from a .npz
archive.
Examples
Store sparse matrix to disk, and load it again:
>>> import numpy as np
>>> import scipy.sparse
>>> sparse_matrix = scipy.sparse.csc_matrix(np.array([[0, 0, 3], [4, 0, 0]]))
>>> sparse_matrix
<2x3 sparse matrix of type '<class 'numpy.int64'>'
with 2 stored elements in Compressed Sparse Column format>
>>> sparse_matrix.toarray()
array([[0, 0, 3],
[4, 0, 0]], dtype=int64)
>>> scipy.sparse.save_npz('/tmp/sparse_matrix.npz', sparse_matrix)
>>> sparse_matrix = scipy.sparse.load_npz('/tmp/sparse_matrix.npz')
>>> sparse_matrix
<2x3 sparse matrix of type '<class 'numpy.int64'>'
with 2 stored elements in Compressed Sparse Column format>
>>> sparse_matrix.toarray()
array([[0, 0, 3],
[4, 0, 0]], dtype=int64)
load_sdp_constraints
-
dipy.data.load_sdp_constraints(model_name, order=None)
Import semidefinite programming constraint matrices for different models,
generated as described for example in [1].
- Parameters:
- model_namestring
A string identifying the model that is to be constrained.
- orderunsigned int, optional
A non-negative integer that represent the order or instance of the
model.
Default: None.
- Returns:
- sdp_constraintsarray
Constraint matrices
Notes
The constraints will be loaded from a file named ‘id_constraint_order.npz’.
References
[1]
(1,2)
Dela Haije et al. “Enforcing necessary non-negativity constraints
for common diffusion MRI models using sum of squares programming”.
NeuroImage 209, 2020, 116405.
loads_compat
-
dipy.data.loads_compat(byte_data)
matlab_life_results
-
dipy.data.matlab_life_results()
mrtrix_spherical_functions
-
dipy.data.mrtrix_spherical_functions()
Spherical functions represented by spherical harmonic coefficients and
evaluated on a discrete sphere.
- Returns:
- func_coefarray (2, 3, 4, 45)
Functions represented by the coefficients associated with the
mrtrix spherical harmonic basis of order 8.
- func_discretearray (2, 3, 4, 81)
Functions evaluated on sphere.
- sphereSphere
The discrete sphere, points on the surface of a unit sphere, used to
evaluate the functions.
Notes
These coefficients were obtained by using the dwi2SH command of mrtrix.
pjoin
-
dipy.data.pjoin(a, *p)
Join two or more pathname components, inserting ‘/’ as needed.
If any component is an absolute path, all previous path components
will be discarded. An empty last part will result in a path that
ends with a separator.
read_DiB_217_lte_pte_ste
-
dipy.data.read_DiB_217_lte_pte_ste()
Read q-space trajectory encoding data with 217 between linear,
planar, and spherical tensor encoding.
- Returns:
- data_imgnibabel.nifti1.Nifti1Image
dMRI data image.
- mask_imgnibabel.nifti1.Nifti1Image
Brain mask image.
- gtabdipy.core.gradients.GradientTable
Gradient table.
read_DiB_70_lte_pte_ste
-
dipy.data.read_DiB_70_lte_pte_ste()
Read q-space trajectory encoding data with 70 between linear, planar,
and spherical tensor encoding measurements.
- Returns:
- data_imgnibabel.nifti1.Nifti1Image
dMRI data image.
- mask_imgnibabel.nifti1.Nifti1Image
Brain mask image.
- gtabdipy.core.gradients.GradientTable
Gradient table.
read_bundles_2_subjects
-
dipy.data.read_bundles_2_subjects(subj_id='subj_1', metrics=('fa',), bundles=('af.left', 'cst.right', 'cc_1'))
Read images and streamlines from 2 subjects of the SNAIL dataset.
- Parameters:
- subj_idstring
Either subj_1
or subj_2
.
- metricsarray-like
Either [‘fa’] or [‘t1’] or [‘fa’, ‘t1’]
- bundlesarray-like
E.g., [‘af.left’, ‘cst.right’, ‘cc_1’]. See all the available bundles
in the exp_bundles_maps/bundles_2_subjects
directory of your
$HOME/.dipy
folder.
- Returns:
- dixdict
Dictionary with data of the metrics and the bundles as keys.
Notes
If you are using these datasets please cite the following publications.
References
[1]
Renauld, E., M. Descoteaux, M. Bernier, E. Garyfallidis,
K. Whittingstall, “Morphology of thalamus, LGN and optic radiation do not
influence EEG alpha waves”, Plos One (under submission), 2015.
[2]
Garyfallidis, E., O. Ocegueda, D. Wassermann,
M. Descoteaux. Robust and efficient linear registration of fascicles in the
space of streamlines , Neuroimage, 117:124-140, 2015.
read_cenir_multib
-
dipy.data.read_cenir_multib(bvals=None)
Read CENIR multi b-value data.
- Parameters:
- bvalslist or int
The b-values to read from file (200, 400, 1000, 2000, 3000).
- Returns:
- gtaba GradientTable class instance
- imgnibabel.Nifti1Image
Notes
Details of the acquisition and processing, and additional meta-data are
available through UW researchworks:
https://digital.lib.washington.edu/researchworks/handle/1773/33311
read_cfin_dwi
-
dipy.data.read_cfin_dwi()
Load CFIN multi b-value DWI data.
- Returns:
- imgobj,
Nifti1Image
- gtabobj,
GradientTable
read_cfin_t1
-
dipy.data.read_cfin_t1()
Load CFIN T1-weighted data.
- Returns:
- imgobj,
Nifti1Image
read_five_af_bundles
-
dipy.data.read_five_af_bundles()
Load 5 small left arcuate fasciculus bundles.
- Returns:
- bundles: list of ArraySequence
List with loaded bundles.
read_isbi2013_2shell
-
dipy.data.read_isbi2013_2shell()
Load ISBI 2013 2-shell synthetic dataset.
- Returns:
- imgobj,
Nifti1Image
- gtabobj,
GradientTable
read_ivim
-
dipy.data.read_ivim()
Load IVIM dataset.
- Returns:
- imgobj,
Nifti1Image
- gtabobj,
GradientTable
read_mni_template
-
dipy.data.read_mni_template(version='a', contrast='T2')
Read the MNI template from disk.
- Parameters:
- version: string
There are two MNI templates 2009a and 2009c, so options available are:
“a” and “c”.
- contrastlist or string, optional
Which of the contrast templates to read. For version “a” two contrasts
are available: “T1” and “T2”. Similarly for version “c” there are two
options, “T1” and “mask”. You can input contrast as a string or a list
- Returns:
- listcontains the nibabel.Nifti1Image objects requested, according to the
order they were requested in the input.
Notes
The templates were downloaded from the MNI (McGill University)
website
in July 2015.
The following publications should be referenced when using these templates:
[1]
VS Fonov, AC Evans, K Botteron, CR Almli, RC McKinstry, DL Collins
and BDCG, Unbiased average age-appropriate atlases for pediatric
studies, NeuroImage, 54:1053-8119,
DOI: 10.1016/j.neuroimage.2010.07.033
[2]
VS Fonov, AC Evans, RC McKinstry, CR Almli and DL Collins,
Unbiased nonlinear average age-appropriate brain templates from
birth to adulthood, NeuroImage, 47:S102
Organization for Human Brain Mapping 2009 Annual Meeting,
DOI: https://doi.org/10.1016/S1053-8119(09)70884-5
License for the MNI templates:
Copyright (C) 1993-2004, Louis Collins McConnell Brain Imaging Centre,
Montreal Neurological Institute, McGill University. Permission to use,
copy, modify, and distribute this software and its documentation for any
purpose and without fee is hereby granted, provided that the above
copyright notice appear in all copies. The authors and McGill University
make no representations about the suitability of this software for any
purpose. It is provided “as is” without express or implied warranty. The
authors are not responsible for any data loss, equipment damage, property
loss, or injury to subjects or patients resulting from the use or misuse
of this software package.
Examples
>>> # Get only the T1 file for version c:
>>> T1 = read_mni_template("c", contrast = "T1")
>>> # Get both files in this order for version a:
>>> T1, T2 = read_mni_template(contrast = ["T1", "T2"])
read_qte_lte_pte
-
dipy.data.read_qte_lte_pte()
Read q-space trajectory encoding data with linear and planar tensor
encoding.
- Returns:
- data_imgnibabel.nifti1.Nifti1Image
dMRI data image.
- mask_imgnibabel.nifti1.Nifti1Image
Brain mask image.
- gtabdipy.core.gradients.GradientTable
Gradient table.
read_scil_b0
-
dipy.data.read_scil_b0()
Load GE 3T b0 image form the scil b0 dataset.
- Returns:
- imgobj,
Nifti1Image
read_sherbrooke_3shell
-
dipy.data.read_sherbrooke_3shell()
Load Sherbrooke 3-shell HARDI dataset.
- Returns:
- imgobj,
Nifti1Image
- gtabobj,
GradientTable
read_stanford_hardi
-
dipy.data.read_stanford_hardi()
Load Stanford HARDI dataset.
- Returns:
- imgobj,
Nifti1Image
- gtabobj,
GradientTable
read_stanford_labels
-
dipy.data.read_stanford_labels()
Read stanford hardi data and label map.
read_stanford_pve_maps
-
dipy.data.read_stanford_pve_maps()
read_stanford_t1
-
dipy.data.read_stanford_t1()
read_syn_data
-
dipy.data.read_syn_data()
Load t1 and b0 volumes from the same session.
- Returns:
- t1obj,
Nifti1Image
- b0obj,
Nifti1Image
read_taiwan_ntu_dsi
-
dipy.data.read_taiwan_ntu_dsi()
Load Taiwan NTU dataset.
- Returns:
- imgobj,
Nifti1Image
- gtabobj,
GradientTable
read_tissue_data
-
dipy.data.read_tissue_data(contrast='T1')
Load images to be used for tissue classification
- Parameters:
- constraststr
‘T1’, ‘T1 denoised’ or ‘Anisotropic Power’
- Returns:
- imageobj,
Nifti1Image
relist_streamlines
-
dipy.data.relist_streamlines(points, offsets)
Given a representation of a set of streamlines as a large array and
an offsets array return the streamlines as a list of shorter arrays.
- Parameters:
- pointsarray
- offsetsarray
- Returns:
- streamlines: sequence
two_cingulum_bundles
-
dipy.data.two_cingulum_bundles()
-
class dipy.data.fetcher.FetcherError
Bases: Exception
- Attributes:
- args
Methods
with_traceback
|
Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self. |
-
__init__(*args, **kwargs)
-
class dipy.data.fetcher.TripWire(msg)
Bases: object
Class raising error if used
Standard use is to proxy modules that we could not import
Examples
>>> try:
... import silly_module_name
... except ImportError:
... silly_module_name = TripWire('We do not have silly_module_name')
>>> silly_module_name.do_silly_thing('with silly string')
Traceback (most recent call last):
...
TripWireError: We do not have silly_module_name
Methods
__call__ (*args, **kwargs)
|
Raise informative error while calling |
-
__init__(msg)
-
dipy.data.fetcher.tqdm
alias of tqdm_asyncio
check_md5
-
dipy.data.fetcher.check_md5(filename, stored_md5=None)
Computes the md5 of filename and check if it matches with the supplied
string md5
- Parameters:
- filenamestring
Path to a file.
- md5string
Known md5 of filename to check against. If None (default), checking is
skipped
copyfileobj
-
dipy.data.fetcher.copyfileobj(fsrc, fdst, length=0)
copy data from file-like object fsrc to file-like object fdst
copyfileobj_withprogress
-
dipy.data.fetcher.copyfileobj_withprogress(fsrc, fdst, total_length, length=16384)
fetch_DiB_217_lte_pte_ste
-
dipy.data.fetcher.fetch_DiB_217_lte_pte_ste()
Download QTE data with linear, planar, and spherical tensor encoding. If using this data please cite F Szczepankiewicz, S Hoge, C-F Westin. Linear, planar and spherical tensor-valued diffusion MRI data by free waveform encoding in healthy brain, water, oil and liquid crystals. Data in Brief (2019),DOI: https://doi.org/10.1016/j.dib.2019.104208
fetch_DiB_70_lte_pte_ste
-
dipy.data.fetcher.fetch_DiB_70_lte_pte_ste()
Download QTE data with linear, planar, and spherical tensor encoding. If using this data please cite F Szczepankiewicz, S Hoge, C-F Westin. Linear, planar and spherical tensor-valued diffusion MRI data by free waveform encoding in healthy brain, water, oil and liquid crystals. Data in Brief (2019),DOI: https://doi.org/10.1016/j.dib.2019.104208
fetch_bundle_atlas_hcp842
-
dipy.data.fetcher.fetch_bundle_atlas_hcp842()
Download atlas tractogram from the hcp842 dataset with 80 bundles
fetch_bundle_fa_hcp
-
dipy.data.fetcher.fetch_bundle_fa_hcp()
Download map of FA within two bundles in oneof the hcp dataset subjects
fetch_bundles_2_subjects
-
dipy.data.fetcher.fetch_bundles_2_subjects()
Download 2 subjects from the SNAIL dataset with their bundles
fetch_cenir_multib
-
dipy.data.fetcher.fetch_cenir_multib(with_raw=False)
Fetch ‘HCP-like’ data, collected at multiple b-values.
- Parameters:
- with_rawbool
Whether to fetch the raw data. Per default, this is False, which means
that only eddy-current/motion corrected data is fetched
Notes
Details of the acquisition and processing, and additional meta-data are
available through UW researchworks:
https://digital.lib.washington.edu/researchworks/handle/1773/33311
fetch_cfin_multib
-
dipy.data.fetcher.fetch_cfin_multib()
Download CFIN multi b-value diffusion data
fetch_data
-
dipy.data.fetcher.fetch_data(files, folder, data_size=None)
Downloads files to folder and checks their md5 checksums
- Parameters:
- filesdictionary
For each file in files the value should be (url, md5). The file will
be downloaded from url if the file does not already exist or if the
file exists but the md5 checksum does not match.
- folderstr
The directory where to save the file, the directory will be created if
it does not already exist.
- data_sizestr, optional
A string describing the size of the data (e.g. “91 MB”) to be logged to
the screen. Default does not produce any information about data size.
- Raises
- ——
- FetcherError
Raises if the md5 checksum of the file does not match the expected
value. The downloaded file is not deleted when this error is raised.
fetch_fury_surface
-
dipy.data.fetcher.fetch_fury_surface()
Surface for testing and examples
fetch_gold_standard_io
-
dipy.data.fetcher.fetch_gold_standard_io()
Downloads the gold standard for streamlines io testing.
fetch_hbn
-
dipy.data.fetcher.fetch_hbn(subjects, path=None)
Fetch preprocessed data from the Healthy Brain Network POD2 study [1, 2]_.
- Parameters:
- subjectslist
Identifiers of the subjects to download.
For example: [“NDARAA948VFH”, “NDAREK918EC2”].
- pathstring, optional
Path to save files into. Default: ‘~/.dipy’
- Returns:
- dict with remote and local names of these files,
- path to BIDS derivative dataset
Notes
[1]
Alexander LM, Escalera J, Ai L, et al. An open resource for
transdiagnostic research in pediatric mental health and learning
disorders. Sci Data. 2017;4:170181.
[2]
Richie-Halford A, Cieslak M, Ai L, et al. An analysis-ready and
quality controlled resource for pediatric brain white-matter research.
Scientific Data. 2022;9(1):1-27.
fetch_hcp
-
dipy.data.fetcher.fetch_hcp(subjects, hcp_bucket='hcp-openaccess', profile_name='hcp', path=None, study='HCP_1200', aws_access_key_id=None, aws_secret_access_key=None)
Fetch HCP diffusion data and arrange it in a manner that resembles the
BIDS [1] specification.
- Parameters:
- subjectslist
Each item is an integer, identifying one of the HCP subjects
- hcp_bucketstring, optional
The name of the HCP S3 bucket. Default: “hcp-openaccess”
- profile_namestring, optional
The name of the AWS profile used for access. Default: “hcp”
- pathstring, optional
Path to save files into. Default: ‘~/.dipy’
- studystring, optional
Which HCP study to grab. Default: ‘HCP_1200’
- aws_access_key_idstring, optional
AWS credentials to HCP AWS S3. Will only be used if profile_name is
set to False.
- aws_secret_access_keystring, optional
AWS credentials to HCP AWS S3. Will only be used if profile_name is
set to False.
- Returns:
- dict with remote and local names of these files,
- path to BIDS derivative dataset
Notes
To use this function with its default setting, you need to have a
file ‘~/.aws/credentials’, that includes a section:
[hcp]
AWS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXX
AWS_SECRET_ACCESS_KEY=XXXXXXXXXXXXXXXX
The keys are credentials that you can get from HCP
(see https://wiki.humanconnectome.org/display/PublicData/How+To+Connect+to+Connectome+Data+via+AWS) # noqa
Local filenames are changed to match our expected conventions.
[1]
(1,2)
Gorgolewski et al. (2016). The brain imaging data structure,
a format for organizing and describing outputs of neuroimaging
experiments. Scientific Data, 3::160044. DOI: 10.1038/sdata.2016.44.
fetch_isbi2013_2shell
-
dipy.data.fetcher.fetch_isbi2013_2shell()
Download a 2-shell software phantom dataset
fetch_ivim
-
dipy.data.fetcher.fetch_ivim()
Download IVIM dataset
fetch_mni_template
-
dipy.data.fetcher.fetch_mni_template()
fetch the MNI 2009a T1 and T2, and 2009c T1 and T1 mask files
Notes
—–
The templates were downloaded from the MNI (McGill University)
website
in July 2015.
The following publications should be referenced when using these templates:
[1]
VS Fonov, AC Evans, K Botteron, CR Almli, RC McKinstry, DL Collins
and BDCG, Unbiased average age-appropriate atlases for pediatric
studies, NeuroImage, 54:1053-8119,
DOI: 10.1016/j.neuroimage.2010.07.033
[2]
VS Fonov, AC Evans, RC McKinstry, CR Almli and DL Collins,
Unbiased nonlinear average age-appropriate brain templates from
birth to adulthood, NeuroImage, 47:S102
Organization for Human Brain Mapping 2009 Annual Meeting,
DOI: https://doi.org/10.1016/S1053-8119(09)70884-5
License for the MNI templates:
Copyright (C) 1993-2004, Louis Collins McConnell Brain Imaging Centre,
Montreal Neurological Institute, McGill University. Permission to use,
copy, modify, and distribute this software and its documentation for any
purpose and without fee is hereby granted, provided that the above
copyright notice appear in all copies. The authors and McGill University
make no representations about the suitability of this software for any
purpose. It is provided “as is” without express or implied warranty. The
authors are not responsible for any data loss, equipment damage, property
loss, or injury to subjects or patients resulting from the use or misuse
of this software package.
fetch_qtdMRI_test_retest_2subjects
-
dipy.data.fetcher.fetch_qtdMRI_test_retest_2subjects()
Downloads test-retest qt-dMRI acquisitions of two C57Bl6 mice.
fetch_qte_lte_pte
-
dipy.data.fetcher.fetch_qte_lte_pte()
Download QTE data with linear and planar tensor encoding.
fetch_resdnn_weights
-
dipy.data.fetcher.fetch_resdnn_weights()
Download ResDNN model weights for Nath et. al 2018
fetch_scil_b0
-
dipy.data.fetcher.fetch_scil_b0()
Download b=0 datasets from multiple MR systems (GE, Philips, Siemens) and different magnetic fields (1.5T and 3T)
fetch_sherbrooke_3shell
-
dipy.data.fetcher.fetch_sherbrooke_3shell()
Download a 3shell HARDI dataset with 192 gradient direction
fetch_stanford_hardi
-
dipy.data.fetcher.fetch_stanford_hardi()
Download a HARDI dataset with 160 gradient directions
fetch_stanford_labels
-
dipy.data.fetcher.fetch_stanford_labels()
Download reduced freesurfer aparc image from stanford web site
fetch_stanford_pve_maps
-
dipy.data.fetcher.fetch_stanford_pve_maps()
fetch_stanford_t1
-
dipy.data.fetcher.fetch_stanford_t1()
fetch_syn_data
-
dipy.data.fetcher.fetch_syn_data()
Download t1 and b0 volumes from the same session
fetch_taiwan_ntu_dsi
-
dipy.data.fetcher.fetch_taiwan_ntu_dsi()
Download a DSI dataset with 203 gradient directions
fetch_target_tractogram_hcp
-
dipy.data.fetcher.fetch_target_tractogram_hcp()
Download tractogram of one of the hcp dataset subjects
fetch_tissue_data
-
dipy.data.fetcher.fetch_tissue_data()
Download images to be used for tissue classification
get_bundle_atlas_hcp842
-
dipy.data.fetcher.get_bundle_atlas_hcp842()
- Returns:
- file1string
- file2string
get_fnames
-
dipy.data.fetcher.get_fnames(name='small_64D')
Provide full paths to example or test datasets.
- Parameters:
- namestr
the filename/s of which dataset to return, one of:
‘small_64D’ small region of interest nifti,bvecs,bvals 64 directions
‘small_101D’ small region of interest nifti, bvecs, bvals
101 directions
‘aniso_vox’ volume with anisotropic voxel size as Nifti
‘fornix’ 300 tracks in Trackvis format (from Pittsburgh
Brain Competition)
‘gqi_vectors’ the scanner wave vectors needed for a GQI acquisitions
of 101 directions tested on Siemens 3T Trio
‘small_25’ small ROI (10x8x2) DTI data (b value 2000, 25 directions)
‘test_piesno’ slice of N=8, K=14 diffusion data
‘reg_c’ small 2D image used for validating registration
‘reg_o’ small 2D image used for validation registration
‘cb_2’ two vectorized cingulum bundles
- Returns:
- fnamestuple
filenames for dataset
Examples
>>> import numpy as np
>>> from dipy.io.image import load_nifti
>>> from dipy.data import get_fnames
>>> fimg, fbvals, fbvecs = get_fnames('small_101D')
>>> bvals=np.loadtxt(fbvals)
>>> bvecs=np.loadtxt(fbvecs).T
>>> data, affine = load_nifti(fimg)
>>> data.shape == (6, 10, 10, 102)
True
>>> bvals.shape == (102,)
True
>>> bvecs.shape == (102, 3)
True
get_target_tractogram_hcp
-
dipy.data.fetcher.get_target_tractogram_hcp()
- Returns:
- file1string
get_two_hcp842_bundles
-
dipy.data.fetcher.get_two_hcp842_bundles()
- Returns:
- file1string
- file2string
gradient_table
-
dipy.data.fetcher.gradient_table(bvals, bvecs=None, big_delta=None, small_delta=None, b0_threshold=50, atol=0.01, btens=None)
A general function for creating diffusion MR gradients.
It reads, loads and prepares scanner parameters like the b-values and
b-vectors so that they can be useful during the reconstruction process.
- Parameters:
- bvalscan be any of the four options
an array of shape (N,) or (1, N) or (N, 1) with the b-values.
a path for the file which contains an array like the above (1).
an array of shape (N, 4) or (4, N). Then this parameter is
considered to be a b-table which contains both bvals and bvecs. In
this case the next parameter is skipped.
a path for the file which contains an array like the one at (3).
- bvecscan be any of two options
an array of shape (N, 3) or (3, N) with the b-vectors.
a path for the file which contains an array like the previous.
- big_deltafloat
acquisition pulse separation time in seconds (default None)
- small_deltafloat
acquisition pulse duration time in seconds (default None)
- b0_thresholdfloat
All b-values with values less than or equal to bo_threshold are
considered as b0s i.e. without diffusion weighting.
- atolfloat
All b-vectors need to be unit vectors up to a tolerance.
- btenscan be any of three options
a string specifying the shape of the encoding tensor for all volumes
in data. Options: ‘LTE’, ‘PTE’, ‘STE’, ‘CTE’ corresponding to
linear, planar, spherical, and “cigar-shaped” tensor encoding.
Tensors are rotated so that linear and cigar tensors are aligned
with the corresponding gradient direction and the planar tensor’s
normal is aligned with the corresponding gradient direction.
Magnitude is scaled to match the b-value.
an array of strings of shape (N,), (N, 1), or (1, N) specifying
encoding tensor shape for each volume separately. N corresponds to
the number volumes in data. Options for elements in array: ‘LTE’,
‘PTE’, ‘STE’, ‘CTE’ corresponding to linear, planar, spherical, and
“cigar-shaped” tensor encoding. Tensors are rotated so that linear
and cigar tensors are aligned with the corresponding gradient
direction and the planar tensor’s normal is aligned with the
corresponding gradient direction. Magnitude is scaled to match the
b-value.
an array of shape (N,3,3) specifying the b-tensor of each volume
exactly. N corresponds to the number volumes in data. No rotation or
scaling is performed.
- Returns:
- gradientsGradientTable
A GradientTable with all the gradient information.
Notes
Often b0s (b-values which correspond to images without diffusion
weighting) have 0 values however in some cases the scanner cannot
provide b0s of an exact 0 value and it gives a bit higher values
e.g. 6 or 12. This is the purpose of the b0_threshold in the __init__.
We assume that the minimum number of b-values is 7.
B-vectors should be unit vectors.
Examples
>>> from dipy.core.gradients import gradient_table
>>> bvals = 1500 * np.ones(7)
>>> bvals[0] = 0
>>> sq2 = np.sqrt(2) / 2
>>> bvecs = np.array([[0, 0, 0],
... [1, 0, 0],
... [0, 1, 0],
... [0, 0, 1],
... [sq2, sq2, 0],
... [sq2, 0, sq2],
... [0, sq2, sq2]])
>>> gt = gradient_table(bvals, bvecs)
>>> gt.bvecs.shape == bvecs.shape
True
>>> gt = gradient_table(bvals, bvecs.T)
>>> gt.bvecs.shape == bvecs.T.shape
False
gradient_table_from_gradient_strength_bvecs
-
dipy.data.fetcher.gradient_table_from_gradient_strength_bvecs(gradient_strength, bvecs, big_delta, small_delta, b0_threshold=50, atol=0.01)
A general function for creating diffusion MR gradients.
It reads, loads and prepares scanner parameters like the b-values and
b-vectors so that they can be useful during the reconstruction process.
- Parameters:
- gradient_strengthan array of shape (N,),
gradient strength given in T/mm
- bvecscan be any of two options
an array of shape (N, 3) or (3, N) with the b-vectors.
a path for the file which contains an array like the previous.
- big_deltafloat or array of shape (N,)
acquisition pulse separation time in seconds
- small_deltafloat
acquisition pulse duration time in seconds
- b0_thresholdfloat
All b-values with values less than or equal to bo_threshold are
considered as b0s i.e. without diffusion weighting.
- atolfloat
All b-vectors need to be unit vectors up to a tolerance.
- Returns:
- gradientsGradientTable
A GradientTable with all the gradient information.
Notes
Often b0s (b-values which correspond to images without diffusion
weighting) have 0 values however in some cases the scanner cannot
provide b0s of an exact 0 value and it gives a bit higher values
e.g. 6 or 12. This is the purpose of the b0_threshold in the __init__.
We assume that the minimum number of b-values is 7.
B-vectors should be unit vectors.
Examples
>>> from dipy.core.gradients import (
... gradient_table_from_gradient_strength_bvecs)
>>> gradient_strength = .03e-3 * np.ones(7) # clinical strength at 30 mT/m
>>> big_delta = .03 # pulse separation of 30ms
>>> small_delta = 0.01 # pulse duration of 10ms
>>> gradient_strength[0] = 0
>>> sq2 = np.sqrt(2) / 2
>>> bvecs = np.array([[0, 0, 0],
... [1, 0, 0],
... [0, 1, 0],
... [0, 0, 1],
... [sq2, sq2, 0],
... [sq2, 0, sq2],
... [0, sq2, sq2]])
>>> gt = gradient_table_from_gradient_strength_bvecs(
... gradient_strength, bvecs, big_delta, small_delta)
load_nifti
-
dipy.data.fetcher.load_nifti(fname, return_img=False, return_voxsize=False, return_coords=False, as_ndarray=True)
Load data and other information from a nifti file.
- Parameters:
- fnamestr
Full path to a nifti file.
- return_imgbool, optional
Whether to return the nibabel nifti img object. Default: False
- return_voxsize: bool, optional
Whether to return the nifti header zooms. Default: False
- return_coordsbool, optional
Whether to return the nifti header aff2axcodes. Default: False
- as_ndarray: bool, optional
convert nibabel ArrayProxy to a numpy.ndarray.
If you want to save memory and delay this casting, just turn this
option to False (default: True)
- Returns:
- A tuple, with (at the most, if all keyword args are set to True):
- (data, img.affine, img, vox_size, nib.aff2axcodes(img.affine))
load_nifti_data
-
dipy.data.fetcher.load_nifti_data(fname, as_ndarray=True)
Load only the data array from a nifti file.
- Parameters:
- fnamestr
Full path to the file.
- as_ndarray: bool, optional
convert nibabel ArrayProxy to a numpy.ndarray.
If you want to save memory and delay this casting, just turn this
option to False (default: True)
- Returns:
- data: np.ndarray or nib.ArrayProxy
load_trk
-
dipy.data.fetcher.load_trk(filename, reference, to_space=Space.RASMM, to_origin=Origin.NIFTI, bbox_valid_check=True, trk_header_check=True)
Load the stateful tractogram of the .trk format
- Parameters:
- filenamestring
Filename with valid extension
- referenceNifti or Trk filename, Nifti1Image or TrkFile, Nifti1Header or
trk.header (dict), or ‘same’ if the input is a trk file.
Reference that provides the spatial attribute.
Typically a nifti-related object from the native diffusion used for
streamlines generation
- to_spaceEnum (dipy.io.stateful_tractogram.Space)
Space to which the streamlines will be transformed after loading
- to_originEnum (dipy.io.stateful_tractogram.Origin)
- Origin to which the streamlines will be transformed after loading
NIFTI standard, default (center of the voxel)
TRACKVIS standard (corner of the voxel)
- bbox_valid_checkbool
Verification for negative voxel coordinates or values above the
volume dimensions. Default is True, to enforce valid file.
- trk_header_checkbool
Verification that the reference has the same header as the spatial
attributes as the input tractogram when a Trk is loaded
- Returns:
- outputStatefulTractogram
The tractogram to load (must have been saved properly)
md5
-
dipy.data.fetcher.md5(/, string=b'', *, usedforsecurity=True)
Returns a md5 hash object; optionally initialized with a string
optional_package
-
dipy.data.fetcher.optional_package(name, trip_msg=None)
Return package-like thing and module setup for package name
- Parameters:
- namestr
package name
- trip_msgNone or str
message to give when someone tries to use the return package, but we
could not import it, and have returned a TripWire object instead.
Default message if None.
- Returns:
- pkg_likemodule or
TripWire
instance If we can import the package, return it. Otherwise return an object
raising an error when accessed
- have_pkgbool
True if import for package was successful, false otherwise
- module_setupfunction
callable usually set as setup_module
in calling namespace, to allow
skipping tests.
Examples
Typical use would be something like this at the top of a module using an
optional package:
>>> from dipy.utils.optpkg import optional_package
>>> pkg, have_pkg, setup_module = optional_package('not_a_package')
Of course in this case the package doesn’t exist, and so, in the module:
and
>>> pkg.some_function()
Traceback (most recent call last):
...
TripWireError: We need package not_a_package for these functions, but
``import not_a_package`` raised an ImportError
If the module does exist - we get the module
>>> pkg, _, _ = optional_package('os')
>>> hasattr(pkg, 'path')
True
Or a submodule if that’s what we asked for
>>> subpkg, _, _ = optional_package('os.path')
>>> hasattr(subpkg, 'dirname')
True
pjoin
-
dipy.data.fetcher.pjoin(a, *p)
Join two or more pathname components, inserting ‘/’ as needed.
If any component is an absolute path, all previous path components
will be discarded. An empty last part will result in a path that
ends with a separator.
read_DiB_217_lte_pte_ste
-
dipy.data.fetcher.read_DiB_217_lte_pte_ste()
Read q-space trajectory encoding data with 217 between linear,
planar, and spherical tensor encoding.
- Returns:
- data_imgnibabel.nifti1.Nifti1Image
dMRI data image.
- mask_imgnibabel.nifti1.Nifti1Image
Brain mask image.
- gtabdipy.core.gradients.GradientTable
Gradient table.
read_DiB_70_lte_pte_ste
-
dipy.data.fetcher.read_DiB_70_lte_pte_ste()
Read q-space trajectory encoding data with 70 between linear, planar,
and spherical tensor encoding measurements.
- Returns:
- data_imgnibabel.nifti1.Nifti1Image
dMRI data image.
- mask_imgnibabel.nifti1.Nifti1Image
Brain mask image.
- gtabdipy.core.gradients.GradientTable
Gradient table.
read_bundles_2_subjects
-
dipy.data.fetcher.read_bundles_2_subjects(subj_id='subj_1', metrics=('fa',), bundles=('af.left', 'cst.right', 'cc_1'))
Read images and streamlines from 2 subjects of the SNAIL dataset.
- Parameters:
- subj_idstring
Either subj_1
or subj_2
.
- metricsarray-like
Either [‘fa’] or [‘t1’] or [‘fa’, ‘t1’]
- bundlesarray-like
E.g., [‘af.left’, ‘cst.right’, ‘cc_1’]. See all the available bundles
in the exp_bundles_maps/bundles_2_subjects
directory of your
$HOME/.dipy
folder.
- Returns:
- dixdict
Dictionary with data of the metrics and the bundles as keys.
Notes
If you are using these datasets please cite the following publications.
References
[1]
Renauld, E., M. Descoteaux, M. Bernier, E. Garyfallidis,
K. Whittingstall, “Morphology of thalamus, LGN and optic radiation do not
influence EEG alpha waves”, Plos One (under submission), 2015.
[2]
Garyfallidis, E., O. Ocegueda, D. Wassermann,
M. Descoteaux. Robust and efficient linear registration of fascicles in the
space of streamlines , Neuroimage, 117:124-140, 2015.
read_bvals_bvecs
-
dipy.data.fetcher.read_bvals_bvecs(fbvals, fbvecs)
Read b-values and b-vectors from disk.
- Parameters:
- fbvalsstr
Full path to file with b-values. None to not read bvals.
- fbvecsstr
Full path of file with b-vectors. None to not read bvecs.
- Returns:
- bvalsarray, (N,) or None
- bvecsarray, (N, 3) or None
Notes
Files can be either ‘.bvals’/’.bvecs’ or ‘.txt’ or ‘.npy’ (containing
arrays stored with the appropriate values).
read_cenir_multib
-
dipy.data.fetcher.read_cenir_multib(bvals=None)
Read CENIR multi b-value data.
- Parameters:
- bvalslist or int
The b-values to read from file (200, 400, 1000, 2000, 3000).
- Returns:
- gtaba GradientTable class instance
- imgnibabel.Nifti1Image
Notes
Details of the acquisition and processing, and additional meta-data are
available through UW researchworks:
https://digital.lib.washington.edu/researchworks/handle/1773/33311
read_cfin_dwi
-
dipy.data.fetcher.read_cfin_dwi()
Load CFIN multi b-value DWI data.
- Returns:
- imgobj,
Nifti1Image
- gtabobj,
GradientTable
read_cfin_t1
-
dipy.data.fetcher.read_cfin_t1()
Load CFIN T1-weighted data.
- Returns:
- imgobj,
Nifti1Image
read_five_af_bundles
-
dipy.data.fetcher.read_five_af_bundles()
Load 5 small left arcuate fasciculus bundles.
- Returns:
- bundles: list of ArraySequence
List with loaded bundles.
read_isbi2013_2shell
-
dipy.data.fetcher.read_isbi2013_2shell()
Load ISBI 2013 2-shell synthetic dataset.
- Returns:
- imgobj,
Nifti1Image
- gtabobj,
GradientTable
read_ivim
-
dipy.data.fetcher.read_ivim()
Load IVIM dataset.
- Returns:
- imgobj,
Nifti1Image
- gtabobj,
GradientTable
read_mni_template
-
dipy.data.fetcher.read_mni_template(version='a', contrast='T2')
Read the MNI template from disk.
- Parameters:
- version: string
There are two MNI templates 2009a and 2009c, so options available are:
“a” and “c”.
- contrastlist or string, optional
Which of the contrast templates to read. For version “a” two contrasts
are available: “T1” and “T2”. Similarly for version “c” there are two
options, “T1” and “mask”. You can input contrast as a string or a list
- Returns:
- listcontains the nibabel.Nifti1Image objects requested, according to the
order they were requested in the input.
Notes
The templates were downloaded from the MNI (McGill University)
website
in July 2015.
The following publications should be referenced when using these templates:
[1]
VS Fonov, AC Evans, K Botteron, CR Almli, RC McKinstry, DL Collins
and BDCG, Unbiased average age-appropriate atlases for pediatric
studies, NeuroImage, 54:1053-8119,
DOI: 10.1016/j.neuroimage.2010.07.033
[2]
VS Fonov, AC Evans, RC McKinstry, CR Almli and DL Collins,
Unbiased nonlinear average age-appropriate brain templates from
birth to adulthood, NeuroImage, 47:S102
Organization for Human Brain Mapping 2009 Annual Meeting,
DOI: https://doi.org/10.1016/S1053-8119(09)70884-5
License for the MNI templates:
Copyright (C) 1993-2004, Louis Collins McConnell Brain Imaging Centre,
Montreal Neurological Institute, McGill University. Permission to use,
copy, modify, and distribute this software and its documentation for any
purpose and without fee is hereby granted, provided that the above
copyright notice appear in all copies. The authors and McGill University
make no representations about the suitability of this software for any
purpose. It is provided “as is” without express or implied warranty. The
authors are not responsible for any data loss, equipment damage, property
loss, or injury to subjects or patients resulting from the use or misuse
of this software package.
Examples
>>> # Get only the T1 file for version c:
>>> T1 = read_mni_template("c", contrast = "T1")
>>> # Get both files in this order for version a:
>>> T1, T2 = read_mni_template(contrast = ["T1", "T2"])
read_qtdMRI_test_retest_2subjects
-
dipy.data.fetcher.read_qtdMRI_test_retest_2subjects()
Load test-retest qt-dMRI acquisitions of two C57Bl6 mice. These
datasets were used to study test-retest reproducibility of time-dependent
q-space indices (q:math:` au`-indices) in the corpus callosum of two mice [1].
The data itself and its details are publicly available and can be cited at
[2].
The test-retest diffusion MRI spin echo sequences were acquired from two
C57Bl6 wild-type mice on an 11.7 Tesla Bruker scanner. The test and retest
acquisition were taken 48 hours from each other. The (processed) data
consists of 80x160x5 voxels of size 110x110x500μm. Each data set consists
of 515 Diffusion-Weighted Images (DWIs) spread over 35 acquisition shells.
The shells are spread over 7 gradient strength shells with a maximum
gradient strength of 491 mT/m, 5 pulse separation shells between
[10.8 - 20.0]ms, and a pulse length of 5ms. We manually created a brain
mask and corrected the data from eddy currents and motion artifacts using
FSL’s eddy. A region of interest was then drawn in the middle slice in the
corpus callosum, where the tissue is reasonably coherent.
- Returns:
- datalist of length 4
contains the dwi datasets ordered as
(subject1_test, subject1_retest, subject2_test, subject2_retest)
- cc_maskslist of length 4
contains the corpus callosum masks ordered in the same order as data.
- gtabslist of length 4
contains the qt-dMRI gradient tables of the data sets.
References
[1]
Fick, Rutger HJ, et al. “Non-Parametric GraphNet-Regularized
Representation of dMRI in Space and Time”, Medical Image Analysis,
2017.
[2]
Wassermann, Demian, et al., “Test-Retest qt-dMRI datasets for
`Non-Parametric GraphNet-Regularized Representation of dMRI in Space
and Time’”. doi:10.5281/zenodo.996889, 2017.
read_qte_lte_pte
-
dipy.data.fetcher.read_qte_lte_pte()
Read q-space trajectory encoding data with linear and planar tensor
encoding.
- Returns:
- data_imgnibabel.nifti1.Nifti1Image
dMRI data image.
- mask_imgnibabel.nifti1.Nifti1Image
Brain mask image.
- gtabdipy.core.gradients.GradientTable
Gradient table.
read_scil_b0
-
dipy.data.fetcher.read_scil_b0()
Load GE 3T b0 image form the scil b0 dataset.
- Returns:
- imgobj,
Nifti1Image
read_sherbrooke_3shell
-
dipy.data.fetcher.read_sherbrooke_3shell()
Load Sherbrooke 3-shell HARDI dataset.
- Returns:
- imgobj,
Nifti1Image
- gtabobj,
GradientTable
read_siemens_scil_b0
-
dipy.data.fetcher.read_siemens_scil_b0()
Load Siemens 1.5T b0 image from the scil b0 dataset.
- Returns:
- imgobj,
Nifti1Image
read_stanford_hardi
-
dipy.data.fetcher.read_stanford_hardi()
Load Stanford HARDI dataset.
- Returns:
- imgobj,
Nifti1Image
- gtabobj,
GradientTable
read_stanford_labels
-
dipy.data.fetcher.read_stanford_labels()
Read stanford hardi data and label map.
read_stanford_pve_maps
-
dipy.data.fetcher.read_stanford_pve_maps()
read_stanford_t1
-
dipy.data.fetcher.read_stanford_t1()
read_syn_data
-
dipy.data.fetcher.read_syn_data()
Load t1 and b0 volumes from the same session.
- Returns:
- t1obj,
Nifti1Image
- b0obj,
Nifti1Image
read_taiwan_ntu_dsi
-
dipy.data.fetcher.read_taiwan_ntu_dsi()
Load Taiwan NTU dataset.
- Returns:
- imgobj,
Nifti1Image
- gtabobj,
GradientTable
read_tissue_data
-
dipy.data.fetcher.read_tissue_data(contrast='T1')
Load images to be used for tissue classification
- Parameters:
- constraststr
‘T1’, ‘T1 denoised’ or ‘Anisotropic Power’
- Returns:
- imageobj,
Nifti1Image
save_nifti
-
dipy.data.fetcher.save_nifti(fname, data, affine, hdr=None, dtype=None)
Save a data array into a nifti file.
- Parameters:
- fnamestr
The full path to the file to be saved.
- datandarray
The array with the data to save.
- affine4x4 array
The affine transform associated with the file.
- hdrnifti header, optional
May contain additional information to store in the file header.
- Returns:
- None
to_bids_description
-
dipy.data.fetcher.to_bids_description(path, fname='dataset_description.json', BIDSVersion='1.4.0', **kwargs)
Dumps a dict into a bids description at the given location
urlopen
-
dipy.data.fetcher.urlopen(url, data=None, timeout=<object object>, *, cafile=None, capath=None, cadefault=False, context=None)
Open the URL url, which can be either a string or a Request object.
data must be an object specifying additional data to be sent to
the server, or None if no such data is needed. See Request for
details.
urllib.request module uses HTTP/1.1 and includes a “Connection:close”
header in its HTTP requests.
The optional timeout parameter specifies a timeout in seconds for
blocking operations like the connection attempt (if not specified, the
global default timeout setting will be used). This only works for HTTP,
HTTPS and FTP connections.
If context is specified, it must be a ssl.SSLContext instance describing
the various SSL options. See HTTPSConnection for more details.
The optional cafile and capath parameters specify a set of trusted CA
certificates for HTTPS requests. cafile should point to a single file
containing a bundle of CA certificates, whereas capath should point to a
directory of hashed certificate files. More information can be found in
ssl.SSLContext.load_verify_locations().
The cadefault parameter is ignored.
This function always returns an object which can work as a
context manager and has the properties url, headers, and status.
See urllib.response.addinfourl for more detail on these properties.
For HTTP and HTTPS URLs, this function returns a http.client.HTTPResponse
object slightly modified. In addition to the three new methods above, the
msg attribute contains the same information as the reason attribute —
the reason phrase returned by the server — instead of the response
headers as it is specified in the documentation for HTTPResponse.
For FTP, file, and data URLs and requests explicitly handled by legacy
URLopener and FancyURLopener classes, this function returns a
urllib.response.addinfourl object.
Note that None may be returned if no handler handles the request (though
the default installed global OpenerDirector uses UnknownHandler to ensure
this never happens).
In addition, if proxy settings are detected (for example, when a *_proxy
environment variable like http_proxy is set), ProxyHandler is default
installed and makes sure the requests are handled through the proxy.