Skip to content

Instantly share code, notes, and snippets.

@satra
Created August 31, 2010 03:20
Show Gist options
  • Select an option

  • Save satra/558490 to your computer and use it in GitHub Desktop.

Select an option

Save satra/558490 to your computer and use it in GitHub Desktop.
import os
import numpy as np
from nipype.interfaces.spm import *
import nipype.interfaces.matlab as mlab # how to run matlab
mlab.MatlabCommand.set_default_matlab_cmd("matlab -nodesktop -nosplash")
mlab.MatlabCommand.set_default_paths('/software/spm8')
func = os.path.abspath('../testdata/testfunc.nii')
meanfunc = os.path.abspath('../testdata/meantestfunc.nii')
struct = os.path.abspath('../testdata/struct.nii')
print 'testing slicetiming'
res1 = SliceTiming(in_files=func,
num_slices=35,
slice_order = range(1,36),
ref_slice=1,
time_repetition=3.,
time_acquisition=3.-3./35.).run()
assert(res1.runtime.returncode == 0)
print 'testing realign'
res2 = Realign(in_files=func).run()
assert(res2.runtime.returncode == 0)
print 'testing smooth'
res3 = Smooth(in_files=func).run()
assert(res3.runtime.returncode == 0)
print 'testing coregister'
res4 = Coregister(target=struct,source=meanfunc,apply_to_files=func).run()
assert(res4.runtime.returncode == 0)
print 'testing normalize'
res5 = Normalize(template='/software/spm8/templates/T1.nii',
source=struct).run()
assert(res5.runtime.returncode == 0)
print 'testing segment'
res6 = Segment(data=struct).run()
assert(res6.runtime.returncode == 0)
print 'testing new segment'
res7 = NewSegment(channel_files=struct).run()
assert(res7.runtime.returncode == 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment