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

Python msct_parser.Parser类代码示例

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

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



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

示例1: get_parser

def get_parser():
    # parser initialisation
    parser = Parser(__file__)

    # # initialize parameters
    # param = Param()
    # param_default = Param()

    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description('Transpose bvecs file (if necessary) to get nx3 structure.')
    parser.add_option(name='-bvec',
                      type_value='file',
                      description='Input bvecs file.',
                      mandatory=True,
                      example='bvecs.txt')
    parser.add_option(name='-i',
                      type_value='file',
                      description='Input bvecs file.',
                      mandatory=False,
                      example='bvecs.txt',
                      deprecated_by='-bvec')
    parser.add_option(name='-o',
                      type_value='file_output',
                      description='Output bvecs file. By default input file is overwritten.',
                      mandatory=False,
                      example='bvecs_t.txt')
    parser.add_option(name='-v',
                      type_value='multiple_choice',
                      description="""Verbose. 0: nothing. 1: basic. 2: extended.""",
                      mandatory=False,
                      default_value='1',
                      example=['0', '1', '2'])
    return parser
开发者ID:poquirion,项目名称:spinalcordtoolbox,代码行数:34,代码来源:sct_dmri_transpose_bvecs.py


示例2: get_parser

def get_parser():
    param_default = Param()
    parser = Parser(__file__)
    parser.usage.set_description("""Flatten the spinal cord such within the medial sagittal plane. Useful to make nice 
    pictures. Output data has suffix _flatten. Output type is float32 (regardless of input type) to minimize loss of 
    precision during conversion.""")
    parser.add_option(name='-i',
                      type_value='image_nifti',
                      description='Input volume.',
                      mandatory=True,
                      example='t2.nii.gz')
    parser.add_option(name='-s',
                      type_value='image_nifti',
                      description='Spinal cord segmentation or centerline.',
                      mandatory=True,
                      example='t2_seg.nii.gz')
    parser.add_option(name='-v',
                      type_value='multiple_choice',
                      description='0: no verbose (default), 1: min verbose, 2: verbose + figures',
                      mandatory=False,
                      example=['0', '1', '2'],
                      default_value=str(param_default.verbose))
    parser.add_option(name='-h',
                      type_value=None,
                      description='Display this help',
                      mandatory=False)

    return parser
开发者ID:neuropoly,项目名称:spinalcordtoolbox,代码行数:28,代码来源:sct_flatten_sagittal.py


示例3: get_parser

def get_parser():
    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description('Concatenate transformations. This function is a wrapper for isct_ComposeMultiTransform (ANTs). N.B. Order of input warping fields is important. For example, if you want to concatenate: A->B and B->C to yield A->C, then you have to input warping fields like that: A->B,B->C.')
    parser.add_option(name="-d",
                      type_value="file",
                      description="Destination image.",
                      mandatory=True,
                      example='mt.nii.gz')
    parser.add_option(name="-w",
                      type_value=[[','], 'file'],
                      description='List of affine matrix or warping fields separated with "," N.B. if you want to use the inverse matrix, add "-" before matrix file name.',
                      mandatory=True,
                      example='warp_template2anat.nii.gz,warp_anat2mt.nii.gz')
    parser.add_option(name="-o",
                      type_value="file_output",
                      description='Name of output warping field.',
                      mandatory=False,
                      example='warp_template2mt.nii.gz')
    parser.add_option(name="-v",
                      type_value='multiple_choice',
                      description="verbose: 0 = nothing, 1 = classic, 2 = expended",
                      mandatory=False,
                      example=['0', '1', '2'],
                      default_value='1')

    return parser
开发者ID:poquirion,项目名称:spinalcordtoolbox,代码行数:27,代码来源:sct_concat_transfo.py


示例4: get_parser

def get_parser():
    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description(
        "Concatenate transformations. This function is a wrapper for isct_ComposeMultiTransform (ANTs). N.B. Order of input warping fields is important. For example, if you want to concatenate: A->B and B->C to yield A->C, then you have to input warping fields like that: A->B,B->C."
    )
    parser.add_option(
        name="-d", type_value="file", description="Destination image.", mandatory=True, example="mt.nii.gz"
    )
    parser.add_option(
        name="-w",
        type_value=[[","], "file"],
        description='List of affine matrix or warping fields separated with "," N.B. if you want to use the inverse matrix, add "-" before matrix file name. N.B. You should NOT use "-" with warping fields (only with matrices). If you want to use an inverse warping field, then input it directly (e.g., warp_template2anat.nii.gz instead of warp_anat2template.nii.gz) ',
        mandatory=True,
        example="warp_template2anat.nii.gz,warp_anat2mt.nii.gz",
    )
    parser.add_option(
        name="-o",
        type_value="file_output",
        description="Name of output warping field.",
        mandatory=False,
        example="warp_template2mt.nii.gz",
    )
    parser.add_option(
        name="-v",
        type_value="multiple_choice",
        description="verbose: 0 = nothing, 1 = classic, 2 = expended",
        mandatory=False,
        example=["0", "1", "2"],
        default_value="1",
    )

    return parser
开发者ID:neuropoly,项目名称:spinalcordtoolbox,代码行数:33,代码来源:sct_concat_transfo.py


示例5: get_parser

def get_parser():

    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description('Display scatter plot of gradient directions from bvecs file.')
    parser.add_option(name='-bvec',
                      type_value='file',
                      description='bvecs file.',
                      mandatory=True,
                      example='bvecs.txt')
    return parser
开发者ID:neuropoly,项目名称:spinalcordtoolbox,代码行数:11,代码来源:sct_dmri_display_bvecs.py


示例6: get_parser

def get_parser():
    # Initialize parser
    parser = Parser(__file__)

    # Mandatory arguments
    parser.usage.set_description("")

    parser.add_option(name="-a",
                      type_value=None,
                      description="If provided, compile with sudo.",
                      mandatory=False)

    return parser
开发者ID:poquirion,项目名称:spinalcordtoolbox,代码行数:13,代码来源:install_external.py


示例7: get_parser

def get_parser():
    # parser initialisation
    parser = Parser(__file__)

    # initialize parameters
    param = Param()
    param_default = Param()

    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description('Split data. By default, output files will have suffix "_0000", "_0002", etc.')
    parser.add_option(name="-i",
                      type_value="file",
                      description="Input file.",
                      mandatory=True,
                      example="data.nii.gz")
    parser.add_option(name="-dim",
                      type_value="multiple_choice",
                      description="""Dimension for split.""",
                      mandatory=False,
                      default_value='t',
                      example=['x', 'y', 'z', 't'])
    parser.add_option(name="-suffix",
                      type_value="str",
                      description="""Output suffix.""",
                      mandatory=False,
                      default_value='_',
                      example='_')
    return parser
开发者ID:H-Snoussi,项目名称:spinalcordtoolbox,代码行数:29,代码来源:sct_split_data.py


示例8: get_parser

def get_parser():
    # parser initialisation
    parser = Parser(__file__)

    # # initialize parameters
    # param = Param()
    # param_default = Param()

    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description('Transpose bvecs file (if necessary) to get nx3 structure.')
    parser.add_option(name="-i",
                      type_value="file",
                      description="Input bvecs file.",
                      mandatory=True,
                      example="bvecs.txt")
    parser.add_option(name="-o",
                      type_value="file_output",
                      description="Output bvecs file. By default input file is overwritten.",
                      mandatory=False,
                      example="bvecs_t.txt")
    parser.add_option(name="-v",
                      type_value="multiple_choice",
                      description="""Verbose. 0: nothing. 1: basic. 2: extended.""",
                      mandatory=False,
                      default_value='1',
                      example=['0', '1', '2'])
    return parser
开发者ID:neuromandaqui,项目名称:spinalcordtoolbox,代码行数:28,代码来源:sct_dmri_transpose_bvecs.py


