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.2.0.tar.gz (16.3 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.2.0-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: s4l_dti-1.2.0.tar.gz
  • Upload date:
  • Size: 16.3 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.2.0.tar.gz
Algorithm Hash digest
SHA256 75b0fca740e34fa5b9d0b57ae76a04d7590ed12311150bd7193a66f5193727be
MD5 0ae6a93a6ab39d098d0a33e71df66abc
BLAKE2b-256 0dc06c951441124d921682afb9095a4c14f74bfaa0a8ca2a243923862c7739e6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: s4l_dti-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 15.5 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2d992ecf1efd4b381d323e7531c800eb8ea151103497968b77281bdbde44f92
MD5 04444f57bbcfd093ce3e232bd06f6a05
BLAKE2b-256 8734f63ad3bbe54d518d1b723d0062500e638a956e09d126acb3bbb77376a599

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