def get_parser(dict_url):
    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=sorted(dict_url))
    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 where to save the downloaded data"
         " (defaults to ./${dataset-name})."
         " Directory will be created."
         " Warning: existing data in the directory will be erased unless -k is provided."
         ),
        mandatory=False)
    parser.add_option(name="-h",
                      type_value=None,
                      description="Display this help",
                      mandatory=False)
    parser.add_option(
        name="-k",
        type_value=None,
        description="Keep existing data in destination directory",
        mandatory=False)
    return parser
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
Beispiel #3
0
def get_parser():
    parser = Parser(__file__)
    parser.usage.set_description('Quality Control Viewer')
    parser.add_option(name='-folder',
                      type_value='folder',
                      mandatory=True,
                      description='The root folder of the generated QC data')

    return 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
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
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
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
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
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
Beispiel #10
0
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', 'PAM50', 'MNI-Poly-AMU',
            'gm_model', 'optic_models', 'binaries_debian', 'binaries_centos', 'binaries_osx', 'course_hawaii17'
        ])
    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
Beispiel #11
0
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
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
def get_parser():
    """
    :return: Returns the parser with the command line documentation contained in it.
    """
    #param = Param()

    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description(
        '''Identification and estimation of noise in the diffusion signal, implemented by the Dipy software project (http://nipy.org/dipy/), based on the PIESNO method: Koay C.G., E. Ozarslan, C. Pierpaoli. Probabilistic Identification and Estimation of Noise (PIESNO): A self-consistent approach and its applications in MRI. JMR, 199(1):94-103, 2009.'''
    )
    parser.add_option(name='-i',
                      type_value='file',
                      description='Input file',
                      mandatory=True,
                      example='data_highQ.nii')
    parser.add_option(
        name='-dof',
        type_value='int',
        description=
        'Degree of freedom of the noise distribution. Corresponds to the number of antenna for an acquisition without parallel imaging with sum of squares combination. Otherwise, dof is close to 1.',
        mandatory=False,
        default_value='1',
        example='1')
    parser.add_option(name="-o",
                      type_value='file_output',
                      description='Output file.',
                      mandatory=False,
                      example='noise_mask.nii.gz')
    parser.add_option(name='-h',
                      type_value=None,
                      description='Display this help.',
                      mandatory=False)
    return 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
Beispiel #15
0
def get_parser():

    """
    :return: Returns the parser with the command line documentation contained in it.
    """
    #param = Param()

    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description('''Identification and estimation of noise in the diffusion signal, implemented by the Dipy software project (http://nipy.org/dipy/), based on the PIESNO method: Koay C.G., E. Ozarslan, C. Pierpaoli. Probabilistic Identification and Estimation of Noise (PIESNO): A self-consistent approach and its applications in MRI. JMR, 199(1):94-103, 2009.''')
    parser.add_option(name='-i',
                      type_value='file',
                      description='Input file',
                      mandatory=True,
                      example='data_highQ.nii')
    parser.add_option(name='-dof',
                      type_value='int',
                      description='Degree of freedom of the noise distribution. Corresponds to the number of antenna for an acquisition without parallel imaging with sum of squares combination. Otherwise, dof is close to 1.',
                      mandatory=False,
                      default_value='1',
                      example='1')
    parser.add_option(name="-o",
                      type_value='file_output',
                      description='Output file.',
                      mandatory=False,
                      example='noise_mask.nii.gz')
    parser.add_option(name='-h',
                      type_value=None,
                      description='Display this help.',
                      mandatory=False)
    return parser
Beispiel #16
0
 def get_parser():
     # Initialize the parser
     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="-t",
                       type_value="multiple_choice",
                       description="type of image contrast, t2: cord dark / CSF bright ; t1: cord bright / CSF dark",
                       mandatory=True,
                       example=['t1', 't2'])
     parser.usage.addSection("General options")
     parser.add_option(name="-v",
                       type_value="multiple_choice",
                       description="1: display on, 0: display off (default)",
                       mandatory=False,
                       example=["0", "1"],
                       default_value="1")
     parser.add_option(name="-h",
                       type_value=None,
                       description="display this help",
                       mandatory=False)
     return 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