示例9: get_parser

def get_parser():
    # parser initialisation
    parser = Parser(__file__)

    # initialize parameters
    param = Param()
    param_default = Param()

    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description('Concatenate data.')
    parser.add_option(name="-i",
                      type_value=[[','], "file"],
                      description='Multiple files separated with ",".',
                      mandatory=True,
                      example="data1.nii.gz,data2.nii.gz")
    parser.add_option(name="-o",
                      type_value="file_output",
                      description="Output file",
                      mandatory=True,
                      example=['data_concat.nii.gz'])
    parser.add_option(name="-dim",
                      type_value="multiple_choice",
                      description="""Dimension for concatenation.""",
                      mandatory=True,
                      example=['x', 'y', 'z', 't'])
    return parser
开发者ID:H-Snoussi,项目名称:spinalcordtoolbox,代码行数:27,代码来源:sct_concat_data.py


示例10: get_parser

def get_parser():

    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description('Concatenate bvec files in time. You can either use bvecs in lines or columns.\nN.B.: Return bvecs in lines. If you need it in columns, please use sct_dmri_transpose_bvecs afterwards.')
    parser.add_option(name="-i",
                      type_value=[[','], 'file'],
                      description="List of the bvec files to concatenate.",
                      mandatory=True,
                      example="dmri_b700.bvec,dmri_b2000.bvec")
    parser.add_option(name="-o",
                      type_value="file_output",
                      description='Output file with bvecs concatenated.',
                      mandatory=False,
                      example='dmri_b700_b2000_concat.bvec')
    return parser
开发者ID:neuropoly,项目名称:spinalcordtoolbox,代码行数:16,代码来源:sct_dmri_concat_bvecs.py


示例11: get_data_or_scalar

def get_data_or_scalar(argument, data_in):
    """
    Get data from list of file names (scenario 1) or scalar (scenario 2)
    :param argument: list of file names of scalar
    :param data_in: if argument is scalar, use data to get shape
    :return: 3d or 4d numpy array
    """
    if argument.replace('.', '').isdigit():  # so that it recognize float as digits too
        # build data2 with same shape as data
        data_out = data_in[:, :, :] * 0 + float(argument)
    else:
        # parse file name and check integrity
        parser2 = Parser(__file__)
        parser2.add_option(name='-i', type_value=[[','], 'file'])
        list_fname = parser2.parse(['-i', argument]).get('-i')
        data_out = get_data(list_fname)
    return data_out
开发者ID:poquirion,项目名称:spinalcordtoolbox,代码行数:17,代码来源:sct_maths.py


示例12: get_parser

def get_parser():
    # Initialize parser
    parser = Parser(__file__)

    # Mandatory arguments
    parser.usage.set_description("")
    parser.add_option(name="-f",
                      type_value="multiple_choice",
                      description="Library to compile.",
                      mandatory=False,
                      example=['dipy', 'denoise'])

    parser.add_option(name="-a",
                      type_value=None,
                      description="If provided, compile with sudo.",
                      mandatory=False)

    return parser
开发者ID:neuropoly,项目名称:spinalcordtoolbox,代码行数:18,代码来源:compile_external.py


示例13: get_parser

def get_parser():
    parser = Parser(__file__)
    parser.usage.set_description('''Download binaries from the web.''')
    parser.add_option(
        name="-d",
        type_value="multiple_choice",
        description="Name of the dataset.",
        mandatory=True,
        example=[
            'sct_example_data',
            'sct_testing_data',
            'course_hawaii17',
            'course_paris18', 
            'course_london19', 
            'PAM50',
            'MNI-Poly-AMU',
            'gm_model',
            'optic_models',
            'pmj_models',
            'binaries_debian',
            'binaries_centos',
            'binaries_osx', 
            'deepseg_gm_models',
            'deepseg_sc_models',
            'deepseg_lesion_models',
            'c2c3_disc_models'
        ])
    parser.add_option(
        name="-v",
        type_value="multiple_choice",
        description="Verbose. 0: nothing. 1: basic. 2: extended.",
        mandatory=False,
        default_value=1,
        example=['0', '1', '2'])
    parser.add_option(
        name="-o",
        type_value="folder_creation",
        description="path to save the downloaded data",
        mandatory=False)
    parser.add_option(
        name="-h",
        type_value=None,
        description="Display this help",
        mandatory=False)
    return parser
开发者ID:neuropoly,项目名称:spinalcordtoolbox,代码行数:45,代码来源:sct_download_data.py


示例14: get_parser

def get_parser():
    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description('Check the installation and environment variables of the toolbox and its dependences.')
    parser.add_option(name="-c",
                      description="Complete test.",
                      mandatory=False)
    parser.add_option(name="-log",
                      description="Generate log file.",
                      mandatory=False)
    parser.add_option(name="-l",
                      type_value=None,
                      description="Generate log file.",
                      deprecated_by="-log",
                      mandatory=False)
    return parser
开发者ID:poquirion,项目名称:spinalcordtoolbox,代码行数:16,代码来源:sct_check_dependences.py


示例15: get_parser

def get_parser():
    # parser initialisation
    parser = Parser(__file__)
    parser.usage.set_description('Compute Maximum Spinal Cord Compression (MSCC) as in: Miyanji F, Furlan JC, Aarabi B, Arnold PM, Fehlings MG. Acute cervical traumatic spinal cord injury: MR imaging findings correlated with neurologic outcome--prospective study with 100 consecutive patients. Radiology 2007;243(3):820-827.')
    parser.add_option(name='-di',
                      type_value='float',
                      description='Anteroposterior cord distance at the level of maximum injury',
                      mandatory=True,
                      example=6.85)
    parser.add_option(name='-da',
                      type_value='float',
                      description='Anteroposterior cord distance at the nearest normal level above the level of injury',
                      mandatory=True,
                      example=7.65)
    parser.add_option(name='-db',
                      type_value='float',
                      description='Anteroposterior cord distance at the nearest normal level below the level of injury',
                      mandatory=True,
                      example=7.02)
    parser.add_option(name="-h",
                      type_value=None,
                      description="Display this help",
                      mandatory=False)
    return parser
开发者ID:poquirion,项目名称:spinalcordtoolbox,代码行数:24,代码来源:sct_compute_mscc.py


示例16: get_parser

def get_parser():
    # parser initialisation
    parser = Parser(__file__)
    parser.usage.set_description('''Download dataset from the web.''')
    parser.add_option(name="-d",
                      type_value="multiple_choice",
                      description="Name of the dataset.",
                      mandatory=True,
                      example=['sct_example_data', 'sct_testing_data', 'PAM50'])
    parser.add_option(name="-v",
                      type_value="multiple_choice",
                      description="""Verbose. 0: nothing. 1: basic. 2: extended.""",
                      mandatory=False,
                      example=['0', '1', '2'])
    parser.add_option(name="-h",
                      type_value=None,
                      description="Display this help",
                      mandatory=False)
    return parser
开发者ID:poquirion,项目名称:spinalcordtoolbox,代码行数:19,代码来源:sct_download_data.py


示例17: get_parser

def get_parser():
    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description('Calculate b-value (in mm^2/s).')
    parser.add_option(name="-g",
                      type_value="float",
                      description="Amplitude of diffusion gradients (in mT/m)",
                      mandatory=True,
                      example='40')
    parser.add_option(name="-b",
                      type_value="float",
                      description="Big delta: time between both diffusion gradients (in ms)",
                      mandatory=True,
                      example='40')
    parser.add_option(name="-d",
                      type_value="float",
                      description="Small delta: duration of each diffusion gradient (in ms)",
                      mandatory=True,
                      example='30')

    return parser
开发者ID:neuropoly,项目名称:spinalcordtoolbox,代码行数:21,代码来源:sct_dmri_compute_bvalue.py


示例18: get_parser

def get_parser():
    # parser initialisation
    parser = Parser(__file__)

    # initialize parameters
    param = Param()
    param_default = Param()

    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description('Convert image file to another type.')
    parser.add_option(name="-i",
                      type_value="file",
                      description="File input",
                      mandatory=True,
                      example='data.nii.gz')
    parser.add_option(name="-o",
                      type_value="file_output",
                      description="File output (indicate new extension)",
                      mandatory=True,
                      example=['data.nii'])
    return parser
开发者ID:poquirion,项目名称:spinalcordtoolbox,代码行数:22,代码来源:sct_convert.py


示例19: get_parser

def get_parser():
    # parser initialisation
    parser = Parser(__file__)

    # initialize parameters
    param = Param()
    param_default = Param()

    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description('Copy NIFTI header from source to destination.')
    parser.add_option(name="-i",
                      type_value="file",
                      description="Source file.",
                      mandatory=True,
                      example="src.nii.gz")
    parser.add_option(name="-d",
                      type_value="file",
                      description="Destination file.",
                      mandatory=True,
                      example='dest.nii.gz')
    return parser
开发者ID:neuromandaqui,项目名称:spinalcordtoolbox,代码行数:22,代码来源:sct_copy_header.py


示例20: get_parser

def get_parser():
    # Initialize the parser
    parser = Parser(__file__)

    # initialize default parameters
    param_default = Param()

    parser.usage.set_description('Smooth the spinal cord along its centerline. Steps are:\n'
                                 '1) Spinal cord is straightened (using centerline),\n'
                                 '2) a Gaussian kernel is applied in the superior-inferior direction,\n'
                                 '3) then cord is de-straightened as originally.\n')
    parser.add_option(name="-i",
                      type_value="file",
                      description="Image to smooth",
                      mandatory=True,
                      example='data.nii.gz')
    parser.add_option(name="-s",
                      type_value="file",
                      description="Spinal cord centerline or segmentation",
                      mandatory=True,
                      example='data_centerline.nii.gz')
    parser.add_option(name="-c",
                      type_value=None,
                      description="Spinal cord centerline or segmentation",
                      mandatory=False,
                      deprecated_by='-s')
    parser.add_option(name="-smooth",
                      type_value=[[','], 'float'],
                      description='Sigma (standard deviation) of the smoothing Gaussian kernel (in mm). For isotropic '
                                  'smoothing you only need to specify a value (e.g. 2). For anisotropic smoothing '
                                  'specify a value for each axis, separated with a comma. The order should follow axes '
                                  'Right-Left, Antero-Posterior, Superior-Inferior (e.g.: 1,1,3). For no smoothing, set '
                                  'value to 0.',
                      mandatory=False,
                      default_value=[0, 0, 3])
    parser.add_option(name='-param',
                      type_value=[[','], 'str'],
                      description="Advanced parameters. Assign value with \"=\"; Separate params with \",\"\n"
                                  "algo_fitting {bspline, polyfit}: Algorithm for curve fitting. For more information, see sct_straighten_spinalcord. Default="+ param_default.algo_fitting + ".\n",
                      mandatory=False)
    parser.usage.addSection('MISC')
    parser.add_option(name="-r",
                      type_value="multiple_choice",
                      description='Remove temporary files.',
                      mandatory=False,
                      default_value='1',
                      example=['0', '1'])
    parser.add_option(name="-v",
                      type_value='multiple_choice',
                      description="verbose: 0 = nothing, 1 = classic, 2 = expended",
                      mandatory=False,
                      example=['0', '1', '2'],
                      default_value='1')
    return parser
开发者ID:neuropoly,项目名称:spinalcordtoolbox,代码行数:54,代码来源:sct_smooth_spinalcord.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python msg.common_debug函数代码示例发布时间:2022-05-27
下一篇:
Python msct_image.Image类代码示例发布时间: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