{"id":23542,"library":"dipy","title":"DIPY","description":"DIPY is a Python library for diffusion MRI analysis, featuring tractography, reconstruction, registration, and signal processing. Current version is 1.12.1. It has a moderate release cadence with major versions every 1-2 years.","status":"active","version":"1.12.1","language":"python","source_language":"en","source_url":"https://github.com/dipy/dipy","tags":["diffusion mri","tractography","neuroimaging","dti","medical imaging"],"install":[{"cmd":"pip install dipy","lang":"bash","label":"PyPI"},{"cmd":"conda install -c conda-forge dipy","lang":"bash","label":"Conda"}],"dependencies":[{"reason":"Core array operations","package":"numpy","optional":false},{"reason":"Scientific computing","package":"scipy","optional":false},{"reason":"Neuroimaging file I/O","package":"nibabel","optional":false}],"imports":[{"note":"Top-level import works, but specific submodules must be imported explicitly (e.g., from dipy.io import read_bvals_bvecs)","wrong":"","symbol":"dipy","correct":"import dipy"},{"note":"gradient_table is in core.gradients","wrong":"from dipy.io.gradients import read_bvals_bvecs (not for creating gtab)","symbol":"gtab","correct":"from dipy.core.gradients import gradient_table"}],"quickstart":{"code":"import numpy as np\nfrom dipy.io import read_bvals_bvecs\nfrom dipy.core.gradients import gradient_table\nfrom dipy.reconst.dti import TensorModel\n# Load data (example: replace with own files)\n# data = nib.load('dwi.nii.gz').get_fdata()\n# bvals, bvecs = read_bvals_bvecs('bvals.txt', 'bvecs.txt')\n# gtab = gradient_table(bvals, bvecs)\n# tenmodel = TensorModel(gtab)\n# tenfit = tenmodel.fit(data)\n# fa = tenfit.fa\nprint('DIPY DTI example ready')","lang":"python","description":"Minimal DTI tensor fitting example. Replace file paths with actual data."},"warnings":[{"fix":"Update imports: e.g., from dipy.reconst.dti import TensorModel instead of dipy.dti.TensorModel.","message":"DIPY 1.0.0 dropped support for Python 2 and changed many submodule paths. Some previously top-level functions moved to submodules.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Use `nib.load()` directly instead of `dipy.data.get_data()`.","message":"The `dipy.data` module contains some deprecated fetchers. Prefer using `nibabel` to load data.","severity":"deprecated","affected_versions":"<1.10.0"},{"fix":"Ensure bvals are numeric, bvecs are normalized, and use correct order: gradient_table(bvals, bvecs, b0_threshold=50).","message":"gradient_table expects b-values in s/mm² and b-vectors as (N,3) array. Mixing units or shapes causes silent errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Check seed mask is binary and in same space as data. Use dipy.tracking.utils seeds_from_mask.","message":"DIPY's tractography algorithms (e.g., EuDX) require specific input formats. Incorrect seed masks can lead to empty streamlines.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use from dipy.reconst.dti import TensorModel instead.","cause":"Import path changed after DIPY 1.0.0; old top-level submodules no longer exist.","error":"ModuleNotFoundError: No module named 'dipy.dti'"},{"fix":"Try from dipy.data import get_data or import dipy.data as dpd.","cause":"dipy.data is not automatically imported; need to import explicitly.","error":"AttributeError: module 'dipy' has no attribute 'data'"},{"fix":"Read both files with read_bvals_bvecs and verify shapes. Ensure they correspond to the same DW images.","cause":"bvals and bvecs files have mismatched lengths or are not aligned properly.","error":"ValueError: bvals and bvecs must have same number of volumes"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}