Beispiel #18
0
def get_parser():
    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description('Crash and integrity testing for functions of the Spinal Cord Toolbox. Internet connection is required for downloading testing data.')
    parser.add_option(name="-f",
                      type_value="str",
                      description="Test this specific script (do not add extension).",
                      mandatory=False,
                      example='sct_propseg')
    parser.add_option(name="-d",
                      type_value="multiple_choice",
                      description="Download testing data.",
                      mandatory=False,
                      default_value=param.download,
                      example=['0', '1'])
    parser.add_option(name="-p",
                      type_value="folder",
                      description='Path to testing data. NB: no need to set if using "-d 1"',
                      mandatory=False,
                      default_value=param.path_data)
    parser.add_option(name="-r",
                      type_value="multiple_choice",
                      description='Remove temporary files.',
                      mandatory=False,
                      default_value='1',
                      example=['0', '1'])
    return parser
def get_parser():
    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description(
        'Crash and integrity testing for functions of the Spinal Cord Toolbox. Internet connection is required for downloading testing data.'
    )
    parser.add_option(
        name="-f",
        type_value="str",
        description="Test this specific script (do not add extension).",
        mandatory=False,
        example='sct_propseg')
    parser.add_option(name="-d",
                      type_value="multiple_choice",
                      description="Download testing data.",
                      mandatory=False,
                      default_value=param.download,
                      example=['0', '1'])
    parser.add_option(
        name="-p",
        type_value="folder",
        description='Path to testing data. NB: no need to set if using "-d 1"',
        mandatory=False,
        default_value=param.path_data)
    parser.add_option(name="-r",
                      type_value="multiple_choice",
                      description='Remove temporary files.',
                      mandatory=False,
                      default_value='1',
                      example=['0', '1'])
    return parser
Beispiel #20
0
def get_parser():
    parser = Parser(__file__)
    parser.usage.set_description('Compute temporal SNR (tSNR) in fMRI time series.')
    parser.add_option(name='-i',
                      type_value='file',
                      description='fMRI data',
                      mandatory=True,
                      example='fmri.nii.gz')
    parser.add_option(name='-v',
                      type_value='multiple_choice',
                      description='verbose',
                      mandatory=False,
                      example=['0', '1'])
    return parser
def get_parser():

    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description('Concatenate bval files in time.')
    parser.add_option(name="-i",
                      type_value=[[','], 'file'],
                      description="List of the bval files to concatenate.",
                      mandatory=True,
                      example="dmri_b700.bval,dmri_b2000.bval")
    parser.add_option(name="-o",
                      type_value="file_output",
                      description='Output file with bvals merged.',
                      mandatory=False,
                      example='dmri_b700_b2000_concat.bval')
    return parser
def get_parser():

    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description('Concatenate bval files in time.')
    parser.add_option(name="-i",
                      type_value=[[','], 'file'],
                      description="List of the bval files to concatenate.",
                      mandatory=True,
                      example="dmri_b700.bval,dmri_b2000.bval")
    parser.add_option(name="-o",
                      type_value="file_output",
                      description='Output file with bvals merged.',
                      mandatory=False,
                      example='dmri_b700_b2000_concat.bval')
    return 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
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
Beispiel #25
0
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
Beispiel #26
0
def get_parser():
    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description('This function inverts the image intensity using the maximum intensity in the image and 0.')
    parser.add_option(name="-i",
                      type_value="file",
                      description="Image to invert.",
                      mandatory=True,
                      example="my_image.nii.gz")

    parser.add_option(name="-o",
                      type_value="file_output",
                      description="output image.",
                      mandatory=False,
                      example="output_image.nii.gz",
                      default_value="inverted_image.nii.gz")

    return 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
Beispiel #28
0
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 np.shape
    :return: 3d or 4d numpy array
    """
    # try to convert argument in float
    try:
        # build data2 with same shape as data
        data_out = data_in[:, :, :] * 0 + float(argument)
    # if conversion fails, it should be a file
    except:
        # 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
Beispiel #29
0
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 np.shape
    :return: 3d or 4d numpy array
    """
    # try to convert argument in float
    try:
        # build data2 with same shape as data
        data_out = data_in[:, :, :] * 0 + float(argument)
    # if conversion fails, it should be a file
    except:
        # 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
