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


Python Info.standard_image方法代码示例

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


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

示例1: run_feat

# 需要导入模块: from nipype.interfaces.fsl import Info [as 别名]
# 或者: from nipype.interfaces.fsl.Info import standard_image [as 别名]
def run_feat(bold_file, bold_folder, brainmask_file, feat_gen):
    from nipype.interfaces.fsl import ImageStats, FEAT, Info
    # from bm_functions import gen_default_feat_config
    from numpy import shape
    from textwrap import dedent

    fslFilename = bold_folder + 'feat.fsf'

    # Get the number of voxels in the 4D file
    statComp = ImageStats()
    statComp.inputs.in_file = bold_file
    statComp.inputs.op_string = '-v'

    numVox = int(statComp.run().outputs.out_stat[0])

    # Get the number of raw volumes
    statComp.inputs.split_4d = True

    numVol = shape(statComp.run().outputs.out_stat)[0]

    # Generate the file
    standard_T1_brain = Info.standard_image('MNI152_T1_2mm_brain')
    theString = feat_gen(bold_folder, bold_file, brainmask_file, standard_T1_brain, numVox, numVol)
    with open(fslFilename,'w') as out_file:
        out_file.write(dedent(theString))
    out_file.close()   

    # Run feat using the previously manipulated config
    runFeat = FEAT(fsf_file = fslFilename)
    # Run and pass back the foldername
    return runFeat.run().outputs.feat_dir
开发者ID:BrainModes,项目名称:TVB-Pypeline,代码行数:33,代码来源:fmri_preproc.py

示例2: test_tbss_skeleton

# 需要导入模块: from nipype.interfaces.fsl import Info [as 别名]
# 或者: from nipype.interfaces.fsl.Info import standard_image [as 别名]
def test_tbss_skeleton():
    skeletor = fsl.TractSkeleton()

    files, newdir, olddir = create_files_in_directory()

    # Test the underlying command
    yield assert_equal, skeletor.cmd, "tbss_skeleton"

    # It shouldn't run yet
    yield assert_raises, ValueError, skeletor.run

    # Test the most basic way to use it
    skeletor.inputs.in_file = files[0]

    # First by implicit argument
    skeletor.inputs.skeleton_file = True
    yield assert_equal, skeletor.cmdline, \
    "tbss_skeleton -i a.nii -o %s"%os.path.join(newdir, "a_skeleton.nii")

    # Now with a specific name
    skeletor.inputs.skeleton_file = "old_boney.nii"
    yield assert_equal, skeletor.cmdline, "tbss_skeleton -i a.nii -o old_boney.nii"

    # Now test the more complicated usage
    bones = fsl.TractSkeleton(in_file="a.nii", project_data=True)

    # This should error
    yield assert_raises, ValueError, bones.run

    # But we can set what we need
    bones.inputs.threshold = 0.2
    bones.inputs.distance_map = "b.nii"
    bones.inputs.data_file = "b.nii" # Even though that's silly

    # Now we get a command line
    yield assert_equal, bones.cmdline, \
    "tbss_skeleton -i a.nii -p 0.200 b.nii %s b.nii %s"%(Info.standard_image("LowerCingulum_1mm.nii.gz"),
                                                         os.path.join(newdir, "b_skeletonised.nii"))

    # Can we specify a mask?
    bones.inputs.use_cingulum_mask = Undefined
    bones.inputs.search_mask_file = "a.nii"
    yield assert_equal, bones.cmdline, \
    "tbss_skeleton -i a.nii -p 0.200 b.nii a.nii b.nii %s"%os.path.join(newdir, "b_skeletonised.nii")

    # Looks good; clean up
    clean_directory(newdir, olddir)
开发者ID:Alunisiira,项目名称:nipype,代码行数:49,代码来源:test_dti.py

示例3: Registration

# 需要导入模块: from nipype.interfaces.fsl import Info [as 别名]
# 或者: from nipype.interfaces.fsl.Info import standard_image [as 别名]
from nipype.pipeline.engine import Workflow, Node, MapNode
from nipype.interfaces.fsl import Info

# FreeSurfer - Specify the location of the freesurfer folder
fs_dir = '/data/adamt/Apps/fs6beta'
FSCommand.set_default_subjects_dir(fs_dir)

# Specify variables
experiment_dir = '/data/Hippo_hr/cpb/'          # location of experiment folder
input_dir_1st = 'output_ANTS_test_1st_lvl'     # name of 1st-level output folder
output_dir = 'output_ANTS_test_norm'  # name of norm output folder
working_dir = '/home/zhoud4/Hippo_hr/cpb/ants1/lhipp3_batch/'  # name of norm working directory
subject_list = ['d701', 'd702', 'd703']                     # list of subject identifiers

# location of template file
template = Info.standard_image('.nii.gz')

