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


Python CommandLine.set_default_terminal_output方法代码示例

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


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

示例1: run_examples

# 需要导入模块: from nipype.interfaces.base import CommandLine [as 别名]
# 或者: from nipype.interfaces.base.CommandLine import set_default_terminal_output [as 别名]
def run_examples(example, pipelines, data_path, plugin=None, rm_base_dir=True):
    from nipype import config
    from nipype.interfaces.base import CommandLine

    if plugin is None:
        plugin = 'MultiProc'

    print('running example: %s with plugin: %s' % (example, plugin))
    config.enable_debug_mode()
    config.enable_provenance()
    CommandLine.set_default_terminal_output("stream")

    plugin_args = {}
    if plugin == 'MultiProc':
        plugin_args['n_procs'] = int(
            os.getenv('NIPYPE_NUMBER_OF_CPUS', cpu_count()))

    __import__(example)
    for pipeline in pipelines:
        wf = getattr(sys.modules[example], pipeline)
        wf.base_dir = os.path.join(os.getcwd(), 'output', example, plugin)

        results_dir = os.path.join(wf.base_dir, wf.name)
        if rm_base_dir and os.path.exists(results_dir):
            rmtree(results_dir)

        # Handle a logging directory
        log_dir = os.path.join(os.getcwd(), 'logs', example)
        if not os.path.exists(log_dir):
            os.makedirs(log_dir)
        wf.config = {
            'execution': {
                'hash_method': 'timestamp',
                'stop_on_first_rerun': 'true',
                'write_provenance': 'true',
                'poll_sleep_duration': 2
            },
            'logging': {
                'log_directory': log_dir,
                'log_to_file': True
            }
        }
        try:
            wf.inputs.inputnode.in_data = os.path.abspath(data_path)
        except AttributeError:
            pass  # the workflow does not have inputnode.in_data

        wf.run(plugin=plugin, plugin_args=plugin_args)
        # run twice to check if nothing is rerunning
        wf.run(plugin=plugin)
开发者ID:TheChymera,项目名称:nipype,代码行数:52,代码来源:run_examples.py

示例2: run_examples

# 需要导入模块: from nipype.interfaces.base import CommandLine [as 别名]
# 或者: from nipype.interfaces.base.CommandLine import set_default_terminal_output [as 别名]
def run_examples(example, pipelines, plugin):
    print('running example: %s with plugin: %s' % (example, plugin))
    from nipype import config
    config.enable_debug_mode()
    from nipype.interfaces.base import CommandLine
    CommandLine.set_default_terminal_output("stream")

    __import__(example)
    for pipeline in pipelines:
        wf = getattr(sys.modules[example], pipeline)
        wf.base_dir = os.path.join(os.getcwd(), 'output', example, plugin)
        if os.path.exists(wf.base_dir):
            rmtree(wf.base_dir)
        wf.config = {'execution': {'hash_method': 'timestamp', 'stop_on_first_rerun': 'true'}}
        wf.run(plugin=plugin, plugin_args={'n_procs': 4})
        # run twice to check if nothing is rerunning
        wf.run(plugin=plugin)
开发者ID:Garyfallidis,项目名称:nipype,代码行数:19,代码来源:run_examples.py

示例3: import

# 需要导入模块: from nipype.interfaces.base import CommandLine [as 别名]
# 或者: from nipype.interfaces.base.CommandLine import set_default_terminal_output [as 别名]
http://mindboggle.info/data.html

specifically the 2mm versions of:

- `Joint Fusion Atlas <http://mindboggle.info/data/atlases/jointfusion/OASIS-TRT-20_jointfusion_DKT31_CMA_labels_in_MNI152_2mm_v2.nii.gz>`_
- `MNI template <http://mindboggle.info/data/templates/ants/OASIS-30_Atropos_template_in_MNI152_2mm.nii.gz>`_

"""

from __future__ import division, unicode_literals
from builtins import open, range, str

import os

from nipype.interfaces.base import CommandLine
CommandLine.set_default_terminal_output('allatonce')

# https://github.com/moloney/dcmstack
from dcmstack.extract import default_extractor
# pip install pydicom
from dicom import read_file

from nipype.interfaces import (fsl, Function, ants, freesurfer, nipy)
from nipype.interfaces.c3 import C3dAffineTool

fsl.FSLCommand.set_default_output_type('NIFTI_GZ')

from nipype import Workflow, Node, MapNode

from nipype.algorithms.rapidart import ArtifactDetect
from nipype.algorithms.misc import TSNR
开发者ID:Conxz,项目名称:nipype,代码行数:33,代码来源:rsfmri_vol_surface_preprocessing_nipy.py

示例4: import

# 需要导入模块: from nipype.interfaces.base import CommandLine [as 别名]
# 或者: from nipype.interfaces.base.CommandLine import set_default_terminal_output [as 别名]
The 2mm version was generated with::

   >>> from nipype import freesurfer as fs
   >>> rs = fs.Resample()
   >>> rs.inputs.in_file = 'OASIS-TRT-20_jointfusion_DKT31_CMA_labels_in_MNI152.nii.gz'
   >>> rs.inputs.resampled_file = 'OASIS-TRT-20_jointfusion_DKT31_CMA_labels_in_MNI152_2mm.nii.gz'
   >>> rs.inputs.voxel_size = (2., 2., 2.)
   >>> rs.inputs.args = '-rt nearest -ns 1'
   >>> res = rs.run()

"""

import os

from nipype.interfaces.base import CommandLine
CommandLine.set_default_terminal_output('file')

from nipype import config
config.enable_provenance()

from nipype import (ants, afni, fsl, freesurfer, nipy, Function, DataSink)
from nipype import Workflow, Node, MapNode

from nipype.algorithms.rapidart import ArtifactDetect
from nipype.algorithms.misc import TSNR
from nipype.interfaces.fsl import EPIDeWarp
from nipype.interfaces.io import FreeSurferSource
from nipype.interfaces.c3 import C3dAffineTool
from nipype.interfaces.utility import Merge, IdentityInterface
from nipype.utils.filemanip import filename_to_list
开发者ID:adamatus,项目名称:nipype,代码行数:32,代码来源:rsfmri_preprocessing.py

示例5:

# 需要导入模块: from nipype.interfaces.base import CommandLine [as 别名]
# 或者: from nipype.interfaces.base.CommandLine import set_default_terminal_output [as 别名]
available from:

http://mindboggle.info/data.html

specifically the 2mm versions of:

- `Joint Fusion Atlas <http://mindboggle.info/data/atlases/jointfusion/OASIS-TRT-20_jointfusion_DKT31_CMA_labels_in_MNI152_2mm_v2.nii.gz>`_
- `MNI template <http://mindboggle.info/data/templates/ants/OASIS-30_Atropos_template_in_MNI152_2mm.nii.gz>`_

"""

import os

from nipype.interfaces.base import CommandLine

CommandLine.set_default_terminal_output("allatonce")

from dcmstack.extract import default_extractor
from dicom import read_file

from nipype.interfaces import fsl, Function, ants, freesurfer, nipy
from nipype.interfaces.c3 import C3dAffineTool

fsl.FSLCommand.set_default_output_type("NIFTI_GZ")

from nipype import Workflow, Node, MapNode

from nipype.algorithms.rapidart import ArtifactDetect
from nipype.algorithms.misc import TSNR
from nipype.interfaces.utility import Rename, Merge, IdentityInterface
from nipype.utils.filemanip import filename_to_list
开发者ID:wanderine,项目名称:nipype,代码行数:33,代码来源:rsfmri_vol_surface_preprocessing_nipy.py

示例6: run_examples

# 需要导入模块: from nipype.interfaces.base import CommandLine [as 别名]
# 或者: from nipype.interfaces.base.CommandLine import set_default_terminal_output [as 别名]
def run_examples(example, pipelines, data_path, plugin=None):
    '''
    Run example workflows
    '''

    # Import packages
    from nipype import config
    from nipype.interfaces.base import CommandLine
    from nipype.utils import draw_gantt_chart
    from nipype.pipeline.plugins import log_nodes_cb

    if plugin is None:
        plugin = 'MultiProc'

    print('running example: %s with plugin: %s' % (example, plugin))
    config.enable_debug_mode()
    config.enable_provenance()
    CommandLine.set_default_terminal_output("stream")

    plugin_args = {}
    if plugin == 'MultiProc':
        plugin_args['n_procs'] = cpu_count()

    __import__(example)

    for pipeline in pipelines:
        # Init and run workflow
        wf = getattr(sys.modules[example], pipeline)
        wf.base_dir = os.path.join(os.getcwd(), 'output', example, plugin)
        if os.path.exists(wf.base_dir):
            rmtree(wf.base_dir)

        # Handle a logging directory
        log_dir = os.path.join(os.getcwd(), 'logs', example)
        if os.path.exists(log_dir):
            rmtree(log_dir)
        os.makedirs(log_dir)
        wf.config = {'execution': {'hash_method': 'timestamp',
                                   'stop_on_first_rerun': 'true',
                                   'write_provenance': 'true'}}

        # Callback log setup
        if example == 'fmri_spm_nested' and plugin == 'MultiProc' and \
           pipeline == 'l2pipeline':
            # Init callback log
            import logging
            cb_log_path = os.path.join(os.path.expanduser('~'), 'callback.log')
            cb_logger = logging.getLogger('callback')
            cb_logger.setLevel(logging.DEBUG)
            handler = logging.FileHandler(cb_log_path)
            cb_logger.addHandler(handler)
            plugin_args = {'n_procs' : 4, 'status_callback' : log_nodes_cb}
        else:
            plugin_args = {'n_procs' : 4}
        try:
            wf.inputs.inputnode.in_data = os.path.abspath(data_path)
        except AttributeError:
            pass # the workflow does not have inputnode.in_data

        wf.run(plugin=plugin, plugin_args=plugin_args)

        # Draw gantt chart only if pandas is installed
        try:
            import pandas
            pandas_flg = True
        except ImportError as exc:
            pandas_flg = False

        if plugin_args.has_key('status_callback') and pandas_flg:
            draw_gantt_chart.generate_gantt_chart(cb_log_path, 4)
            dst_log_html = os.path.join(os.path.expanduser('~'), 'callback.log.html')
            copyfile(cb_log_path+'.html', dst_log_html)
开发者ID:FCP-INDI,项目名称:nipype,代码行数:74,代码来源:run_examples.py

示例7:

# 需要导入模块: from nipype.interfaces.base import CommandLine [as 别名]
# 或者: from nipype.interfaces.base.CommandLine import set_default_terminal_output [as 别名]
   >>> from nipype import freesurfer as fs
   >>> rs = fs.Resample()
   >>> rs.inputs.in_file = 'OASIS-TRT-20_jointfusion_DKT31_CMA_labels_in_MNI152.nii.gz'
   >>> rs.inputs.resampled_file = 'OASIS-TRT-20_jointfusion_DKT31_CMA_labels_in_MNI152_2mm.nii.gz'
   >>> rs.inputs.voxel_size = (2., 2., 2.)
   >>> rs.inputs.args = '-rt nearest -ns 1'
   >>> res = rs.run()

"""

import os

from nipype.interfaces.base import CommandLine

CommandLine.set_default_terminal_output("file")

from nipype import config

config.enable_provenance()

from nipype import ants, afni, fsl, freesurfer, nipy, Function, DataSink
from nipype import Workflow, Node, MapNode

from nipype.algorithms.rapidart import ArtifactDetect
from nipype.algorithms.misc import TSNR
from nipype.interfaces.fsl import EPIDeWarp
from nipype.interfaces.io import FreeSurferSource
from nipype.interfaces.c3 import C3dAffineTool
from nipype.interfaces.utility import Merge, IdentityInterface
from nipype.utils.filemanip import filename_to_list
开发者ID:Guokr1991,项目名称:nipype,代码行数:32,代码来源:rsfmri_preprocessing.py


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