Created
June 19, 2012 22:01
-
-
Save RanjitK/2956792 to your computer and use it in GitHub Desktop.
Example Sphynx Documentation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/Library/Frameworks/EPD64.framework/Versions/Current/bin/python | |
import sys | |
import e_afni | |
import os | |
import commands | |
import nipype.pipeline.engine as pe | |
import nipype.algorithms.rapidart as ra | |
import nipype.interfaces.afni as afni | |
import nipype.interfaces.fsl as fsl | |
import nipype.interfaces.io as nio | |
import nipype.interfaces.utility as util | |
def create_anat_preproc(): | |
""" | |
Preprocessing of Anatomical(T1) Image | |
Inputs :: | |
inputspec.anat : anatomical runs ( filename or list of filenames) | |
Outputs :: | |
outputspec.refit : Deobliqued files | |
outputspec.reorient : RPI oriented files | |
outputspec.skullstrip : Skull Stripped RPI files | |
outputspec.brain : Whole-Brain only mask files | |
Example | |
------- | |
>>> prproc = create_anat_preproc() | |
>>> preproc.inputs.inputspec.func=['sub1/rest_1/rest.nii.gz','sub2/rest_1/rest.nii.gz'] | |
>>> preporc.run() #doctest: +SKIP | |
""" | |
preproc = pe.Workflow(name='anatpreproc') | |
inputNode = pe.Node(util.IdentityInterface(fields=['anat']), | |
name='inputspec') | |
outputNode = pe.Node(util.IdentityInterface(fields=['refit', | |
'reorient', | |
'skullstrip', | |
'brain']), | |
name='outputspec') | |
anat_refit = pe.Node(interface=e_afni.Threedrefit(), | |
name='anat_refit') | |
anat_refit.inputs.deoblique = True | |
anat_reorient = pe.Node(interface=afni.Resample(), | |
name='anat_reorient') | |
anat_reorient.inputs.orientation = 'RPI' | |
anat_skullstrip = pe.Node(interface=afni.SkullStrip(), | |
name='anat_skullstrip') | |
anat_skullstrip.inputs.options = '-o_ply' | |
anat_calc = pe.Node(interface=e_afni.Threedcalc(), | |
name='anat_calc') | |
anat_calc.inputs.expr = '\'a*step(b)\'' | |
preproc.connect(inputNode, 'anat', | |
anat_refit, 'in_file') | |
preproc.connect(anat_refit, 'out_file', | |
anat_reorient, 'in_file') | |
preproc.connect(anat_reorient, 'out_file', | |
anat_skullstrip, 'in_file') | |
preproc.connect(anat_skullstrip, 'out_file', | |
anat_calc, 'infile_b') | |
preproc.connect(anat_reorient, 'out_file', | |
anat_calc, 'infile_a') | |
preproc.connect(anat_refit, 'out_file', | |
outputNode, 'refit') | |
preproc.connect(anat_reorient, 'out_file', | |
outputNode, 'reorient') | |
preproc.connect(anat_skullstrip, 'out_file', | |
outputNode, 'skullstrip') | |
preproc.connect(anat_calc, 'out_file', | |
outputNode, 'brain') | |
return preproc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment