• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python base.CommandLine类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: DICOM2animatedGIF_sidebyside

def DICOM2animatedGIF_sidebyside(dcmdir_l, dcmdir_r, outputpath, slice_i, suffix):

    dcmio = DicomIO.DicomIO()
    dwidcm_l = dcmio.ReadDICOM_frames(dcmdir_l)
    dwidcm_r = dcmio.ReadDICOM_frames(dcmdir_r)
    # Write all frames of slice into set of png files
    for frame_i in range(len(dwidcm_l)):
        slice_l = dwidcm_l[frame_i][slice_i].pixel_array.T
        slice_r = dwidcm_r[frame_i][slice_i].pixel_array.T
        dimx = slice_l.shape[0]
        dimy = slice_l.shape[1]
        newImg1 = PIL.Image.new('L', (dimx*2, dimy))
        pixels1 = newImg1.load()
        for i in range (0, dimx):
            for j in range (0, dimy):
                pixels1[i, j] = float(slice_l[i, j])
                pixels1[dimx+i, j] = float(slice_r[i, j])
        #pixels1[i, j] = float(slice[i, j]) * dwidcm[frame_i][slice_i].RescaleSlope + dwidcm[frame_i][slice_i].RescaleIntercept
        newImg1.save((outputpath + '_' + ('%02d' % frame_i) + '.png'),'PNG')
    cmd = CommandLine('convert -delay 25 -loop 0 %s_*.png %s_%s.gif' % (outputpath, outputpath, suffix))
    cmd.run()
    for frame_i in range(len(dwidcm_l)):
        os.remove((outputpath + '_' + ('%02d' % frame_i) + '.png'))
    print "convert (ImageMagick):" + cmd.cmd
    return (outputpath + '.gif')
开发者ID:haanme,项目名称:DWIProstateMotionCorrection,代码行数:25,代码来源:motioncorrection_DICOM2animatedGIF.py


示例2: _submit_batchtask

    def _submit_batchtask(self, scriptfile, node):
        cmd = CommandLine('qsub', environ=os.environ.data)
        qsubargs = ''
        if self._qsub_args:
            qsubargs = self._qsub_args
        if node._hierarchy:
            jobname = '.'.join((os.environ.data['LOGNAME'],
                                node._hierarchy,
                                node._id))
        else:
            jobname = '.'.join((os.environ.data['LOGNAME'],
                                node._id))
        cmd.inputs.args = '%s -N %s %s'%(qsubargs,
                                         jobname,
                                         scriptfile)

        oldlevel = iflogger.level
        iflogger.setLevel(logging.getLevelName('CRITICAL'))
        tries = 0
        while True:
            try:
                result = cmd.run()
            except Exception, e:
                if tries<self._max_tries:
                    tries += 1
                    sleep(self._retry_timeout) # sleep 2 seconds and try again.
                else:
                    iflogger.setLevel(oldlevel)
                    raise RuntimeError('\n'.join((('Could not submit pbs task'
                                                   ' for node %s') % node._id,
                                                  str(e))))
            else:
                break
开发者ID:IBIC,项目名称:nipype,代码行数:33,代码来源:pbs.py


示例3: geodesic_depth

def geodesic_depth(command, surface_file):
    """
    Measure "travel depth" of each vertex in a surface mesh.
    (Calls Joachim Giard's C++ code)

    Parameters
    ----------
    command : travel depth C++ executable command
    surface_file : ``vtk file``

    Returns
    -------
    depth_file: string
        vtk file with geodesic depth per vertex of mesh

    """
    import os
    from nipype.interfaces.base import CommandLine

    depth_file = os.path.join(os.getcwd(),
                 os.path.splitext(os.path.basename(surface_file))[0] + '.geodesic_depth.vtk')
    cli = CommandLine(command = command)
    cli.inputs.args = ' '.join([surface_file, depth_file])
    cli.cmdline
    cli.run()

    if not os.path.exists(depth_file):
        raise(IOError(depth_file + " not found"))

    return depth_file
开发者ID:ccraddock,项目名称:mindboggle,代码行数:30,代码来源:shape_tools.py


示例4: dicom2nrrd

