Skip to content

weekmo/Tractography

Repository files navigation

Tractograpy

It is a module deals with Brain Bundles

License: GPL v3

It includes functions to read/write, visualise and register bundles

"It's always preferred to use source code!"

Installation:

Easy to install by downloading install.sh and run it:

On Linux

./install.sh

On widows by using bash

bash install.sh 

By pip

pip install tractography

By conda

conda install -c weekmo tractography

Example 1:

Register two bundles

from tractography.io import read_ply,write_trk
from tractography.registration import register
from tractography.viz import draw_bundles

# Read bundles
data1 = read_ply('target.ply')
data2 = read_ply('subject.ply')

# Register bundle
aligned_bundle,mat = register(target=data1, subject=data2)

# Write to trk file
write_trk("aligned_bundle.trk", aligned_bundle)

# Export images before and after registration
draw_bundles([data1,data2])
draw_bundles([data1,aligned_bundle])

Example 2:

Show all bundles in a folder

from tractography.viz import draw_bundles
from os import listdir
from os.path import isfile
from tractography.io import read_ply
import argparse

parser = argparse.ArgumentParser(description='Input argument parser.')
parser.add_argument('-f', type=str, help='location of files')
args = parser.parse_args()
# data_path = 'data/'
data_path = args.f
files = [data_path + f for f in listdir(data_path) if isfile(data_path + f) and f.endswith('.ply')]

brain = []
for name in files:
    brain.append(read_ply(name))
draw_bundles(brain)

Enjoy

About

Direct Bundle Registration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published