Beispiel #30
0
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
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
Beispiel #32
0
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'])
    parser.add_option(name="-squeeze",
                      type_value='multiple_choice',
                      description='Sueeze data dimension (remove unused dimension).',
                      mandatory=False,
                      example=['0', '1'],
                      default_value='1')
    return 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
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
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
Beispiel #36
0
def get_parser():
    # parser initialisation
    parser = Parser(__file__)

    # 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'])
    parser.add_option(
        name="-squeeze",
        type_value='multiple_choice',
        description='Sueeze data dimension (remove unused dimension).',
        mandatory=False,
        example=['0', '1'],
        default_value='1')
    return 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
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
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('Threshold image using Otsu algorithm.')
    parser.add_option(name="-i",
                      type_value="file",
                      description="Input 4d file.",
                      mandatory=True,
                      example="dmri.nii.gz")
    parser.add_option(name="-bval",
                      type_value="file",
                      description="Bvals file.",
                      mandatory=True,
                      example="bvals.txt")
    parser.add_option(name="-bvec",
                      type_value="file",
                      description="Bvecs file.",
                      mandatory=True,
                      example="bvecs.txt")
    parser.add_option(name='-o',
                      type_value='str',
                      description='Output prefix.',
                      mandatory=False,
                      default_value='dti_')
    parser.add_option(
        name="-v",
        type_value="multiple_choice",
        description="""Verbose. 0: nothing. 1: basic. 2: extended.""",
        mandatory=False,
        default_value=str(param.verbose),
        example=['0', '1', '2'])
    return parser
Beispiel #40
0
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
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('Threshold image using Otsu algorithm.')
    parser.add_option(name="-i",
                      type_value="file",
                      description="Input 4d file.",
                      mandatory=True,
                      example="dmri.nii.gz")
    parser.add_option(name="-bval",
                      type_value="file",
                      description="Bvals file.",
                      mandatory=True,
                      example="bvals.txt")
    parser.add_option(name="-bvec",
                      type_value="file",
                      description="Bvecs file.",
                      mandatory=True,
                      example="bvecs.txt")
    parser.add_option(name='-o',
                      type_value='str',
                      description='Output prefix.',
                      mandatory=False,
                      default_value='dti_')
    parser.add_option(name="-v",
                      type_value="multiple_choice",
                      description="""Verbose. 0: nothing. 1: basic. 2: extended.""",
                      mandatory=False,
                      default_value=str(param.verbose),
                      example=['0', '1', '2'])
    return 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
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
Beispiel #44
0
def get_parser():
    parser = Parser(__file__)
    parser.usage.set_description('Volume Viewer')
    parser.add_option(name="-i",
                      type_value=[[','], 'file'],
                      description="Images to display.",
                      mandatory=True,
                      example="anat.nii.gz")

    parser.add_option(name='-mode',
                      type_value='multiple_choice',
                      description='Display mode.'
                                  '\nviewer: standard three-window viewer.'
                                  '\naxial: one-window viewer for manual centerline.\n',
                      mandatory=False,
                      default_value='viewer',
                      example=['viewer', 'axial'])

    parser.add_option(name='-param',
                      type_value=[[':'], 'str'],
                      description='Parameters for visualization. '
                                  'Separate images with \",\". Separate parameters with \":\".'
                                  '\nid: number of image in the "-i" list'
                                  '\ncmap: image colormap'
                                  '\ninterp: image interpolation. Accepts: [\'nearest\' | \'bilinear\' | \'bicubic\' | \'spline16\' | '
                                                                            '\'spline36\' | \'hanning\' | \'hamming\' | \'hermite\' | \'kaiser\' | '
                                                                            '\'quadric\' | \'catrom\' | \'gaussian\' | \'bessel\' | \'mitchell\' | '
                                                                            '\'sinc\' | \'lanczos\' | \'none\' |]'
                                  '\nvmin:'
                                  '\nvmax:'
                                  '\nvmean:'
                                  '\nperc: ',
                      mandatory=False,
                      example=['cmap=red:vmin=0:vmax=1', 'cmap=grey'])

    parser.add_option(name="-v",
                      type_value="multiple_choice",
                      description="""Verbose. 0: nothing. 1: basic. 2: extended.""",
                      mandatory=False,
                      default_value='0',
                      example=['0', '1', '2'])

    return 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
def get_parser():
    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description(
        'Check the installation and environment variables of the'
        ' toolbox and its dependencies.')
    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
