コード例 #1
0
ファイル: core.py プロジェクト: poldracklab/mriqc
def ms_anat(settings=None, subject_id=None, session_id=None, run_id=None):
    """ Multi-subject anatomical workflow wrapper """
    # Run single subject mode if only one subject id is provided
    if subject_id is not None and isinstance(subject_id, string_types):
        subject_id = [subject_id]

    sub_list = gather_bids_data(settings['bids_dir'],
                                subject_inclusion=subject_id,
                                include_types=['anat'])

    if session_id is not None:
        sub_list = [s for s in sub_list if s[1] == session_id]
    if run_id is not None:
        sub_list = [s for s in sub_list if s[2] == run_id]

    if not sub_list:
        return None

    inputnode = pe.Node(niu.IdentityInterface(fields=['data']),
                        name='inputnode')
    inputnode.iterables = [('data', [list(s) for s in sub_list])]
    anat_qc = anat_qc_workflow(settings=settings)
    anat_qc.inputs.inputnode.bids_dir = settings['bids_dir']

    dsplit = pe.Node(niu.Split(splits=[1, 1, 1], squeeze=True),
                     name='datasplit')
    workflow = pe.Workflow(name='anatMRIQC')
    workflow.connect([
        (inputnode, dsplit, [('data', 'inlist')]),
        (dsplit, anat_qc, [('out1', 'inputnode.subject_id'),
                           ('out2', 'inputnode.session_id'),
                           ('out3', 'inputnode.run_id')])
    ])

    return workflow
コード例 #2
0
def build_workflow(dataset, mod, settings=None):
    """ Multi-subject anatomical workflow wrapper """

    if mod == 'bold':
        workflow = fmri_qc_workflow(dataset, settings=settings)
    elif mod == 'T1w':
        workflow = anat_qc_workflow(dataset, mod='T1w', settings=settings)
    elif mod == 'T2w':
        workflow = anat_qc_workflow(dataset, mod='T2w', settings=settings)
    else:
        raise NotImplementedError('Unknown workflow type "%s"' % mod)

    workflow.base_dir = settings['work_dir']
    if settings.get('write_graph', False):
        workflow.write_graph()
    return workflow
コード例 #3
0
def ms_anat(settings=None, subject_id=None, session_id=None, run_id=None):
    """ Multi-subject anatomical workflow wrapper """
    # Run single subject mode if only one subject id is provided
    if subject_id is not None and isinstance(subject_id, string_types):
        subject_id = [subject_id]

    sub_list = gather_bids_data(settings['bids_root'],
                                subject_inclusion=subject_id,
                                include_types=['anat'])

    if session_id is not None:
        sub_list = [s for s in sub_list if s[1] == session_id]
    if run_id is not None:
        sub_list = [s for s in sub_list if s[2] == run_id]

    if not sub_list:
        return None

    inputnode = pe.Node(niu.IdentityInterface(fields=['data']),
                        name='inputnode')
    inputnode.iterables = [('data', [list(s) for s in sub_list])]
    anat_qc = anat_qc_workflow(settings=settings)
    anat_qc.inputs.inputnode.bids_root = settings['bids_root']

    dsplit = pe.Node(niu.Split(splits=[1, 1, 1], squeeze=True),
                     name='datasplit')
    workflow = pe.Workflow(name='anatMRIQC')
    workflow.connect([
        (inputnode, dsplit, [('data', 'inlist')]),
        (dsplit, anat_qc, [('out1', 'inputnode.subject_id'),
                           ('out2', 'inputnode.session_id'),
                           ('out3', 'inputnode.run_id')])
    ])

    return workflow
コード例 #4
0
ファイル: core.py プロジェクト: xwolfs/mriqc
def build_workflow(dataset, qctype, settings=None):
    """ Multi-subject anatomical workflow wrapper """

    if qctype.startswith('func'):
        workflow = fmri_qc_workflow(dataset, settings=settings)
    elif qctype.startswith('anat'):
        workflow = anat_qc_workflow(dataset, settings=settings)
    else:
        raise NotImplementedError('Unknown workflow type "%s"' % qctype)

    workflow.base_dir = settings['work_dir']
    if settings.get('write_graph', False):
        workflow.write_graph()
    return workflow
コード例 #5
0
def init_mriqc_wf():
    """Create a multi-subject MRIQC workflow."""
    from mriqc import config

    # Create parent workflow
    workflow = Workflow(name="mriqc_wf")
    workflow.base_dir = config.execution.work_dir

    # Create fMRI QC workflow
    if FMRI_KEY in config.workflow.inputs:
        workflow.add_nodes([fmri_qc_workflow()])

    # Create sMRI QC workflow
    input_keys = config.workflow.inputs.keys()
    anatomical_flag = any(key in input_keys for key in ANATOMICAL_KEYS)
    if anatomical_flag:
        workflow.add_nodes([anat_qc_workflow()])

    # Return non-empty workflow, else None
    if workflow._get_all_nodes():
        return workflow
コード例 #6
0
import os.path as op

from mriqc.workflows.anatomical import anat_qc_workflow
from mriqc.testing import mock_config

datadir = '/home/kilimanjaro2/Research/monkeyStuff/bidsData/'

with mock_config():
    wf = anat_qc_workflow(
        [op.join(datadir, 'sub-100/anat/sub-100_T1w.nii.gz')])
    wf.run()
    wf = anat_qc_workflow(
        [op.join(datadir, 'sub-101/anat/sub-101_T1w.nii.gz')])
    wf.run()
    wf = anat_qc_workflow(
        [op.join(datadir, 'sub-102/anat/sub-102_T1w.nii.gz')])
    wf.run()
#    wf = anat_qc_workflow([op.join(datadir, 'sub-152/anat/sub-152_T1w.nii.gz')])
#   wf.run()
#    wf = anat_qc_workflow([op.join(datadir, 'sub-154/anat/sub-154_T1w.nii.gz')])
#    wf.run()
#    wf = anat_qc_workflow([op.join(datadir, 'sub-156/anat/sub-156_T1w.nii.gz')])
#    wf.run()
#    wf = anat_qc_workflow([op.join(datadir, 'sub-158/anat/sub-158_T1w.nii.gz')])
#    wf.run()
#    wf = anat_qc_workflow([op.join(datadir, 'sub-160/anat/sub-160_T1w.nii.gz')])
#    wf.run()
#    wf = anat_qc_workflow([op.join(datadir, 'sub-162/anat/sub-162_T1w.nii.gz')])
#    wf.run()
#    wf = anat_qc_workflow([op.join(datadir, 'sub-164/anat/sub-164_T1w.nii.gz')])
#    wf.run()
コード例 #7
0
import os.path as op

from mriqc.workflows.anatomical import anat_qc_workflow
from mriqc.testing import mock_config

datadir = '/home/kilimanjaro2/Research/monkeyStuff/bidsData/'

with mock_config():
    wf = anat_qc_workflow(
        [op.join(datadir, 'sub-103/anat/sub-103_T1w.nii.gz')])
    wf.run()
    wf = anat_qc_workflow(
        [op.join(datadir, 'sub-104/anat/sub-104_T1w.nii.gz')])
    wf.run()