# Registration (good) - computes registration between subject's structural and MNI template.
antsreg = Node(Registration(args='--float',
                            collapse_output_transforms=True,
                            fixed_image=template,
                            initial_moving_transform_com=True,
                            num_threads=1,
                            output_inverse_warped_image=True,
                            output_warped_image=True,
                            sigma_units=['vox']*3,
                            transforms=['Rigid', 'Affine', 'SyN'],
                            terminal_output='file',
                            winsorize_lower_quantile=0.005,
                            winsorize_upper_quantile=0.995,
                            convergence_threshold=[1e-06],
开发者ID:dalejn,项目名称:ants_scripts,代码行数:33,代码来源:ANTS_TEST.py

示例4: Node

# 需要导入模块: from nipype.interfaces.fsl import Info [as 别名]
# 或者: from nipype.interfaces.fsl.Info import standard_image [as 别名]
FSCommand.set_default_subjects_dir(fs_dir)


###
# Specify variables
experiment_dir = '~/nipype_tutorial'          # location of experiment folder
input_dir_1st = 'output_fMRI_example_1st'     # name of 1st-level output folder
output_dir = 'output_fMRI_example_norm_ants'  # name of norm output folder
working_dir = 'workingdir_fMRI_example_norm_ants'  # name of norm working directory
subject_list = ['sub001', 'sub002', 'sub003',
                'sub004', 'sub005', 'sub006',
                'sub007', 'sub008', 'sub009',
                'sub010']                     # list of subject identifiers

# location of template file
template = Info.standard_image('MNI152_T1_1mm_brain.nii.gz')


###
# Specify Normalization Nodes

# Registration - computes registration between subject's structural and MNI template.
antsreg = Node(Registration(args='--float',
                            collapse_output_transforms=True,
                            fixed_image=template,
                            initial_moving_transform_com=True,
                            num_threads=1,
                            output_inverse_warped_image=True,
                            output_warped_image=True,
                            sigma_units=['vox']*3,
                            transforms=['Rigid', 'Affine', 'SyN'],
开发者ID:JanisReinelt,项目名称:nipype-beginner-s-guide,代码行数:33,代码来源:example_fMRI_2_normalize_ANTS_partial.py

示例5: custom_level1design_feat

# 需要导入模块: from nipype.interfaces.fsl import Info [as 别名]
# 或者: from nipype.interfaces.fsl.Info import standard_image [as 别名]

#.........这里部分代码省略.........
                                 'up': 1, 1: 1,
                                 'down': 2, 2: 2},

                    motion_correction={True: 1, 1: 1, False: 0, 0: 0, None: 0},

                    bet={True: 1, 1: 1, False: 0, 0: 0, None: 0},

                    motion_regression={'no': 0, False: 0, None: 0,
                                       'yes': 1, True: 1, 1: 1,
                                       'ext': 2, 2: 2},

                    thresholding={'none': 0, None: 0, 'no': 0, 0: 0,
                                  'uncorrected': 1, 'Uncorrected': 1, 1: 1,
                                  'voxel': 2, 'Voxel': 2, 2: 2,
                                  'cluster': 3, 'Cluster': 3, 3: 3},

                    prewhitening={True: 1, 1: 1, False: 0, None: 0, 0: 0},

                    hrf={'doublegamma': 3,
                         'none': 0, None: 0,
                         'gaussian': 1,
                         'gamma': 2,
                         'gammabasisfunctions': 4}, #,
                         #'sinebasisfunctions': 5,
                         #'firbasisfunctions': 6},

                    open_feat_html={True: 1, 1: 1,
                                    False: 0, 0: 0, None: 0}
                    )

    reg_dict = {'full': {'reghighres_yn': 1,
                         'reghighres_dof': 'BBR',
                         'regstandard_yn': 1,
                         'regstandard': Info.standard_image('MNI152_T1_2mm_brain.nii.gz'),
                         'regstandard_dof': 12,
                         'regstandard_nonlinear_yn': 1},

                'none': {'reghighres_yn': 0,
                         'regstandard_yn': 0},

                'fmriprep': {'reghighres_yn': 0,
                             'regstandard_yn': 1,
                             'regstandard_dof': 3,
                             'regstandard_nonlinear_yn': 0}
                }

    data_dir = op.join(op.dirname(spynoza.__file__), 'data')
    fsf_template = op.join(data_dir, 'fsf_templates', 'firstlevel_template.fsf')

    with open(fsf_template, 'r') as f:
        fsf_template = f.readlines()
        fsf_template = [txt.replace('\n', '') for txt in fsf_template if txt != '\n']
        fsf_template = [txt for txt in fsf_template if txt[0] != '#']  # remove commnts

    hdr = nib.load(func_file).header

    args = {'outputdir': "\"%s\"" % output_dirname,
            'tr': hdr['pixdim'][4],
            'npts': hdr['dim'][4],
            'smooth': smoothing,
            'deriv_yn': arg_dict['temp_deriv'][temp_deriv],
            'temphp_yn': 1 if highpass else 0,
            'paradigm_hp': highpass,
            'st': arg_dict['slicetiming'][slicetiming],
            'mc': arg_dict['motion_correction'][motion_correction],
            'bet_yn': arg_dict['bet'][bet],
开发者ID:spinoza-rec,项目名称:nitools,代码行数:70,代码来源:nodes.py


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