Skip to main content

Help pre-processing of DTI for use in Sim4Life

Project description

DTI Pre-Processing for Sim4Life

Build Actions Status License PyPI version

This Python package provides pre-processing functions to help Sim4Life users prepare diffusion tensor images (DTI) for use in low-frequency electro-magnetic simulations. The primary goal is to convert DTI into a format supported by Sim4Life, enabling the assignment of anisotropic inhomogeneous conductivity maps in tissue models.

Features

  • Align diffusion weighted images (DWI) to structural images, e.g. T1-weighted MRI (using SimpleITK)
  • Noise removal for DWI (using dipy)
  • DTI reconstruction from DWI (using dipy)
  • Save DTI in Sim4Life compatible ordering (XX, YY, ZZ, XY, YZ, ZX) (see reconstruct.py)
  • Example data is automatically downloaded

Installation

pip install s4l-dti

or

pip install git+https://github.com/dyollb/s4l-dti.git#egg=s4l-dti

Usage

Download IXI025 head dataset:

from s4l_dti.data import download_ixi_025

download_dir = Path.home() / "Models" / "IXI025"
download_files = download_ixi_025(download_dir)

for key in download_files:
    print(f"Downloaded {key}: {download_files[key].relative_to(download_dir)}")

Reconstruction and saving as Sim4Life compatible Nifti file:

from s4l_dti.reconstruct import reconstruct_dti

dwi_image_file = download_files["dwi"]
bvec_file = download_files["bvec"]
bval_file = download_files["bval"]
mask_file = download_files["labels"]
s4l_dti_file = download_dir / "DTI-s4l.nii.gz"

reconstruct_dti(
    img_file=dwi_aligned_denoised_image_file,
    bvec_file=bvec_file,
    bval_file=bval_file,
    mask_file=mask_file
    s4l_dti_file=s4l_dti_file,
)

For more examples, see the Jupyter notebook.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

s4l_dti-1.1.0.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

s4l_dti-1.1.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file s4l_dti-1.1.0.tar.gz.

File metadata

  • Download URL: s4l_dti-1.1.0.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for s4l_dti-1.1.0.tar.gz
Algorithm Hash digest
SHA256 4f9a52ddf6aa40c4c75c54ed5fdfa70ca4ea0d587cbeed3019aee741e87c5748
MD5 1dc8ad6cbc82780b09eff3ad84b160b9
BLAKE2b-256 873f83d65f1561cfbab02389ef0ef4c49b0327952cd46d8a32fd50e634e44f5f

See more details on using hashes here.

File details

Details for the file s4l_dti-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: s4l_dti-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for s4l_dti-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d4e9e73af4b43473c5398f79abb2f5e7815b5b2b6846bf29e5ab7e9a18b42db2
MD5 4943842e913509ea4eb4463028de2a8a
BLAKE2b-256 b1a3a9fc34a1e61184cfb6b662050a2aba47d9d94c37c01a8e1280ee1961dda9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page