Skip to content

Python package to interface with MRtrix3 file formats.

Notifications You must be signed in to change notification settings

maxpietsch/mrtrix3-pyio

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

mrtrix3-pyio

This repository provides a Python package to interface with MRtrix3 file formats.

Installation

You can clone and pip-install the code with:

git clone https://github.com/dchristiaens/mrtrix3-pyio.git
cd mrtrix3-pyio
pip install .

Example use

Basic use:

>>> from mrtrix3.io import load_mrtrix
>>> im = load_mrtrix('dwi.mif')      # read an image from file
>>> print(im.shape); print(im.vox)   # access propoperties
(96, 96, 50, 65)
(2.5, 2.5, 2.5, nan)
>>> im.data *= 2            # access and edit the image data as a numpy array
>>> im.save('dwi_x2.mif')   # save the result to a new file

You can also do neat little things like:

>>> mask = load_mrtrix('mask.mif')
>>> for vox, m in zip(im, mask):
>>>     if m:
>>>        process_voxel(vox)

About

Python package to interface with MRtrix3 file formats.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%