eddymotion.testing.simulations module¶
Utilities for testing purposes.
- eddymotion.testing.simulations.add_b0(bvals: ndarray, bvecs: ndarray) tuple[ndarray, ndarray] [source]¶
Insert a b=0 at the front of the gradient table (b-values and b-vectors).
- eddymotion.testing.simulations.create_diffusion_encoding_gradient_dirs(hsph_dirs: int, iterations: int = 5000, seed: int = 1234) dipy.core.sphere.Sphere [source]¶
Create the dMRI gradient-encoding directions.
- eddymotion.testing.simulations.create_random_diffusivity_eigenvalues(size, rng)[source]¶
Create DTI model diffusion tensor eigenvalues ($lambda_{1}, lambda_{2}, lambda_{3}$) drawn from a uniform distribution.
- eddymotion.testing.simulations.create_random_polar_angles(size, rng)[source]¶
Create polar angles drawn from a uniform distribution.
- eddymotion.testing.simulations.create_random_polar_coordinates(hsph_dirs: int, seed: int = 1234) tuple[ndarray, ndarray] [source]¶
Create random polar coordinates.
- eddymotion.testing.simulations.create_single_fiber_evecs(theta: float = 0, phi: float = 0) ndarray [source]¶
Create eigenvectors for a simulated fiber given the polar coordinates of its pricipal axis.
- eddymotion.testing.simulations.create_single_shell_gradient_table(hsph_dirs: int, bval_shell: float, iterations: int = 5000) dipy.core.gradients.gradient_table [source]¶
Create a single-shell gradient table.
- Parameters:
- Returns:
The gradient table for the single-shell.
- Return type:
- eddymotion.testing.simulations.create_three_fiber_random_volume_fractions(size, rng)[source]¶
Create fiber volume fractions drawn from a uniform distribution for a three-fiber configuration.
- eddymotion.testing.simulations.create_two_fiber_dominant_random_volume_fractions(size, rng)[source]¶
Create fiber volume fractions drawn from a uniform distribution for a two-fiber configuration with a dominant fiber.
- eddymotion.testing.simulations.create_two_fiber_nondominant_random_volume_fractions(size, rng)[source]¶
Create fiber volume fractions drawn from a uniform distribution for a two-fiber configuration with non-dominant fibers.
- eddymotion.testing.simulations.get_query_vectors(gtab: dipy.core.gradients.gradient_table, train_mask: ndarray) tuple[ndarray, ndarray] [source]¶
Get the diffusion-encoding gradient vectors for estimation from the gradient table.
Get the diffusion-encoding gradient vectors where the signal is to be estimated from the gradient table and the training mask: the vectors of interest are those that are masked in the training mask. b0 values are excluded.
- Parameters:
gtab (
gradient_table
) – Gradient table.train_mask (
ndarray
) – Mask for selecting training vectors.
- Returns:
Gradient vectors and indices for estimation.
- Return type:
- eddymotion.testing.simulations.serialize_dmri(dwi_data, gtab, dwi_data_fname, bval_data_fname, bvec_data_fname, affine: ndarray | None = None)[source]¶
Serialize dMRI data.
- Parameters:
dwi_data (
ndarray
) – DWI data.gtab (
gradient_table
) – Gradient table.dwi_data_fname (
str
) – Filename of NIfTI file to save the DWI signal.bval_data_fname (
str
) – Filename of NIfTI file to save the diffusion-encoding gradient b-vals.bvec_data_fname (
str
) – Filename of NIfTI file to save the diffusion-encoding gradient b-vecs.affine (
ndarray
, optional) – Affine matrix. IfNone
an identity affine matrix is used.
- eddymotion.testing.simulations.serialize_dwi(dwi_data, dwi_data_fname, affine: ndarray | None = None)[source]¶
Serialize DWI data.
- eddymotion.testing.simulations.serialize_gtab(gtab, bval_data_fname, bvec_data_fname)[source]¶
Serialize dMRI gradient-encoding table data into a pair of b-vals and b-vecs files.
- Parameters:
gtab (
gradient_table
) – Gradient table.bval_data_fname (
str
) – Filename of NIfTI file to save the diffusion-encoding gradient b-vals.bvec_data_fname (
str
) – Filename of NIfTI file to save the diffusion-encoding gradient b-vecs.
- eddymotion.testing.simulations.simulate_multifiber_voxels(S0, hsph_dirs, bval_shell=1000, snr=20, n_voxels=1, seed=None)[source]¶
Create a DWI signal with multiple tensors.
- eddymotion.testing.simulations.simulate_one_fiber_multivoxel(gtab, S0, snr, n_voxels, rng, evals=None)[source]¶
Create a single-fiber multi-voxel DWI signal.
- eddymotion.testing.simulations.simulate_three_fiber_multivoxel(gtab, S0, snr, n_voxels, rng)[source]¶
Create three-fiber multi-voxel DWI signal.
- eddymotion.testing.simulations.simulate_two_fiber_multivoxel(gtab, S0, snr, n_voxels, rng, dominant)[source]¶
Create two-fiber multi-voxel DWI signal.