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


Python fsl.Info类代码示例

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


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

示例1: setup_infile

def setup_infile():
    global tmp_infile, tmp_dir
    ext = Info.output_type_to_ext(Info.output_type())
    tmp_dir = tempfile.mkdtemp()
    tmp_infile = os.path.join(tmp_dir, "foo" + ext)
    open(tmp_infile, "w")
    return tmp_infile, tmp_dir
开发者ID:amoliu,项目名称:nipype,代码行数:7,代码来源:test_preprocess.py

示例2: setup_infile

def setup_infile():
    global tmp_infile, tmp_dir
    ext = Info.output_type_to_ext(Info.output_type())
    tmp_dir = tempfile.mkdtemp()
    tmp_infile = os.path.join(tmp_dir, 'foo' + ext)
    file(tmp_infile, 'w')
    return tmp_infile, tmp_dir
开发者ID:satra,项目名称:NiPypeold,代码行数:7,代码来源:test_preprocess.py

示例3: setup_flirt

def setup_flirt(tmpdir):
    ext = Info.output_type_to_ext(Info.output_type())
    tmp_dir = str(tmpdir)
    _, infile = tempfile.mkstemp(suffix=ext, dir=tmp_dir)
    _, reffile = tempfile.mkstemp(suffix=ext, dir=tmp_dir)

    return (tmp_dir, infile, reffile)
开发者ID:mick-d,项目名称:nipype,代码行数:7,代码来源:test_preprocess.py

示例4: setup_flirt

def setup_flirt(tmpdir):
    ext = Info.output_type_to_ext(Info.output_type())
    infile = tmpdir.join("infile"+ext)
    infile.open("w")
    reffile = tmpdir.join("reffile"+ext)
    reffile.open("w")
    return (tmpdir, infile.strpath, reffile.strpath)
开发者ID:bpinsard,项目名称:nipype,代码行数:7,代码来源:test_preprocess.py

示例5: setup_infile

def setup_infile(tmpdir):
    ext = Info.output_type_to_ext(Info.output_type())
    tmp_dir = str(tmpdir)
    tmp_infile = os.path.join(tmp_dir, 'foo' + ext)
    open(tmp_infile, 'w')

    return (tmp_infile, tmp_dir)
开发者ID:mick-d,项目名称:nipype,代码行数:7,代码来源:test_preprocess.py

示例6: setup_infile

def setup_infile():
    global tmp_infile, tmp_dir, cwd
    cwd = os.getcwd()
    ext = Info.output_type_to_ext(Info.output_type())
    tmp_dir = tempfile.mkdtemp()
    tmp_infile = os.path.join(tmp_dir, 'foo' + ext)
    open(tmp_infile, 'w')
    os.chdir(tmp_dir)
    return tmp_infile, tmp_dir
开发者ID:DimitriPapadopoulos,项目名称:nipype,代码行数:9,代码来源:test_model.py

示例7: create_files_in_directory_plus_output_type

def create_files_in_directory_plus_output_type(request, tmpdir):
    func_prev_type = set_output_type(request.param)
    origdir = tmpdir.chdir()
    filelist = ['a.nii', 'b.nii']
    nifti_image_files(tmpdir.strpath, filelist, shape=(3,3,3,4))

    out_ext = Info.output_type_to_ext(Info.output_type())

    def fin():
        set_output_type(func_prev_type)
        origdir.chdir()

    request.addfinalizer(fin)
    return (filelist, tmpdir.strpath, out_ext)
开发者ID:mfalkiewicz,项目名称:nipype,代码行数:14,代码来源:fixtures.py

示例8: run_feat

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,代码行数:31,代码来源:fmri_preproc.py

示例9: create_files_in_directory

def create_files_in_directory():
    testdir = os.path.realpath(mkdtemp())
    origdir = os.getcwd()
    os.chdir(testdir)

    filelist = ['a.nii', 'b.nii']
    for f in filelist:
        hdr = nb.Nifti1Header()
        shape = (3, 3, 3, 4)
        hdr.set_data_shape(shape)
        img = np.random.random(shape)
        nb.save(nb.Nifti1Image(img, np.eye(4), hdr),
                os.path.join(testdir, f))

    out_ext = Info.output_type_to_ext(Info.output_type())
    return filelist, testdir, origdir, out_ext
开发者ID:amoliu,项目名称:nipype,代码行数:16,代码来源:test_maths.py

示例10: set_output_type

def set_output_type(fsl_output_type):
    prev_output_type = os.environ.get('FSLOUTPUTTYPE', None)

    if fsl_output_type is not None:
        os.environ['FSLOUTPUTTYPE'] = fsl_output_type
    elif 'FSLOUTPUTTYPE' in os.environ:
        del os.environ['FSLOUTPUTTYPE']

    FSLCommand.set_default_output_type(Info.output_type())
    return prev_output_type
开发者ID:shoshber,项目名称:nipype,代码行数:10,代码来源:fixtures.py

示例11: test_tbss_skeleton

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,代码行数:47,代码来源:test_dti.py

示例12: fsl_name

def fsl_name(obj, fname):
    """Create valid fsl name, including file extension for output type.
    """
    ext = Info.output_type_to_ext(obj.inputs.output_type)
    return fname + ext
开发者ID:satra,项目名称:NiPypeold,代码行数:5,代码来源:test_preprocess.py

示例13: Registration

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,代码行数:31,代码来源:ANTS_TEST.py

示例14: setup_infile

def setup_infile(tmpdir):
    ext = Info.output_type_to_ext(Info.output_type())
    tmp_infile = tmpdir.join('foo' + ext)
    tmp_infile.open("w")
    return (tmp_infile.strpath, tmpdir.strpath)
开发者ID:bpinsard,项目名称:nipype,代码行数:5,代码来源:test_preprocess.py

示例15: Node

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,代码行数:31,代码来源:example_fMRI_2_normalize_ANTS_partial.py


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