def dicom2nrrd(dicomdir, out_prefix, out_suffix):
    import os
    from nipype.interfaces.base import CommandLine
    cmd = CommandLine('DWIConvert --inputDicomDirectory %s --outputVolume %s/%s/%s%s.nrrd' % (dicomdir, experiment_dir,out_prefix,out_prefix,out_suffix))
    print "DICOM->NRRD:" + cmd.cmd
    cmd.run()
    return os.path.abspath('%s/%s/%s%s.nrrd' % (experiment_dir,out_prefix,out_prefix,out_suffix))
开发者ID:haanme,项目名称:FinnBrain,代码行数:7,代码来源:pipeline_DTI_step0b_DICOM2Nrrd.py


示例5: _grab_xml

 def _grab_xml(self, module):
     cmd = CommandLine(command = "Slicer3", args="--launch %s --xml"%module)
     ret = cmd.run()
     if ret.runtime.returncode == 0:
         return xml.dom.minidom.parseString(ret.runtime.stdout)
     else:
         raise Exception(cmd.cmdline + " failed:\n%s"%ret.runtime.stderr)
开发者ID:agramfort,项目名称:nipype,代码行数:7,代码来源:slicer.py


示例6: _submit_batchtask

 def _submit_batchtask(self, scriptfile, node):
     cmd = CommandLine('bsub', environ=os.environ.data,
                       terminal_output='allatonce')
     path = os.path.dirname(scriptfile)
     bsubargs = ''
     if self._bsub_args:
         bsubargs = self._bsub_args
     if 'bsub_args' in node.plugin_args:
         if 'overwrite' in node.plugin_args and\
            node.plugin_args['overwrite']:
             bsubargs = node.plugin_args['bsub_args']
         else:
             bsubargs += (" " + node.plugin_args['bsub_args'])
     if '-o' not in bsubargs:  # -o outfile
         bsubargs = '%s -o %s' % (bsubargs, scriptfile + ".log")
     if '-e' not in bsubargs:
         bsubargs = '%s -e %s' % (bsubargs, scriptfile + ".log")  # -e error file
     if node._hierarchy:
         jobname = '.'.join((os.environ.data['LOGNAME'],
                             node._hierarchy,
                             node._id))
     else:
         jobname = '.'.join((os.environ.data['LOGNAME'],
                             node._id))
     jobnameitems = jobname.split('.')
     jobnameitems.reverse()
     jobname = '.'.join(jobnameitems)
     cmd.inputs.args = '%s -J %s sh %s' % (bsubargs,
                                           jobname,
                                           scriptfile)  # -J job_name_spec
     logger.debug('bsub ' + cmd.inputs.args)
     oldlevel = iflogger.level
     iflogger.setLevel(logging.getLevelName('CRITICAL'))
     tries = 0
     while True:
         try:
             result = cmd.run()
         except Exception as e:
             if tries < self._max_tries:
                 tries += 1
                 sleep(
                     self._retry_timeout)  # sleep 2 seconds and try again.
             else:
                 iflogger.setLevel(oldlevel)
                 raise RuntimeError('\n'.join((('Could not submit lsf task'
                                                ' for node %s') % node._id,
                                               str(e))))
         else:
             break
     iflogger.setLevel(oldlevel)
     # retrieve lsf taskid
     match = re.search('<(\d*)>', result.runtime.stdout)
     if match:
         taskid = int(match.groups()[0])
     else:
         raise ScriptError("Can't parse submission job output id: %s" %
                           result.runtime.stdout)
     self._pending[taskid] = node.output_dir()
     logger.debug('submitted lsf task: %d for node %s' % (taskid, node._id))
     return taskid
开发者ID:demianw,项目名称:nipype,代码行数:60,代码来源:lsf.py


示例7: area

def area(command, surface_file):
    """
    Measure area of each vertex in a surface mesh.
    (Calls Joachim Giard's C++ code)

    Parameters
    ----------
    command : string
        Voronoi-based surface area C++ executable command
    surface_file : string
        vtk file with surface mesh

    Returns
    -------
    area_file: string
        vtk file with surface area per vertex of mesh

    """
    import os
    from nipype.interfaces.base import CommandLine

    area_file = os.path.join(os.getcwd(),
                os.path.splitext(os.path.basename(surface_file))[0] + '.area.vtk')
    cli = CommandLine(command = command)
    cli.inputs.args = ' '.join([surface_file, area_file])
    cli.cmdline
    cli.run()

    if not os.path.exists(area_file):
        raise(IOError(area_file + " not found"))

    return area_file
开发者ID:ccraddock,项目名称:mindboggle,代码行数:32,代码来源:shape_tools.py


示例8: _submit_batchtask

 def _submit_batchtask(self, scriptfile, node):
     cmd = CommandLine('qsub', environ=dict(os.environ),
                       terminal_output='allatonce')
     path = os.path.dirname(scriptfile)
     qsubargs = ''
     if self._qsub_args:
         qsubargs = self._qsub_args
     if 'qsub_args' in node.plugin_args:
         if 'overwrite' in node.plugin_args and \
                 node.plugin_args['overwrite']:
             qsubargs = node.plugin_args['qsub_args']
         else:
             qsubargs += (" " + node.plugin_args['qsub_args'])
     if '-o' not in qsubargs:
         qsubargs = '%s -o %s' % (qsubargs, path)
     if '-e' not in qsubargs:
         qsubargs = '%s -e %s' % (qsubargs, path)
     if node._hierarchy:
         jobname = '.'.join((dict(os.environ)['LOGNAME'],
                             node._hierarchy,
                             node._id))
     else:
         jobname = '.'.join((dict(os.environ)['LOGNAME'],
                             node._id))
     jobnameitems = jobname.split('.')
     jobnameitems.reverse()
     jobname = '.'.join(jobnameitems)
     jobname = qsub_sanitize_job_name(jobname)
     cmd.inputs.args = '%s -N %s %s' % (qsubargs,
                                        jobname,
                                        scriptfile)
     oldlevel = iflogger.level
     iflogger.setLevel(logging.getLevelName('CRITICAL'))
     tries = 0
     result = list()
     while True:
         try:
             result = cmd.run()
         except Exception as e:
             if tries < self._max_tries:
                 tries += 1
                 time.sleep(
                     self._retry_timeout)  # sleep 2 seconds and try again.
             else:
                 iflogger.setLevel(oldlevel)
                 raise RuntimeError('\n'.join((('Could not submit sge task'
                                                ' for node %s') % node._id,
                                               str(e))))
         else:
             break
     iflogger.setLevel(oldlevel)
     # retrieve sge taskid
     lines = [line for line in result.runtime.stdout.split('\n') if line]
     taskid = int(re.match("Your job ([0-9]*) .* has been submitted",
                           lines[-1]).groups()[0])
     self._pending[taskid] = node.output_dir()
     self._refQstatSubstitute.add_startup_job(taskid, cmd.cmdline)
     logger.debug('submitted sge task: %d for node %s with %s' %
                  (taskid, node._id, cmd.cmdline))
     return taskid
开发者ID:akeshavan,项目名称:nipype,代码行数:60,代码来源:sge.py


示例9: elastix

def elastix(input_file, target_file, mask_file, output_prefix, output_sub_prefix, param_rigid, param_BSpline):
    from os.path import abspath as opap
    from nipype.interfaces.base import CommandLine
    from nipype.utils.filemanip import split_filename
    import shutil
    import glob
    import os

    out_dir = experiment_dir + os.sep + output_prefix + os.sep + output_sub_prefix
    # Create output directory if it does not exist
    if os.path.exists(out_dir):
        print "rmtree: " + out_dir
        shutil.rmtree(out_dir)
    print "creating: " + out_dir
    os.makedirs(out_dir)

    cmd = CommandLine(
        (
            "/Users/eija/Documents/SW/Elastix/elastix_sources_v4.7/bin/bin/elastix -f %s -m %s -out %s -p %s -p %s -threads 8"
        )
        % (target_file, input_file, out_dir, param_rigid, param_BSpline)
    )

    print "elastix: " + cmd.cmd
    cmd.run()
    resultfiles = glob.glob(out_dir + os.sep + "result.*.tiff")
    return resultfiles
开发者ID:haanme,项目名称:DWIProstateMotionCorrection,代码行数:27,代码来源:motioncorrection_2nd.py


示例10: _is_pending

 def _is_pending(self, taskid):
     cmd = CommandLine('qstat')
     cmd.inputs.args = '-j %d'%taskid
     # check sge task
     result = cmd.run(ignore_exception=True)
     if result.runtime.stdout.startswith('='):
         return True
     return False
开发者ID:agramfort,项目名称:nipype,代码行数:8,代码来源:sge.py


示例11: _is_pending

 def _is_pending(self, taskid):
     cmd = CommandLine("qstat")
     cmd.inputs.args = "%s" % taskid
     # check pbs task
     result = cmd.run(ignore_exception=True)
     if "Unknown Job Id" in result.runtime.stderr:
         return False
     return True
开发者ID:agramfort,项目名称:nipype,代码行数:8,代码来源:pbs.py


示例12: area

def area(command, surface_file, verbose=False):
    """
    Measure area of each vertex in a surface mesh.
    (Calls Joachim Giard's C++ code)

    Parameters
    ----------
    command : string
        Voronoi-based surface area C++ executable command
    surface_file : string
        vtk file with surface mesh
    verbose : bool
        print statements?

    Returns
    -------
    area_file: string
        vtk file with surface area per vertex of mesh

    Examples
    --------
    >>> import os
    >>> import numpy as np
    >>> from mindboggle.shapes.surface_shapes import area
    >>> from mindboggle.mio.vtks import read_scalars
    >>> from mindboggle.mio.fetch_data import prep_tests
    >>> urls, fetch_data = prep_tests()
    >>> surface_file = fetch_data(urls['left_pial'], '', '.vtk')
    >>> verbose = False
    >>> ccode_path = os.environ['vtk_cpp_tools']
    >>> command = os.path.join(ccode_path, 'area', 'PointAreaMain')
    >>> area_file = area(command, surface_file, verbose)
    >>> scalars, name = read_scalars(area_file)
    >>> np.allclose(scalars[0:8],
    ...             [0.48270401731, 0.39661528543, 0.57813454792, 0.70574099571,
    ...              0.84318527207, 0.57642554119, 0.66942016035, 0.70629953593])
    True

    """
    import os
    from nipype.interfaces.base import CommandLine

    basename = os.path.splitext(os.path.basename(surface_file))[0]
    area_file = os.path.join(os.getcwd(), basename + '.area.vtk')
    args = ' '.join([surface_file, area_file])

    if verbose:
        print("{0} {1}".format(command, args))

    cli = CommandLine(command=command)
    cli.inputs.args = args
    cli.terminal_output = 'file'
    cli.run()

    if not os.path.exists(area_file):
        raise IOError(area_file + " not found")

    return area_file
开发者ID:binarybottle,项目名称:mindboggle,代码行数:58,代码来源:surface_shapes.py


示例13: _submit_batchtask

    def _submit_batchtask(self, scriptfile, node):
        """
        This is more or less the _submit_batchtask from sge.py with flipped variable
        names, different command line switches, and different output formatting/processing
        """
        cmd = CommandLine('sbatch', environ=os.environ.data,
                          terminal_output='allatonce')
        path = os.path.dirname(scriptfile)

        sbatch_args = ''
        if self._sbatch_args:
            sbatch_args = self._sbatch_args
        if 'sbatch_args' in node.plugin_args:
            if 'overwrite' in node.plugin_args and\
               node.plugin_args['overwrite']:
                sbatch_args = node.plugin_args['sbatch_args']
            else:
                sbatch_args += (" " + node.plugin_args['sbatch_args'])
        if '-o' not in sbatch_args:
            sbatch_args = '%s -o %s' % (sbatch_args, os.path.join(path, 'slurm-%j.out'))
        if '-e' not in sbatch_args:
            sbatch_args = '%s -e %s' % (sbatch_args, os.path.join(path, 'slurm-%j.out'))
        if '-p' not in sbatch_args:
            sbatch_args = '%s -p normal' % (sbatch_args)
        if '-n' not in sbatch_args:
            sbatch_args = '%s -n 16' % (sbatch_args)
        if '-t' not in sbatch_args:
            sbatch_args = '%s -t 1:00:00' % (sbatch_args)
        if node._hierarchy:
            jobname = '.'.join((os.environ.data['LOGNAME'],
                                node._hierarchy,
                                node._id))
        else:
            jobname = '.'.join((os.environ.data['LOGNAME'],
                                node._id))
        jobnameitems = jobname.split('.')
        jobnameitems.reverse()
        jobname = '.'.join(jobnameitems)
        cmd.inputs.args = '%s -J %s %s' % (sbatch_args,
                                           jobname,
                                           scriptfile)
        oldlevel = iflogger.level
        iflogger.setLevel(logging.getLevelName('CRITICAL'))
        tries = 0
        while True:
            try:
                result = cmd.run()
            except Exception, e:
                if tries < self._max_tries:
                    tries += 1
                    sleep(self._retry_timeout)  # sleep 2 seconds and try again.
                else:
                    iflogger.setLevel(oldlevel)
                    raise RuntimeError('\n'.join((('Could not submit sbatch task'
                                                   ' for node %s') % node._id,
                                                  str(e))))
            else:
                break
