Help pre-processing of DTI for use in Sim4Life
Project description
DTI Pre-Processing for Sim4Life
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
Release history Release notifications | RSS feed
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.0.0.tar.gz
(12.0 kB
view details)
Built Distribution
s4l_dti-1.0.0-py3-none-any.whl
(12.4 kB
view details)
File details
Details for the file s4l_dti-1.0.0.tar.gz
.
File metadata
- Download URL: s4l_dti-1.0.0.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aba2361db0d81cf4fb6d46f5bd4c8ee9adb96a71af5172182c2f0d2757821b1e |
|
MD5 | d626346c43c83dc0da4681ebb618e869 |
|
BLAKE2b-256 | 246e931e892d31b5776456d3f405e7e4842c6310c3c2670cf6aaeb3e08952ad1 |
File details
Details for the file s4l_dti-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: s4l_dti-1.0.0-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84ac231b9021580535777217d1ef3ec69767eba5079060dbec9cfc497f99c0d7 |
|
MD5 | 849b6d92eff9f8b914c4b6ab1a383cae |
|
BLAKE2b-256 | 50bbda68ea4b432d37d6a877b5e198b9a30c9554f6ec9897224f30fd2b949328 |