Beispiel #47
0
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
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
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
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
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
def get_parser():
    """Initialize the parser."""
    parser = Parser(__file__)
    parser.usage.set_description(
        """MS lesion Segmentation using convolutional networks. \n\nReference: C Gros, B De Leener, et al. Automatic segmentation of the spinal cord and intramedullary multiple sclerosis lesions with convolutional neural networks (2018). arxiv.org/abs/1805.06349"""
    )

    parser.add_option(name="-i",
                      type_value="image_nifti",
                      description="input image.",
                      mandatory=True,
                      example="t1.nii.gz")
    parser.add_option(
        name="-c",
        type_value="multiple_choice",
        description=
        "type of image contrast. \nt2: T2w scan with isotropic or anisotropic resolution. \nt2_ax: T2w scan with axial orientation and thick slices. \nt2s: T2*w scan with axial orientation and thick slices.",
        mandatory=True,
        example=['t2', 't2_ax', 't2s'])
    parser.add_option(
        name="-centerline",
        type_value="multiple_choice",
        description=
        "Method used for extracting the centerline.\nsvm: automatic centerline detection, based on Support Vector Machine algorithm.\ncnn: automatic centerline detection, based on Convolutional Neural Network.\nviewer: semi-automatic centerline generation, based on manual selection of a few points using an interactive viewer, then approximation with NURBS.\nmanual: use an existing centerline by specifying its filename with flag -file_centerline (e.g. -file_centerline t2_centerline_manual.nii.gz).\n",
        mandatory=False,
        example=['svm', 'cnn', 'viewer', 'manual'],
        default_value="svm")
    parser.add_option(
        name="-file_centerline",
        type_value="image_nifti",
        description=
        "Input centerline file (to use with flag -centerline manual).",
        mandatory=False,
        example="t2_centerline_manual.nii.gz")
    parser.add_option(
        name="-brain",
        type_value="multiple_choice",
        description=
        "indicate if the input image is expected to contain brain sections:\n1: contains brain section\n0: no brain section.\nTo indicate this parameter could speed the segmentation process. Note that this flag is only effective with -centerline cnn.",
        mandatory=False,
        example=["0", "1"],
        default_value="1")
    parser.add_option(name="-ofolder",
                      type_value="folder_creation",
                      description="output folder.",
                      mandatory=False,
                      example="My_Output_Folder/",
                      default_value="")
    parser.add_option(name="-r",
                      type_value="multiple_choice",
                      description="remove temporary files.",
                      mandatory=False,
                      example=['0', '1'],
                      default_value='1')
    parser.add_option(name="-v",
                      type_value="multiple_choice",
                      description="1: display on, 0: display off (default)",
                      mandatory=False,
                      example=["0", "1"],
                      default_value="1")
    parser.add_option(name='-igt',
                      type_value='image_nifti',
                      description='File name of ground-truth segmentation.',
                      mandatory=False)
    return parser
Beispiel #53
0
def get_parser():
    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description('Create mask along z direction.')
    parser.add_option(
        name='-i',
        type_value='file',
        description=
        'Image to create mask on. Only used to get header. Must be 3D.',
        mandatory=True,
        example='data.nii.gz')
    parser.add_option(
        name='-p',
        type_value=[[','], 'str'],
        description='Process to generate mask.\n'
        'coord: X,Y coordinate of center of mask. E.g.: coord,20x15\n'
        'point: volume that contains a single point. E.g.: point,label.nii.gz\n'
        'center: mask is created at center of FOV.\n'
        'centerline: volume that contains centerline or segmentation. E.g.: centerline,t2_seg.nii.gz',
        mandatory=True,
        default_value=param_default.process,
        example=['centerline,data_centerline.nii.gz'])
    parser.add_option(
        name='-m',
        type_value=None,
        description='Process to generate mask and associated value.\n'
        '  coord: X,Y coordinate of center of mask. E.g.: coord,20x15'
        '  point: volume that contains a single point. E.g.: point,label.nii.gz'
        '  center: mask is created at center of FOV. In that case, "val" is not required.'
        '  centerline: volume that contains centerline. E.g.: centerline,my_centerline.nii',
        mandatory=False,
        deprecated_by='-p')
    parser.add_option(
        name='-size',
        type_value='str',
        description=
        'Size of the mask in the axial plane, given in pixel (ex: 35) or in millimeter (ex: 35mm). If shape=gaussian, size corresponds to "sigma"',
        mandatory=False,
        default_value=param_default.size,
        example=['45'])
    parser.add_option(
        name='-s',
        type_value=None,
        description=
        'Size in voxel. Odd values are better (for mask to be symmetrical). If shape=gaussian, size corresponds to "sigma"',
        mandatory=False,
        deprecated_by='-size')
    parser.add_option(name='-f',
                      type_value='multiple_choice',
                      description='Shape of the mask.',
                      mandatory=False,
                      default_value=param_default.shape,
                      example=param.shape_list)
    parser.add_option(name='-o',
                      type_value='file_output',
                      description='Name of output mask.',
                      mandatory=False,
                      example=['data.nii'])
    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
