Skip to content

Instantly share code, notes, and snippets.

View arokem's full-sized avatar
🎯
Focusing

Ariel Rokem arokem

🎯
Focusing
View GitHub Profile
% t_meshAddFunctionalData
%
% Script (tutorial) to create, edit, add a functional overlay to, and
% visualize a mesh.
%
% See also T_MESHCREATE, T_MESHEDIT, T_MESHSHOWCONTRAST
%
% Stanford VISTA
%
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Set the prompt to show the current git branch:
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "("${ref#refs/heads/}")"
}
PS1="\h:\W$RED \$(parse_git_branch)$NO_COLOR $"
#!/usr/bin/env python
import argparse as arg
import numpy as np
import nibabel as nib
import dipy.tracking.life as life
import dipy.core.gradients as grad
from dipy.tracking import utils
@arokem
arokem / gist:1a2bb0dfce36bf401f77
Created November 10, 2014 18:56
pymatbridge-loadext-kwargs
{"metadata": {"signature": "sha256:61f13b9db7527e0d20129ae009d4f7a4b53d2291a71c053b2e8f4e2c415acdb8", "language_info": {"mimetype": "text/x-python", "pygments_lexer": "ipython3", "name": "python", "codemirror_mode": {"version": 3, "name": "ipython"}}}, "nbformat": 4, "cells": [{"metadata": {"trusted": true, "collapsed": false}, "outputs": [{"text": "/Users/arokem/anaconda/lib/python3.4/site-packages/IPython/nbformat/current.py:19: UserWarning: IPython.nbformat.current is deprecated.\n\n- use IPython.nbformat for read/write/validate public API\n- use IPython.nbformat.vX directly to composing notebooks of a particular version\n\n \"\"\")\n", "output_type": "stream", "name": "stderr"}], "execution_count": 1, "cell_type": "code", "source": "import pymatbridge as pymat"}, {"metadata": {"trusted": true, "collapsed": false}, "outputs": [{"text": "Starting MATLAB on ZMQ socket ipc:///tmp/pymatbridge\nSend 'exit' command to kill the server\n.MATLAB started and connected!\n", "output_type": "stream", "name": "stdout"}
@arokem
arokem / gist:46040963eea7d8db3d76
Created November 10, 2014 18:56
pymatbridge-loadext-kwargs
{"metadata": {"signature": "sha256:61f13b9db7527e0d20129ae009d4f7a4b53d2291a71c053b2e8f4e2c415acdb8", "language_info": {"mimetype": "text/x-python", "pygments_lexer": "ipython3", "name": "python", "codemirror_mode": {"version": 3, "name": "ipython"}}}, "nbformat": 4, "cells": [{"metadata": {"trusted": true, "collapsed": false}, "outputs": [{"text": "/Users/arokem/anaconda/lib/python3.4/site-packages/IPython/nbformat/current.py:19: UserWarning: IPython.nbformat.current is deprecated.\n\n- use IPython.nbformat for read/write/validate public API\n- use IPython.nbformat.vX directly to composing notebooks of a particular version\n\n \"\"\")\n", "output_type": "stream", "name": "stderr"}], "execution_count": 1, "cell_type": "code", "source": "import pymatbridge as pymat"}, {"metadata": {"trusted": true, "collapsed": false}, "outputs": [{"text": "Starting MATLAB on ZMQ socket ipc:///tmp/pymatbridge\nSend 'exit' command to kill the server\n.MATLAB started and connected!\n", "output_type": "stream", "name": "stdout"}
@arokem
arokem / gist:d87bafe421075e1fcf27
Created November 11, 2014 04:39
Comparison of matlab and python implementation of LiFE
{"nbformat_minor": 0, "cells": [{"source": "## Comparison of the Python implementation of LiFE with the Matlab implementation\n\nIn this notebook, I compare a solution to the LiFE equations computed using the Matlab implementation, to the recent implementation proposed in `dipy`. I use the pymatbridge to run it all in this one notebook, and to pass the matlab solution back to python for the comparison. \n\nI start by initializing the Matlab extension:", "cell_type": "markdown", "metadata": {}}, {"execution_count": 1, "cell_type": "code", "source": "%load_ext pymatbridge", "outputs": [{"output_type": "stream", "name": "stdout", "text": "Starting MATLAB on ZMQ socket ipc:///tmp/pymatbridge\nSend 'exit' command to kill the server\n.MATLAB started and connected!\n"}, {"output_type": "stream", "name": "stderr", "text": "/Users/arokem/anaconda/envs/py2/lib/python2.7/site-packages/IPython/nbformat/current.py:19: UserWarning: IPython.nbformat.current is deprecated.\n\n- use IPython.nbformat for read/write/validate pu
{"nbformat_minor": 0, "cells": [{"execution_count": 1, "cell_type": "code", "source": "import numpy as np\nimport matplotlib \nimport matplotlib.pyplot as plt\n%matplotlib inline\nimport seaborn as sns\nsns.set()", "outputs": [], "metadata": {"collapsed": true, "trusted": true}}, {"execution_count": 1, "cell_type": "code", "source": "", "outputs": [], "metadata": {"collapsed": true, "trusted": true}}, {"execution_count": 2, "cell_type": "code", "source": "X, Y = np.mgrid[0:6*np.pi:2*np.pi/128, 0:6*np.pi:2*np.pi/128]", "outputs": [], "metadata": {"collapsed": false, "trusted": true}}, {"execution_count": 3, "cell_type": "code", "source": "stim = np.sin(Y-np.pi/2) + np.sin(3*Y-np.pi/2)\nplt.matshow(stim)\nplt.grid('off')", "outputs": [{"output_type": "display_data", "data": {"image/png": "iVBORw0KGgoAAAANSUhEUgAAAVgAAAFRCAYAAAAxY7WIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAEztJREFUeJzt3V+InPd56PHvanc1+0e7SxwSCYNJLooffONi+zg5+NhR\nDG5cl4BKbnqRGmJa6/hgjA0N5kQJDgfUOtBjlwjsXkhNRUpowcJuGhunDgQiRxcRpqYH4/
import numpy as np
import dipy.core.sphere as sp
my_sphere = sp.Sphere(xyz = np.array(
[[0.052540681219917368, -0.99861878453038677, 6.123233995736766e-17],
[-0.067056485554906814, -0.9958563535911602, 0.061429233733969225],
[0.010256964268704974, -0.99309392265193375, -0.1168728175230903],
[0.08440329258809208, -0.99033149171270707, 0.11008914897651439],
[-0.15478289702739609, -0.98756906077348072, -0.027378915076963647],
[0.14652194384137213, -0.98480662983425415, -0.093205267058488389],
import numpy as np
import dipy.core.sphere as sp
my_sphere = sp.Sphere(xyz = np.array(
[[0.052540681219917368, -0.99861878453038677, 6.123233995736766e-17],
[-0.067056485554906814, -0.9958563535911602, 0.061429233733969225],
[0.010256964268704974, -0.99309392265193375, -0.1168728175230903],
[0.08440329258809208, -0.99033149171270707, 0.11008914897651439],
[-0.15478289702739609, -0.98756906077348072, -0.027378915076963647],
[0.14652194384137213, -0.98480662983425415, -0.093205267058488389],