本文整理汇总了Python中msct_parser.Parser.add_option方法的典型用法代码示例。如果您正苦于以下问题:Python Parser.add_option方法的具体用法?Python Parser.add_option怎么用?Python Parser.add_option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msct_parser.Parser
的用法示例。
在下文中一共展示了Parser.add_option方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_parser
# 需要导入模块: from msct_parser import Parser [as 别名]
# 或者: from msct_parser.Parser import add_option [as 别名]
def get_parser():
# parser initialisation
parser = Parser(__file__)
parser.usage.set_description('''This program automatically detect the spinal cord in a MR image and output a centerline of the spinal cord.''')
parser.add_option(name="-i",
type_value="file",
description="input image.",
mandatory=True,
example="t2.nii.gz")
parser.add_option(name="-seg",
type_value="file",
description="Segmentation or centerline of the spinal cord.",
mandatory=True,
example="t2_seg.nii.gz")
parser.add_option(name="-t",
type_value="multiple_choice",
description="Image contrast: t2: cord dark / CSF bright ; t1: cord bright / CSF dark",
mandatory=True,
example=["t1", "t2"])
# parser.add_option(name="-seg",
# type_value="file",
# description="input image.",
# mandatory=True,
# example="segmentation.nii.gz")
parser.add_option(name="-v",
type_value="multiple_choice",
description="""Verbose. 0: nothing. 1: basic. 2: extended.""",
mandatory=False,
default_value=param.verbose,
example=['0', '1', '2'])
parser.add_option(name="-h",
type_value=None,
description="display this help",
mandatory=False)
return parser
示例2: get_parser
# 需要导入模块: from msct_parser import Parser [as 别名]
# 或者: from msct_parser.Parser import add_option [as 别名]
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
示例3: get_parser
# 需要导入模块: from msct_parser import Parser [as 别名]
# 或者: from msct_parser.Parser import add_option [as 别名]
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
示例4: get_parser
# 需要导入模块: from msct_parser import Parser [as 别名]
# 或者: from msct_parser.Parser import add_option [as 别名]
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
示例5: get_parser
# 需要导入模块: from msct_parser import Parser [as 别名]
# 或者: from msct_parser.Parser import add_option [as 别名]
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
示例6: get_parser
# 需要导入模块: from msct_parser import Parser [as 别名]
# 或者: from msct_parser.Parser import add_option [as 别名]
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
示例7: get_parser
# 需要导入模块: from msct_parser import Parser [as 别名]
# 或者: from msct_parser.Parser import add_option [as 别名]
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
示例8: get_parser
# 需要导入模块: from msct_parser import Parser [as 别名]
# 或者: from msct_parser.Parser import add_option [as 别名]
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
示例9: get_data_or_scalar
# 需要导入模块: from msct_parser import Parser [as 别名]
# 或者: from msct_parser.Parser import add_option [as 别名]
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
示例10: get_parser
# 需要导入模块: from msct_parser import Parser [as 别名]
# 或者: from msct_parser.Parser import add_option [as 别名]
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
示例11: get_parser
# 需要导入模块: from msct_parser import Parser [as 别名]
# 或者: from msct_parser.Parser import add_option [as 别名]
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
示例12: get_parser
# 需要导入模块: from msct_parser import Parser [as 别名]
# 或者: from msct_parser.Parser import add_option [as 别名]
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
示例13: get_parser
# 需要导入模块: from msct_parser import Parser [as 别名]
# 或者: from msct_parser.Parser import add_option [as 别名]
def get_parser():
# Initialize parser
parser = Parser(__file__)
# Mandatory arguments
parser.usage.set_description("")
parser.add_option(name="-f",
type_value="str",
description="Function to test.",
mandatory=True,
example="sct_propseg")
parser.add_option(name="-d",
type_value="folder",
description="Dataset directory.",
mandatory=True,
example="dataset_full/")
parser.add_option(name="-p",
type_value="str",
description="Arguments to pass to the function that is tested. Please put double-quotes if there are spaces in the list of parameters.\n"
"Image paths must be contains in the arguments list.",
mandatory=False)
parser.add_option(name="-cpu-nb",
type_value="int",
description="Number of CPU used for testing. 0: no multiprocessing. If not provided, "
"it uses all the available cores.",
mandatory=False,
default_value=0,
example='42')
parser.add_option(name="-v",
type_value="multiple_choice",
description="Verbose. 0: nothing, 1: basic, 2: extended.",
mandatory=False,
example=['0', '1', '2'],
default_value='1')
return parser
示例14: get_parser
# 需要导入模块: from msct_parser import Parser [as 别名]
# 或者: from msct_parser.Parser import add_option [as 别名]
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
示例15: get_parser
# 需要导入模块: from msct_parser import Parser [as 别名]
# 或者: from msct_parser.Parser import add_option [as 别名]
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