开发者ID:Guokr1991,项目名称:nipype,代码行数:58,代码来源:slurm.py


示例14: _submit_batchtask

 def _submit_batchtask(self, scriptfile, node):
     cmd = CommandLine('condor_qsub', environ=os.environ.data,
                       terminal_output='allatonce')
     path = os.path.dirname(scriptfile)
     qsubargs = ''
     if self._qsub_args:
         qsubargs = self._qsub_args
     if 'qsub_args' in node.plugin_args:
         if 'overwrite' in node.plugin_args and\
            node.plugin_args['overwrite']:
             qsubargs = node.plugin_args['qsub_args']
         else:
             qsubargs += (" " + node.plugin_args['qsub_args'])
     if self._qsub_args:
         qsubargs = self._qsub_args
     if '-o' not in qsubargs:
         qsubargs = '%s -o %s' % (qsubargs, path)
     if '-e' not in qsubargs:
         qsubargs = '%s -e %s' % (qsubargs, path)
     if node._hierarchy:
         jobname = '.'.join((os.environ.data['LOGNAME'],
                             node._hierarchy,
                             node._id))
     else:
         jobname = '.'.join((os.environ.data['LOGNAME'],
                             node._id))
     jobnameitems = jobname.split('.')
     jobnameitems.reverse()
     jobname = '.'.join(jobnameitems)
     cmd.inputs.args = '%s -N %s %s' % (qsubargs,
                                        jobname,
                                        scriptfile)
     oldlevel = iflogger.level
     iflogger.setLevel(logging.getLevelName('CRITICAL'))
     tries = 0
     while True:
         try:
             result = cmd.run()
         except Exception as e:
             if tries < self._max_tries:
                 tries += 1
                 sleep(self._retry_timeout)  # sleep 2 seconds and try again.
             else:
                 iflogger.setLevel(oldlevel)
                 raise RuntimeError('\n'.join((('Could not submit condor '
                                                'cluster'
                                                ' for node %s') % node._id,
                                               str(e))))
         else:
             break
     iflogger.setLevel(oldlevel)
     # retrieve condor clusterid
     taskid = int(result.runtime.stdout.split(' ')[2])
     self._pending[taskid] = node.output_dir()
     logger.debug('submitted condor cluster: %d for node %s' % (taskid,
                                                                node._id))
     return taskid
开发者ID:vsaase,项目名称:nipype,代码行数:57,代码来源:condor.py


示例15: tar_cmd

def tar_cmd(infile):
    """ given a ipped tar archive, untars"""
    cwd = os.getcwd()
    pth, nme = os.path.split(infile)
    os.chdir(pth)
    cl = CommandLine('tar xfvz %s'%(infile))
    cout = cl.run()
    os.chdir(cwd)
    return pth
开发者ID:cindeem,项目名称:PetProcessing,代码行数:9,代码来源:base_gui.py


示例16: unzip

def unzip(infile):
    gunzipfile, gz = os.path.splitext(infile)
    if not 'gz' in gz:
        #when running gunzip on file when
        return infile
    else:
       c3 = CommandLine('gunzip %s'%(infile))
       c3.run()
       return gunzipfile
开发者ID:jelman,项目名称:DST,代码行数:9,代码来源:generate_spm_subject_info.py


示例17: travel_depth

def travel_depth(command, surface_file, verbose=False):
    """
    Measure "travel depth" of each vertex in a surface mesh.
    (Calls Joachim Giard's C++ code)

    Parameters
    ----------
    command : string
        travel depth C++ executable command
    surface_file : string
        vtk file
    verbose : bool
        print statements?

    Returns
    -------
    depth_file: string
        vtk file with travel depth per vertex of mesh

    Examples
    --------
    >>> import os
    >>> import numpy as np
    >>> from mindboggle.shapes.surface_shapes import travel_depth
    >>> from mindboggle.mio.vtks import read_scalars
    >>> from mindboggle.mio.fetch_data import prep_tests
    >>> urls, fetch_data = prep_tests()
    >>> surface_file = fetch_data(urls['left_pial'], '', '.vtk')
    >>> verbose = False
    >>> ccode_path = os.environ['vtk_cpp_tools']
    >>> command = os.path.join(ccode_path, 'travel_depth', 'TravelDepthMain')
    >>> depth_file = travel_depth(command, surface_file, verbose)
    >>> scalars, name = read_scalars(depth_file)
    >>> print(np.array_str(np.array(scalars[0:8]), precision=5,
    ...     suppress_small=True))
    [ 0.02026  0.06009  0.12859  0.04564  0.00774  0.05284  0.05354  0.01316]

    """
    import os
    from nipype.interfaces.base import CommandLine

    basename = os.path.splitext(os.path.basename(surface_file))[0]
    depth_file = os.path.join(os.getcwd(), basename + '.travel_depth.vtk')
    args = ' '.join([surface_file, depth_file])

    if verbose:
        print("{0} {1}".format(command, args))

    cli = CommandLine(command=command)
    cli.inputs.args = args
    cli.cmdline
    cli.run()

    if not os.path.exists(depth_file):
        raise IOError(depth_file + " not found")

    return depth_file