Beispiel #54
0
def get_parser(paramregmulti=None):
    # Initialize the parser

    if paramregmulti is None:
        step0 = Paramreg(step='0', type='im', algo='syn', metric='MI', iter='0', shrink='1', smooth='0', gradStep='0.5',
                         slicewise='0', dof='Tx_Ty_Tz_Rx_Ry_Rz')  # only used to put src into dest space
        step1 = Paramreg(step='1', type='im')
        paramregmulti = ParamregMultiStep([step0, step1])

    parser = Parser(__file__)
    parser.usage.set_description('This program co-registers two 3D volumes. The deformation is non-rigid and is '
                                 'constrained along Z direction (i.e., axial plane). Hence, this function assumes '
                                 'that orientation of the destination image is axial (RPI). If you need to register '
                                 'two volumes with large deformations and/or different contrasts, it is recommended to '
                                 'input spinal cord segmentations (binary mask) in order to achieve maximum robustness.'
                                 ' The program outputs a warping field that can be used to register other images to the'
                                 ' destination image. To apply the warping field to another image, use '
                                 'sct_apply_transfo')
    parser.add_option(name="-i",
                      type_value="file",
                      description="Image source.",
                      mandatory=True,
                      example="src.nii.gz")
    parser.add_option(name="-d",
                      type_value="file",
                      description="Image destination.",
                      mandatory=True,
                      example="dest.nii.gz")
    parser.add_option(name="-iseg",
                      type_value="file",
                      description="Segmentation source.",
                      mandatory=False,
                      example="src_seg.nii.gz")
    parser.add_option(name="-dseg",
                      type_value="file",
                      description="Segmentation destination.",
                      mandatory=False,
                      example="dest_seg.nii.gz")
    parser.add_option(name="-ilabel",
                      type_value="file",
                      description="Labels source.",
                      mandatory=False)
    parser.add_option(name="-dlabel",
                      type_value="file",
                      description="Labels destination.",
                      mandatory=False)
    parser.add_option(name='-initwarp',
                      type_value='file',
                      description='Initial warping field to apply to the source image.',
                      mandatory=False)
    parser.add_option(name='-initwarpinv',
                      type_value='file',
                      description='Initial inverse warping field to apply to the destination image (only use if you wish to generate the dest->src warping field).',
                      mandatory=False)
    parser.add_option(name="-m",
                      type_value="file",
                      description="Mask that can be created with sct_create_mask to improve accuracy over region of interest. "
                                  "This mask will be used on the destination image.",
                      mandatory=False,
                      example="mask.nii.gz")
    parser.add_option(name="-o",
                      type_value="file_output",
                      description="Name of output file.",
                      mandatory=False,
                      example="src_reg.nii.gz")
    parser.add_option(name='-owarp',
                      type_value="file_output",
                      description="Name of output forward warping field.",
                      mandatory=False)
    parser.add_option(name="-param",
                      type_value=[[':'], 'str'],
                      description="Parameters for registration. Separate arguments with \",\". Separate steps with \":\".\n"
                                  "step: <int> Step number (starts at 1, except for type=label).\n"
                                  "type: {im, seg, imseg, label} type of data used for registration. Use type=label only at step=0.\n"
                                  "algo: Default=" + paramregmulti.steps['1'].algo + "\n"
                                                                                "  translation: translation in X-Y plane (2dof)\n"
                                                                                "  rigid: translation + rotation in X-Y plane (4dof)\n"
                                                                                "  affine: translation + rotation + scaling in X-Y plane (6dof)\n"
                                                                                "  syn: non-linear symmetric normalization\n"
                                                                                "  bsplinesyn: syn regularized with b-splines\n"
                                                                                "  slicereg: regularized translations (see: goo.gl/Sj3ZeU)\n"
                                                                                "  centermass: slicewise center of mass alignment (seg only).\n"
                                                                                "  centermassrot: slicewise center of mass and rotation alignment using method specified in 'rot_method'\n"
                                                                                "  columnwise: R-L scaling followed by A-P columnwise alignment (seg only).\n"
                                                                                "slicewise: <int> Slice-by-slice 2d transformation. Default=" +
                                  paramregmulti.steps['1'].slicewise + "\n"
                                                                  "metric: {CC,MI,MeanSquares}. Default=" +
                                  paramregmulti.steps['1'].metric + "\n"
                                                               "iter: <int> Number of iterations. Default=" +
                                  paramregmulti.steps['1'].iter + "\n"
                                                             "shrink: <int> Shrink factor (only for syn/bsplinesyn). Default=" +
                                  paramregmulti.steps['1'].shrink + "\n"
                                                               "smooth: <int> Smooth factor (in mm). Note: if algo={centermassrot,columnwise} the smoothing kernel is: SxSx0. Otherwise it is SxSxS. Default=" +
                                  paramregmulti.steps['1'].smooth + "\n"
                                                               "laplacian: <int> Laplacian filter. Default=" +
                                  paramregmulti.steps['1'].laplacian + "\n"
                                                                  "gradStep: <float> Gradient step. Default=" +
                                  paramregmulti.steps['1'].gradStep + "\n"
                                                                 "deformation: ?x?x?: Restrict deformation (for ANTs algo). Replace ? by 0 (no deformation) or 1 (deformation). Default=" +
                                  paramregmulti.steps['1'].deformation + "\n"
                                                                    "init: Initial translation alignment based on:\n"
                                                                    "  geometric: Geometric center of images\n"
                                                                    "  centermass: Center of mass of images\n"
                                                                    "  origin: Physical origin of images\n"
                                                                    "poly: <int> Polynomial degree of regularization (only for algo=slicereg). Default=" +
                                  paramregmulti.steps['1'].poly + "\n"
                                                                    "filter_size: <float> Filter size for regularization (only for algo=centermassrot). Default=" +
                                  str(paramregmulti.steps['1'].filter_size) + "\n"
                                                             "smoothWarpXY: <int> Smooth XY warping field (only for algo=columnwize). Default=" +
                                  paramregmulti.steps['1'].smoothWarpXY + "\n"
                                                                     "pca_eigenratio_th: <int> Min ratio between the two eigenvalues for PCA-based angular adjustment (only for algo=centermassrot and rot_method=pca). Default=" +
                                  paramregmulti.steps['1'].pca_eigenratio_th + "\n"
                                                                          "dof: <str> Degree of freedom for type=label. Separate with '_'. Default=" +
                                  paramregmulti.steps['0'].dof + "\n" +
                                  paramregmulti.steps['1'].rot_method + "\n"
                                                                    "rot_method {pca, hog, pcahog}: rotation method to be used with algo=centermassrot. pca: approximate cord segmentation by an ellipse and finds it orientation using PCA's eigenvectors; hog: finds the orientation using the symmetry of the image; pcahog: tries method pca and if it fails, uses method hog. If using hog or pcahog, type should be set to imseg.",
                      mandatory=False,
                      example="step=1,type=seg,algo=slicereg,metric=MeanSquares:step=2,type=im,algo=syn,metric=MI,iter=5,shrink=2")
    parser.add_option(name="-identity",
                      type_value="multiple_choice",
                      description="just put source into destination (no optimization).",
                      mandatory=False,
                      default_value='0',
                      example=['0', '1'])
    parser.add_option(name="-z",
                      type_value="int",
                      description="""size of z-padding to enable deformation at edges when using SyN.""",
                      mandatory=False,
                      default_value=Param().padding)
    parser.add_option(name="-x",
                      type_value="multiple_choice",
                      description="""Final interpolation.""",
                      mandatory=False,
                      default_value='linear',
                      example=['nn', 'linear', 'spline'])
    parser.add_option(name="-ofolder",
                      type_value="folder_creation",
                      description="Output folder",
                      mandatory=False,
                      example='reg_results/')
    parser.add_option(name='-qc',
                      type_value='folder_creation',
                      description='The path where the quality control generated content will be saved',
                      default_value=None)
    parser.add_option(name='-qc-dataset',
                      type_value='str',
                      description='If provided, this string will be mentioned in the QC report as the dataset the process was run on',
                      )
    parser.add_option(name='-qc-subject',
                      type_value='str',
                      description='If provided, this string will be mentioned in the QC report as the subject the process was run on',
                      )
    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.""",
                      mandatory=False,
                      default_value='1',
                      example=['0', '1', '2'])

    return parser
def get_parser():

    # initialize parameters
    param_default = ParamMoco(is_diffusion=True,
                              group_size=3,
                              metric='MI',
                              smooth='1')

    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description(
        '  Motion correction of dMRI data. Some of the features to improve robustness were proposed in Xu et al. (http://dx.doi.org/10.1016/j.neuroimage.2012.11.014) and include:\n'
        '- group-wise (-g)\n'
        '- slice-wise regularized along z using polynomial function (-param). For more info about the method, type: isct_antsSliceRegularizedRegistration\n'
        '- masking (-m)\n'
        '- iterative averaging of target volume\n')
    parser.add_option(name='-i',
                      type_value='file',
                      description='Diffusion data',
                      mandatory=True,
                      example='dmri.nii.gz')
    parser.add_option(name='-bvec',
                      type_value='file',
                      description='Bvecs file',
                      mandatory=True,
                      example='bvecs.nii.gz')
    parser.add_option(name='-bval',
                      type_value='file',
                      description='Bvals file',
                      mandatory=False,
                      example='bvals.nii.gz')
    parser.add_option(
        name='-bvalmin',
        type_value='float',
        description=
        'B-value threshold (in s/mm2) below which data is considered as b=0.',
        mandatory=False,
        example='50')
    parser.add_option(
        name='-g',
        type_value='int',
        description='Group nvols successive dMRI volumes for more robustness.',
        mandatory=False,
        default_value=param_default.group_size,
        example=['2'])
    parser.add_option(
        name='-m',
        type_value='file',
        description=
        'Binary mask to limit voxels considered by the registration metric.',
        mandatory=False,
        example=['dmri_mask.nii.gz'])
    parser.add_option(
        name='-param',
        type_value=[[','], 'str'],
        description=
        "Advanced parameters. Assign value with \"=\"; Separate arguments with \",\"\n"
        "poly [int]: Degree of polynomial function used for regularization along Z. For no regularization set to 0. Default="
        + param_default.poly + ".\n"
        "smooth [mm]: Smoothing kernel. Default=" + param_default.smooth +
        ".\n"
        "metric {MI, MeanSquares, CC}: Metric used for registration. Default="
        + param_default.metric + ".\n"
        "gradStep [float]: Searching step used by registration algorithm. The higher the more deformation allowed. Default="
        + param_default.gradStep + ".\n"
        "sample [None or 0-1]: Sampling rate used for registration metric. Default="
        + param_default.sampling + ".\n",
        mandatory=False)
    parser.add_option(name='-x',
                      type_value='multiple_choice',
                      description='Final Interpolation.',
                      mandatory=False,
                      default_value=param_default.interp,
                      example=['nn', 'linear', 'spline'])
    parser.add_option(name='-ofolder',
                      type_value='folder_creation',
                      description='Output folder',
                      mandatory=False,
                      default_value=param_default.path_out,
                      example='dmri_moco_results/')
    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
Beispiel #56
0
def get_parser():
    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description('Merge images to the same space')
    parser.add_option(name="-i",
                      type_value=[[','], 'file'],
                      description="Input images",
                      mandatory=True)
    parser.add_option(name="-d",
                      type_value='file',
                      description="Destination image",
                      mandatory=True)
    parser.add_option(
        name="-w",
        type_value=[[','], 'file'],
        description=
        "List of warping fields from input images to destination image",
        mandatory=True)
    parser.add_option(
        name="-x",
        type_value='str',
        description=
        "interpolation for warping the input images to the destination image",
        mandatory=False,
        default_value=Param().interp)

    parser.add_option(name="-o",
                      type_value='file_output',
                      description="Output image",
                      mandatory=False,
                      default_value=Param().fname_out)
    '''
    parser.add_option(name="-ofolder",
                      type_value="folder_creation",
                      description="Output folder",
                      mandatory=False)
    '''
    parser.usage.addSection('MISC')
    parser.add_option(name="-r",
                      type_value="multiple_choice",
                      description='Remove temporary files.',
                      mandatory=False,
                      default_value=str(int(Param().rm_tmp)),
                      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=str(Param().verbose))

    return parser