Skip to content

Instantly share code, notes, and snippets.

View Garyfallidis's full-sized avatar

Eleftherios Garyfallidis Garyfallidis

View GitHub Profile
@Garyfallidis
Garyfallidis / motion_correct.py
Created December 18, 2019 14:49
motion correction for dwi
"""
==========================================
Motion correction of DWI data
==========================================
"""
import numpy as np
from dipy.viz import regtools
from dipy.data import fetch_stanford_hardi, read_stanford_hardi
from dipy.data.fetcher import fetch_syn_data, read_syn_data
@Garyfallidis
Garyfallidis / whole_brain_slr.py
Last active October 16, 2017 02:34
Whole brain registration with SLR
dname = 'C:\\Users\\elef\\Data\\rodrigo\\'
fname1 = dname + 'ADRC_TMP_wholeBrain.trk.gz'
fname2 = dname + 'IIT2mean.trk'
from nibabel.streamlines import load
@Garyfallidis
Garyfallidis / cool_phantom.py
Created September 14, 2017 19:11
Create simple phantom with dipy.sims module
# -*- coding: utf-8 -*-
from __future__ import division
import numpy as np
from numpy.testing import (assert_, assert_equal, assert_array_equal,
assert_array_almost_equal, assert_almost_equal,
run_module_suite)
@Garyfallidis
Garyfallidis / qb_points.py
Created September 14, 2017 19:09
Cluster points using QuickBundles
# -*- coding: utf-8 -*-
import numpy as np
from dipy.segment.clustering import QuickBundles
from dipy.segment.metric import IdentityFeature, Feature
from dipy.segment.metric import AveragePointwiseEuclideanMetric, EuclideanMetric, SumPointwiseEuclideanMetric
#data = np.random.rand(10, 3)
data = [np.random.rand(1, 3),
@Garyfallidis
Garyfallidis / show_volume.py
Created September 10, 2017 22:54
Interactive volume slicer using DIPY
import sys
import numpy as np
from dipy.viz import actor, window, ui
from dipy.io.image import load_nifti
if __name__ == '__main__':
#data, affine = load_nifti('resliced.nii.gz')
@Garyfallidis
Garyfallidis / correct_boekel_dwi.py
Last active September 10, 2017 21:03
Correct Boekel et al. public datasets
# Correct Boekel et. al public datasets
# The last b-vector is invalid as the norm is 0 when it should be 1.
# https://www.nitrc.org/projects/dwi_test-retest/
#
# Run this using
# python correct_boekel_dwi.py pp01_dwi_run01_A.nii.gz bvals bvecs
import os
import sys