开发者ID:liob,项目名称:mindboggle,代码行数:57,代码来源:surface_shapes.py


示例18: gznii2nii

def gznii2nii(in_file):
    import os
    import shutil

    fileName, fileExtension = os.path.splitext(in_file)
    cmd = CommandLine('gunzip -f -k %s.nii.gz' % (fileName))
    print "gunzip NII.GZ:" + cmd.cmd
    cmd.run()
    return os.path.abspath('%s.nii' % (fileName))
开发者ID:haanme,项目名称:FinnBrain,代码行数:9,代码来源:conversions.py


示例19: travel_depth

def travel_depth(command, surface_file, verbose=False):
    """
    Measure "travel depth" of each vertex in a surface mesh.
    (Calls Joachim Giard's C++ code)

    Parameters
    ----------
    command : string
        travel depth C++ executable command
    surface_file : string
        vtk file
    verbose : bool
        print statements?

    Returns
    -------
    depth_file: string
        vtk file with travel depth per vertex of mesh

    Examples
    --------
    >>> import os
    >>> import numpy as np
    >>> from mindboggle.shapes.surface_shapes import travel_depth
    >>> from mindboggle.mio.vtks import read_scalars
    >>> from mindboggle.mio.fetch_data import prep_tests
    >>> urls, fetch_data = prep_tests()
    >>> surface_file = fetch_data(urls['left_pial'], '', '.vtk')
    >>> verbose = False
    >>> ccode_path = os.environ['vtk_cpp_tools']
    >>> command = os.path.join(ccode_path, 'travel_depth', 'TravelDepthMain')
    >>> depth_file = travel_depth(command, surface_file, verbose)
    >>> scalars, name = read_scalars(depth_file)
    >>> np.allclose(scalars[0:8], [0.020259869839, 0.06009166489, 0.12858575442, 0.045639221313, 0.007742772964, 0.052839111255, 0.053538904296, 0.013158746337])
    True

    """
    import os
    from nipype.interfaces.base import CommandLine

    basename = os.path.splitext(os.path.basename(surface_file))[0]
    depth_file = os.path.join(os.getcwd(), basename + '.travel_depth.vtk')
    args = ' '.join([surface_file, depth_file])

    if verbose:
        print("{0} {1}".format(command, args))

    cli = CommandLine(command=command)
    cli.inputs.args = args
    cli.terminal_output = 'file'
    cli.run()

    if not os.path.exists(depth_file):
        raise IOError(depth_file + " not found")

    return depth_file
开发者ID:binarybottle,项目名称:mindboggle,代码行数:56,代码来源:surface_shapes.py


示例20: nii2nrrd

def nii2nrrd(filename_nii, filename_bval, filename_bvec, out_prefix, out_suffix):
    import os
    import shutil

    from nipype.interfaces.base import CommandLine
    basename = experiment_dir + os.sep + out_prefix + os.sep + out_prefix + out_suffix
    cmd = CommandLine('./DWIConvert --inputVolume %s --outputVolume %s.nrrd --conversionMode FSLToNrrd --inputBValues %s --inputBVectors %s' % (filename_nii, basename, filename_bval, filename_bvec))
    print "NII->NRRD:" + cmd.cmd
    cmd.run()
    return os.path.abspath('%s.nrrd' % (basename))
开发者ID:haanme,项目名称:FinnBrain,代码行数:10,代码来源:conversions.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python fsl.Info类代码示例发布时间:2022-05-27
下一篇:
Python base.isdefined函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap