-
-
Save mwaskom/483927 to your computer and use it in GitHub Desktop.
This file contains 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
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() |
This file contains 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
subject_list = ['SAD_P07'] #using single subject as demo, just add all subjects to the list | |
node = pe.Node(interface=utils.IdentityInterface(fields=['subject_id']), name='subjectid') | |
node.iterables = ('subject_id', subject_list) | |
volsource = pe.Node(interface = nio.DataGrabber(infields=['subject_id'], 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/%s/%s_warp.nii.gz" | |
volsource.inputs.template_args = dict(dw_imgs=[['subject_id', ["fa", "ra", "adc"]]]) | |
workflow = pe.Workflow(name='getdata') | |
workflow.connect(node, 'subject_id', volsource, 'subject_id') | |
workflow.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment