Skip to content

Instantly share code, notes, and snippets.

import nipype.interfaces.io as nio
import nipype.pipeline.engine as pe
volsource = pe.Node(interface = nio.DataGrabber(outfields=["dw_imgs"]), name="volsource")
project_dir = "/mindhive/gablab/sad/PY_STUDY_DIR/Block"
volsource.inputs.base_directory = project_dir
volsource.inputs.template = "diffusion/preproc/SAD_*/%s_warp.nii.gz"
volsource.base_dir = '.'
volsource.inputs.template_args = dict(dw_imgs=[[["fa", "ra", "adc"]]])
res = volsource.run()
# vi: set ft=python sts=4 ts=4 sw=4 et:
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
"""
Nipype interface script for the Fluid Intelligence project.
"""
import os
import sys
import argparse
from copy import deepcopy
@mwaskom
mwaskom / fsl_tbss.py
Created January 25, 2011 20:42
Standard TBSS implementation in Nipype
#! /usr/bin/env python
import os
from os.path import join as pjoin
import argparse
import nipype.interfaces.fsl as fsl
import nipype.interfaces.io as nio
import nipype.interfaces.utility as util
import nipype.pipeline.engine as pe
import nibabel as nib
@mwaskom
mwaskom / nipy_hrf.py
Created July 9, 2012 19:43
Confusion about NIPY hrf
import numpy as np
from scipy.stats import gamma
def gamma_params(peak, fwhm):
"""Return parameters to scipy.stats.gamma corresponding for an HRF shape.
This was mostly copied from nipy.
Parameters
----------
@mwaskom
mwaskom / fisher.ipynb
Created August 31, 2012 16:59
fisher transform example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mwaskom
mwaskom / mrTutMR
Created September 15, 2012 22:39
First MR Tutorial
{
"metadata": {
"name": "mrTutMR"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@mwaskom
mwaskom / lmer_foo.ipynb
Created September 27, 2012 05:02
Playing with lmer in ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mwaskom
mwaskom / better_coreg.ipynb
Created December 25, 2012 03:57
Pure Python coregistration reporting
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mwaskom
mwaskom / moin.java
Created June 5, 2013 05:02
Pipe is long
long pipe;
@mwaskom
mwaskom / ian_examply.py
Created July 26, 2013 21:58
Simple example of some array manipulations
# from <module> import * is strongly discouraged
import numpy as np
# One way to make your array that shows off a few features
# Specifying it like you did is fine, but why bother?
a = np.arange(1, 7)
a[1::2] *= -1
# Again, just demonstrating some features
choice = np.array([np.ones(6),