当前位置: 首页>>代码示例>>Python>>正文


Python Node.out_data_type方法代码示例

本文整理汇总了Python中nipype.pipeline.engine.Node.out_data_type方法的典型用法代码示例。如果您正苦于以下问题:Python Node.out_data_type方法的具体用法?Python Node.out_data_type怎么用?Python Node.out_data_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nipype.pipeline.engine.Node的用法示例。


在下文中一共展示了Node.out_data_type方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: func_preprocess

# 需要导入模块: from nipype.pipeline.engine import Node [as 别名]
# 或者: from nipype.pipeline.engine.Node import out_data_type [as 别名]
def func_preprocess(name = 'func_preproc'):

    '''
    Method to preprocess functional data after warping to anatomical space.

    Accomplished after one step Distortion Correction, Motion Correction and Boundary based linear registration to
    anatomical space.

    Precodure includes:
    # 1- skull strip
    # 2- Normalize the image intensity values.
    # 3- Calculate Mean of Skull stripped image
    # 4- Create brain mask from Normalized data.
    '''

    # Define Workflow
    flow        = Workflow(name=name)
    inputnode   = Node(util.IdentityInterface(fields=['func_in']),
                           name='inputnode')
    outputnode  = Node(util.IdentityInterface(fields=['func_preproc',
                                                      'func_preproc_mean',
                                                      'func_preproc_mask']),
                           name = 'outputnode')


    # 2- Normalize the image intensity values.
    norm                               = Node(interface = fsl.ImageMaths(),       name = 'func_normalized')
    norm.inputs.op_string              = '-ing 1000'
    norm.out_data_type                 = 'float'
    norm.output_type                   = 'NIFTI'

    # 4- Create brain mask from Normalized data.
    mask                               = Node(interface = fsl.BET(),  name = 'func_preprocessed')
    mask.inputs.functional             = True
    mask.inputs.mask                   = True
    mask.inputs.frac                   = 0.5
    mask.inputs.vertical_gradient      = 0
    mask.inputs.threshold              = True

    # 3- Calculate Mean of Skull stripped image
    mean                          = Node(interface = preprocess.TStat(),     name = 'func_preprocessed_mean')
    mean.inputs.options           = '-mean'
    mean.inputs.outputtype        = 'NIFTI'


    flow.connect( inputnode  ,   'func_in'           ,   norm,        'in_file'     )
    flow.connect( norm       ,   'out_file'          ,   mask,        'in_file'     )
    flow.connect( norm       ,   'out_file'          ,   mean,        'in_file'     )
    flow.connect( mask       ,   'out_file'          ,   outputnode,  'func_preproc')
    flow.connect( mask       ,   'mask_file'         ,   outputnode,  'func_preproc_mask')
    flow.connect( mean       ,   'out_file'          ,   outputnode,  'func_preproc_mean')

    return flow
开发者ID:amadeuskanaan,项目名称:GluREST,代码行数:55,代码来源:func_preprocess.py

示例2: create_deskull_pipeline

# 需要导入模块: from nipype.pipeline.engine import Node [as 别名]
# 或者: from nipype.pipeline.engine.Node import out_data_type [as 别名]
def create_deskull_pipeline(working_dir, ds_dir, name='deskull'):


    # initiate workflow
    deskull_wf = Workflow(name=name)
    deskull_wf.base_dir = os.path.join(working_dir,'LeiCA_resting', 'rsfMRI_preprocessing')

    # set fsl output
    fsl.FSLCommand.set_default_output_type('NIFTI_GZ')

    # I/O NODES
    inputnode = Node(util.IdentityInterface(fields=['epi_moco',
                                                    'struct_brain_mask',
                                                    'struct_2_epi_mat']),
                     name='inputnode')

    outputnode = Node(util.IdentityInterface(fields=['epi_deskulled',
                                                     'mean_epi',
                                                     'brain_mask_epiSpace']),
                      name='outputnode')

    ds = Node(nio.DataSink(base_directory=ds_dir), name='ds')
    ds.inputs.substitutions = [('_TR_id_', 'TR_')]


    # TRANSFORM BRAIN MASK TO EPI SPACE
    brain_mask_epiSpace = Node(fsl.ApplyXfm(apply_xfm=True, interp='nearestneighbour'), name='brain_mask_epiSpace')
    brain_mask_epiSpace.inputs.out_file = 'brain_mask_epiSpace.nii.gz'
    deskull_wf.connect([(inputnode, brain_mask_epiSpace, [('struct_brain_mask', 'in_file'),
                                                       ('epi_moco', 'reference'),
                                                       ('struct_2_epi_mat', 'in_matrix_file')])])

    deskull_wf.connect(brain_mask_epiSpace, 'out_file', outputnode, 'brain_mask_epiSpace')
    deskull_wf.connect(brain_mask_epiSpace, 'out_file', ds, 'masks.brain_mask_epiSpace')


    # DESKULL EPI
    epi_brain = Node(fsl.maths.BinaryMaths(operation = 'mul'), name='epi_brain')
    deskull_wf.connect(inputnode, 'epi_moco', epi_brain, 'in_file')
    deskull_wf.connect(brain_mask_epiSpace, 'out_file', epi_brain, 'operand_file')



    # GLOBAL INTENSITY NORMALIZATION
    epi_intensity_norm = Node(interface=fsl.ImageMaths(), name='epi_intensity_norm')
    epi_intensity_norm.inputs.op_string = '-ing 10000'
    epi_intensity_norm.out_data_type = 'float'
    deskull_wf.connect(epi_brain, 'out_file', epi_intensity_norm, 'in_file')
    deskull_wf.connect(epi_intensity_norm, 'out_file', outputnode, 'epi_deskulled')


    # CREATE MEAN EPI (INTENSITY NORMALIZED)
    mean_epi = Node(fsl.maths.MeanImage(dimension='T',
                                             out_file='rest_realigned_mean.nii.gz'),
                         name='mean_epi')

    deskull_wf.connect(epi_intensity_norm, 'out_file', mean_epi, 'in_file')
    deskull_wf.connect(mean_epi, 'out_file', ds, 'QC.mean_epi')
    deskull_wf.connect(mean_epi, 'out_file', outputnode, 'mean_epi')




    deskull_wf.write_graph(dotfilename=deskull_wf.name, graph2use='flat', format='pdf')

    return deskull_wf
开发者ID:JoHannnezzz,项目名称:nki_nilearn,代码行数:68,代码来源:deskull.py


注:本文中的nipype.pipeline.engine.Node.out_data_type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。