Beispiel #1
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
Beispiel #2
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('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 #4
0
def get_parser():
    param = Param()

    # parser initialisation
    parser = Parser(__file__)

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

    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description(
        'Compute Diffusion Tensor Images (DTI) using dipy.')
    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='-method',
        type_value='multiple_choice',
        description=
        'Type of method to calculate the diffusion tensor:\nstandard: Standard equation [Basser, Biophys J 1994]\nrestore: Robust fitting with outlier detection [Chang, MRM 2005]',
        mandatory=False,
        default_value='standard',
        example=['standard', 'restore'])
    parser.add_option(
        name='-m',
        type_value='file',
        description='Mask used to compute DTI in for faster processing.',
        mandatory=False,
        example='mask.nii.gz')
    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():

    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description(
        'Compute SNR in a given ROI using methods described in [Dietrich et al., Measurement of signal-to-noise ratios in MR images: Influence of multichannel coils, parallel imaging, and reconstruction filters. J Magn Reson Imaging 2007; 26(2): 375-385].'
    )
    parser.add_option(
        name="-i",
        type_value='image_nifti',
        description="4D data to compute the SNR on (along the 4th dimension).",
        mandatory=True,
        example="b0s.nii.gz")
    parser.add_option(name="-m",
                      type_value='image_nifti',
                      description='ROI within which SNR will be averaged.',
                      mandatory=True,
                      example='dwi_moco_mean_seg.nii.gz')
    parser.add_option(
        name="-method",
        type_value='multiple_choice',
        description='Method to use to compute the SNR:\n'
        '- diff: Substract two volumes (defined by -vol) and estimate noise variance over space.\n'
        '- mult: Estimate noise variance over time across volumes specified with -vol.',
        mandatory=False,
        default_value='diff',
        example=['diff', 'mult'])
    parser.add_option(
        name='-vol',
        type_value=[[','], 'int'],
        description=
        'List of volume numbers to use for computing SNR, separated with ",". Example: 0,31. To select all volumes in series set to -1.',
        mandatory=False,
        default_value=[-1])
    parser.add_option(
        name="-vertfile",
        type_value='image_nifti',
        description=
        'File name of the vertebral labeling registered to the input images.',
        mandatory=False,
        default_value='label/template/MNI-Poly-AMU_level.nii.gz')
    parser.add_option(name="-vert",
                      type_value='str',
                      description='Vertebral levels where to compute the SNR.',
                      mandatory=False,
                      example='2:6',
                      default_value='None')
    parser.add_option(name="-z",
                      type_value='str',
                      description='Slices where to compute the SNR.',
                      mandatory=False,
                      example='2:6',
                      default_value='None')
    parser.add_option(name="-v",
                      type_value="multiple_choice",
                      description="""Verbose. 0: nothing. 1: basic.""",
                      mandatory=False,
                      default_value='0',
                      example=['0', '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
Beispiel #7
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
def get_parser():
    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description(
        'Compute the Hausdorff\'s distance between two binary images which can be thinned (ie skeletonized)'
        'If only one image is inputted, it will be only thinned')
    parser.add_option(
        name="-i",
        type_value="file",
        description="First Image on which you want to find the skeleton",
        mandatory=True,
        example='t2star_manual_gmseg.nii.gz')
    parser.add_option(
        name="-d",
        type_value="file",
        description="Second Image on which you want to find the skeleton",
        mandatory=False,
        default_value=None,
        example='t2star_manual_gmseg.nii.gz')
    parser.add_option(
        name="-r",
        type_value=None,
        description="Second Image on which you want to find the skeleton",
        mandatory=False,
        deprecated_by='-d')
    parser.add_option(
        name="-thinning",
        type_value="multiple_choice",
        description=
        "Thinning : find the skeleton of the binary images using the Zhang-Suen algorithm (1984) and use it to compute the hausdorff's distance",
        mandatory=False,
        default_value=1,
        example=['0', '1'])
    parser.add_option(
        name="-t",
        type_value=None,
        description=
        "Thinning : find the skeleton of the binary images using the Zhang-Suen algorithm (1984) and use it to compute the hausdorff's distance",
        deprecated_by="-thinning",
        mandatory=False)
    parser.add_option(name="-resampling",
                      type_value="float",
                      description="pixel size in mm to resample to",
                      mandatory=False,
                      default_value=0.1,
                      example=0.5)
    parser.add_option(name="-o",
                      type_value="file_output",
                      description="Name of the output file",
                      mandatory=False,
                      default_value='hausdorff_distance.txt',
                      example='my_hausdorff_dist.txt')
    parser.add_option(
        name="-v",
        type_value="int",
        description="verbose: 0 = nothing, 1 = classic, 2 = expended",
        mandatory=False,
        default_value=0,
        example='1')
    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
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(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
Beispiel #12
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():
    # 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():
    # 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():
    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description(
        'Compute statistics on lesions of the input binary file (1 for lesion, 0 for background). The function assigns an ID value to each lesion (1, 2, 3, etc.) and outputs morphometric measures for each lesion:'
        '\n- volume [mm^3]'
        '\n- length [mm]: length along the Superior-Inferior axis'
        '\n- max_equivalent_diameter [mm]: maximum diameter of the lesion, when approximating the lesion as a circle in the axial cross-sectional plane orthogonal to the spinal cord'
        '\n\nIf an image (e.g. T2w or T1w image, texture image) is provided, it computes the mean and standard deviation values of this image within each lesion.'
        '\n\nIf a registered template is provided, it computes:'
        '\n- the distribution of each lesion depending on each vertebral level and on each region of the template (eg GM, WM, WM tracts).'
        '\n- the proportion of ROI (eg vertebral level, GM, WM) occupied by lesion.'
        '\nN.B. If the proportion of lesion in each region (e.g., WM and GM) does not sum up to 100%, it means that the registered template does not fully cover the lesion, in that case you might want to check the registration results.'
    )
    parser.add_option(name="-m",
                      type_value="file",
                      description="Lesion mask to analyze",
                      mandatory=True,
                      example='t2_lesion.nii.gz')
    parser.add_option(
        name="-s",
        type_value="file",
        description=
        "Spinal cord centerline or segmentation file, which will be used to correct morphometric measures with cord angle with respect to slice.",
        mandatory=False,
        example='t2_seg.nii.gz')
    parser.add_option(
        name="-i",
        type_value="file",
        description=
        "Image from which to extract average values within lesions (e.g. T2w or T1w image, texture image).",
        mandatory=False,
        example='t2.nii.gz')
    parser.add_option(
        name="-f",
        type_value="str",
        description=
        "Path to folder containing the atlas/template registered to the anatomical image.",
        mandatory=False,
        example="./label")
    parser.add_option(name="-ofolder",
                      type_value="folder_creation",
                      description="Output folder",
                      mandatory=False,
                      example='./')
    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(
        'Detection of the Ponto-Medullary Junction (PMJ).\n'
        ' This method is machine-learning based and adapted for T1w-like or T2w-like images.\n'
        ' If the PMJ is detected from the input image, a nifti mask is output ("*_pmj.nii.gz")\n'
        ' with one voxel (value=50) located at the predicted PMJ position.\n'
        ' If the PMJ is not detected, nothing is output.')
    parser.add_option(name="-i",
                      type_value="file",
                      description="input image.",
                      mandatory=True,
                      example="t2.nii.gz")
    parser.add_option(
        name="-c",
        type_value="multiple_choice",
        description=
        "type of image contrast, if your contrast is not in the available options (t1, t2), use t1 (cord bright / CSF dark) or t2 (cord dark / CSF bright)",
        mandatory=True,
        example=["t1", "t2"])
    parser.add_option(
        name="-s",
        type_value="file",
        description=
        "SC segmentation or centerline mask. Provide this mask helps the detection of the PMJ by indicating the position of the SC in the Right-to-Left direction.",
        mandatory=False,
        example="t2_seg.nii.gz")
    parser.add_option(name="-ofolder",
                      type_value="folder_creation",
                      description="Output folder",
                      mandatory=False,
                      example="My_Output_Folder/")
    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="-igt",
        type_value="image_nifti",
        description="File name of ground-truth PMJ (single voxel).",
        mandatory=False)
    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 #17
0
def get_parser():
    parser = Parser(__file__)
    parser.usage.set_description('Anisotropic resampling of 3D or 4D data.')
    parser.add_option(
        name="-i",
        type_value="file",
        description="Image to segment. Can be 3D or 4D. (Cannot be 2D)",
        mandatory=True,
        example='dwi.nii.gz')
    parser.usage.addSection(
        'TYPE OF THE NEW SIZE INPUT : with a factor of resampling, in mm or in number of voxels\n'
        'Please choose only one of the 3 options.')
    parser.add_option(
        name="-f",
        type_value="str",
        description=
        "Resampling factor in each dimensions (x,y,z). Separate with \"x\"\n"
        "For 2x upsampling, set to 2. For 2x downsampling set to 0.5",
        mandatory=False,
        example='0.5x0.5x1')
    parser.add_option(
        name="-mm",
        type_value="str",
        description="New resolution in mm. Separate dimension with \"x\"",
        mandatory=False,
        example='0.1x0.1x5')
    parser.add_option(
        name="-vox",
        type_value="str",
        description=
        "Resampling size in number of voxels in each dimensions (x,y,z). Separate with \"x\"",
        mandatory=False)
    parser.add_option(
        name="-ref",
        type_value="str",
        description=
        "Reference image to resample input image to. Uses world coordinates.",
        mandatory=False)
    parser.usage.addSection('MISC')
    parser.add_option(name="-x",
                      type_value='multiple_choice',
                      description='Interpolation method.',
                      mandatory=False,
                      default_value='linear',
                      example=['nn', 'linear', 'spline'])

    parser.add_option(name="-o",
                      type_value="file_output",
                      description="Output file name",
                      mandatory=False,
                      example='dwi_resampled.nii.gz')
    parser.add_option(
        name="-v",
        type_value='multiple_choice',
        description="verbose: 0 = nothing, 1 = classic, 2 = expended.",
        mandatory=False,
        default_value=1,
        example=['0', '1', '2'])
    return parser
def get_parser():
    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description(
        """This function extracts the spinal cord centerline. Two methods are 
    available: OptiC (automatic) and Viewer (manual). This function outputs (i) a NIFTI file with labels corresponding
    to the discrete centerline, and (ii) a csv file containing the float (more precise) coordinates of the centerline
    in the RPI orientation. \n\nReference: C Gros, B De Leener, et al. Automatic spinal cord 
    localization, robust to MRI contrast using global curve optimization (2017). doi.org/10.1016/j.media.2017.12.001"""
    )

    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. Only with method=optic.",
        mandatory=False,
        example=['t1', 't2', 't2s', 'dwi'])
    parser.add_option(
        name="-method",
        type_value="multiple_choice",
        description="Method used for extracting the centerline.\n"
        "optic: automatic spinal cord detection method\n"
        "viewer: manually selected a few points, followed by interpolation with polynoms.",
        mandatory=False,
        example=['optic', 'viewer'],
        default_value='optic')
    parser.add_option(
        name="-o",
        type_value='file_output',
        description=
        'File name (without extension) for the centerline output files. By default, output'
        'file will be the input with suffix "_centerline"',
        mandatory=False,
        example="centerline_optic")
    parser.add_option(
        name="-gap",
        type_value="float",
        description=
        "Gap in mm between manually selected points. Only with method=viewer.",
        mandatory=False,
        default_value='20.0')
    parser.add_option(
        name="-igt",
        type_value="image_nifti",
        description=
        "File name of ground-truth centerline or segmentation (binary nifti).",
        mandatory=False)
    parser.add_option(name="-v",
                      type_value="multiple_choice",
                      description="1: display on, 0: display off (default)",
                      mandatory=False,
                      example=["0", "1", "2"],
                      default_value="1")
    return parser
Beispiel #19
0
def get_parser():
    # Initialize parser
    param_default = Param()
    parser = Parser(__file__)

    # Mandatory arguments
    parser.usage.set_description(
        "Separate b=0 and DW images from diffusion dataset. The output files will have a suffix (_b0 and _dwi) appended to the input file name."
    )
    parser.add_option(name='-i',
                      type_value='image_nifti',
                      description='Diffusion data',
                      mandatory=True,
                      example='dmri.nii.gz')
    parser.add_option(name='-bvec',
                      type_value='file',
                      description='bvecs file',
                      mandatory=True,
                      example='bvecs.txt')

    # Optional arguments
    parser.add_option(name='-a',
                      type_value='multiple_choice',
                      description='average b=0 and DWI data.',
                      mandatory=False,
                      example=['0', '1'],
                      default_value=str(param_default.average))
    parser.add_option(
        name='-bval',
        type_value='file',
        description=
        'bvals file. Used to identify low b-values (in case different from 0).',
        mandatory=False)
    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='-ofolder',
                      type_value='folder_creation',
                      description='Output folder.',
                      mandatory=False,
                      default_value='./')
    parser.add_option(name='-v',
                      type_value='multiple_choice',
                      description='Verbose.',
                      mandatory=False,
                      example=['0', '1'],
                      default_value=str(param_default.verbose))
    parser.add_option(name='-r',
                      type_value='multiple_choice',
                      description='remove temporary files.',
                      mandatory=False,
                      example=['0', '1'],
                      default_value=str(param_default.remove_temp_files))

    return parser
Beispiel #20
0
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="-json",
                      type_value="str",
                      description="Requirements on center, study, ... that must be satisfied by the json file of each tested subjects\n"
                                  "Syntax:  center=unf,study=errsm,gm_model=0",
                      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="-log",
                      type_value='multiple_choice',
                      description="Redirects Terminal verbose to log file.",
                      mandatory=False,
                      example=['0', '1'],
                      default_value='1')

    parser.add_option(name='-email',
                      type_value='str',
                      description='Email address to send results followed by SMTP passwd (separate with comma).',
                      mandatory=False,
                      default_value='')

    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('Get or set orientation to NIFTI image (3D or 4D).')
    parser.add_option(name="-i",
                      type_value="file",
                      description="Image to get or set orientation.",
                      mandatory=True,
                      example='data.nii.gz')
    parser.add_option(name="-s",
                      type_value="multiple_choice",
                      description="\nOrientation of header.",
                      default_value='',
                      mandatory=False,
                      example='RIP LIP RSP LSP RIA LIA RSA LSA IRP ILP SRP SLP IRA ILA SRA SLA RPI LPI RAI LAI RPS LPS RAS LAS PRI PLI ARI ALI PRS PLS ARS ALS IPR SPR IAR SAR IPL SPL IAL SAL PIR PSR AIR ASR PIL PSL AIL ASL'.split())
    parser.add_option(name="-o",
                      type_value="file_output",
                      description="File output",
                      mandatory=False,
                      example=['data_orient.nii.gz'])
    parser.add_option(name="-a",
                      type_value="multiple_choice",
                      description="\nOrientation of image (use with care!).",
                      default_value='',
                      mandatory=False,
                      example='RIP LIP RSP LSP RIA LIA RSA LSA IRP ILP SRP SLP IRA ILA SRA SLA RPI LPI RAI LAI RPS LPS RAS LAS PRI PLI ARI ALI PRS PLS ARS ALS IPR SPR IAR SAR IPL SPL IAL SAL PIR PSR AIR ASR PIL PSL AIL ASL'.split())
    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: basic. 2: extended.""",
                      mandatory=False,
                      default_value='0',
                      example=['0', '1', '2'])
    return parser
Beispiel #22
0
def get_parser():
    param_default = Param()
    parser = Parser(__file__)
    parser.usage.set_description(
        """Flatten the spinal cord in the sagittal plane (to make nice pictures)."""
    )
    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='Centerline.',
                      mandatory=True,
                      example='centerline.nii.gz')
    parser.add_option(name='-c',
                      type_value=None,
                      description='Centerline.',
                      mandatory=False,
                      deprecated_by='-s')
    parser.add_option(name='-x',
                      type_value='multiple_choice',
                      description='Final interpolation.',
                      mandatory=False,
                      example=['nearestneighbour', 'trilinear', 'sinc'],
                      default_value=str(param_default.interp))
    parser.add_option(name='-d',
                      type_value='int',
                      description='Degree of fitting polynome.',
                      mandatory=False,
                      default_value=param_default.deg_poly)
    parser.add_option(name='-f',
                      type_value='multiple_choice',
                      description='Fitting algorithm.',
                      mandatory=False,
                      example=['polynome', 'nurbs'],
                      default_value='nurbs')
    parser.add_option(
        name='-r',
        type_value='multiple_choice',
        description=
        'Removes the temporary folder and debug folder used for the algorithm at the end of execution',
        mandatory=False,
        default_value=str(param_default.remove_temp_files),
        example=['0', '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=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__)

    # 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="int",
        description="Sigma of the smoothing Gaussian kernel (in mm).",
        mandatory=False,
        default_value=3,
        example='2')
    parser.add_option(
        name='-param',
        type_value=[[','], 'str'],
        description=
        "Advanced parameters. Assign value with \"=\"; Separate params with \",\"\n"
        "algo_fitting {hanning,nurbs}: 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():
    parser = Parser(__file__)
    parser.usage.set_description('Compute the Dice Coefficient. Note: indexing (in both time and space) starts with 0 not 1! Inputting -1 for a size will set it to the full image extent for that dimension.')
    parser.add_option(name='-i',
                      type_value='image_nifti',
                      description='First input image.',
                      mandatory=True,
                      example='t2_seg.nii.gz')
    parser.add_option(name='-d',
                      type_value='image_nifti',
                      description='Second input image.',
                      mandatory=True,
                      example='t2_manual_seg.nii.gz')
    parser.add_option(name='-2d-slices',
                      type_value='multiple_choice',
                      description='Compute DC on 2D slices in the specified dimension',
                      mandatory=False,
                      example=['0', '1', '2'])
    parser.add_option(name='-b',
                      type_value=[[','], 'int'],
                      description='Bounding box with the coordinates of the origin and the size of the box as follow: x_origin,x_size,y_origin,y_size,z_origin,z_size',
                      mandatory=False,
                      example='5,10,5,10,10,15')
    parser.add_option(name='-bmax',
                      type_value='multiple_choice',
                      description='Use maximum bounding box of the images union to compute DC',
                      mandatory=False,
                      example=['0', '1'])
    parser.add_option(name='-bzmax',
                      type_value='multiple_choice',
                      description='Use maximum bounding box of the images union in the "Z" direction to compute DC',
                      mandatory=False,
                      example=['0', '1'])
    parser.add_option(name='-bin',
                      type_value='multiple_choice',
                      description='Binarize image before computing DC. (Put non-zero-voxels to 1)',
                      mandatory=False,
                      example=['0', '1'])
    parser.add_option(name='-o',
                      type_value='file_output',
                      description='Output file with DC results (.txt)',
                      mandatory=False,
                      example='dice_coeff.txt')
    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'])

    return parser
def get_parser():
    # Initialize the parser
    parser = Parser(__file__)
    parser.usage.set_description(
        'Check the integrity of the warped atlas by (i) evaluating the number of tracts that disappeared given a threshold, (ii) evaluating the number of voxels outside the spinal cord segmentation and (iii) evaluating the overlap between the white matter tracts and the gray matter.'
    )
    parser.add_option(name="-i",
                      type_value="folder",
                      description="Atlas folder path.",
                      mandatory=True,
                      example='label/atlas')
    parser.add_option(name="-s",
                      type_value="file",
                      description="Segmentation of the cord.",
                      mandatory=False,
                      example='label/template/MNI-Poly-AMU_cord.nii.gz')
    parser.add_option(name="-gm",
                      type_value="file",
                      description="Segmentation of the Gray matter",
                      mandatory=False,
                      example='label/template/MNI-Poly-AMU_GM.nii.gz')
    parser.add_option(name="-m",
                      type_value=None,
                      description="Segmentation of the Gray matter",
                      deprecated_by="-gm",
                      mandatory=False)
    parser.add_option(name="-thr",
                      type_value="float",
                      description="Atlas threshold, between 0 and 1.",
                      mandatory=False,
                      example='0.4')
    parser.add_option(name="-t",
                      type_value=None,
                      description="Atlas threshold, between 0 and 1.",
                      deprecated_by="-thr",
                      mandatory=False)
    parser.add_option(
        name="-thrgm",
        type_value="float",
        description="Gray matter image threshold, between 0 and 1.",
        mandatory=False,
        example='0.4')
    parser.add_option(
        name="-g",
        type_value=None,
        description="Gray matter image threshold, between 0 and 1.",
        deprecated_by="-thrgm",
        mandatory=False)

    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 #26
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
Beispiel #27
0
def get_parser():
    # Initialize default parameters
    param_default = Param()
    # Initialize parser
    parser = Parser(__file__)
    parser.usage.set_description('This function warps the template and all atlases to a given image (e.g. fMRI, DTI, MTR, etc.).')
    parser.add_option(name="-d",
                      type_value="file",
                      description="destination image the template will be warped into",
                      mandatory=True,
                      example="dwi_mean.nii.gz")
    parser.add_option(name="-w",
                      type_value="file",
                      description="warping field",
                      mandatory=True,
                      example="warp_template2dmri.nii.gz")
    parser.add_option(name="-a",
                      type_value="multiple_choice",
                      description="warp atlas of white matter",
                      mandatory=False,
                      default_value=str(param_default.warp_atlas),
                      example=['0', '1'])
    parser.add_option(name="-s",
                      type_value="multiple_choice",
                      description="warp spinal levels.",
                      mandatory=False,
                      default_value=str(param_default.warp_spinal_levels),
                      example=['0', '1'])
    parser.add_option(name="-ofolder",
                      type_value="folder_creation",
                      description="name of output folder.",
                      mandatory=False,
                      default_value=param_default.folder_out,
                      example="label")
    parser.add_option(name="-o",
                      type_value=None,
                      description="name of output folder.",
                      mandatory=False,
                      deprecated_by='-ofolder')
    parser.add_option(name="-t",
                      type_value="folder",
                      description="Path to template.",
                      mandatory=False,
                      default_value=str(param_default.path_template))
    parser.add_option(name='-qc',
                      type_value='multiple_choice',
                      description='Output images for quality control.',
                      mandatory=False,
                      example=['0', '1'],
                      default_value='1')
    parser.add_option(name="-v",
                      type_value="multiple_choice",
                      description="""Verbose.""",
                      mandatory=False,
                      default_value='1',
                      example=['0', '1'])
    return parser
def get_parser():
    # parser initialisation
    parser = Parser(__file__)
    parser.usage.set_description('Apply transformations. This function is a wrapper for antsApplyTransforms (ANTs).')
    parser.add_option(name="-i",
                      type_value="file",
                      description="input image",
                      mandatory=True,
                      example="t2.nii.gz")
    parser.add_option(name="-d",
                      type_value="file",
                      description="destination image",
                      mandatory=True,
                      example="out.nii.gz")
    parser.add_option(name="-w",
                      type_value=[[','], "file"],
                      description="Transformation, which can be a warping field (nifti image) or an affine transformation matrix (text file).",
                      mandatory=True,
                      example="warp1.nii.gz,warp2.nii.gz")
    parser.add_option(name="-crop",
                      type_value="multiple_choice",
                      description="Crop Reference. 0 : no reference. 1 : sets background to 0. 2 : use normal background",
                      mandatory=False,
                      default_value='0',
                      example=['0', '1', '2'])
    parser.add_option(name="-c",
                      type_value=None,
                      description="Crop Reference. 0 : no reference. 1 : sets background to 0. 2 : use normal background",
                      mandatory=False,
                      deprecated_by='-crop')
    parser.add_option(name="-o",
                      type_value="file_output",
                      description="registered source.",
                      mandatory=False,
                      default_value='',
                      example="dest.nii.gz")
    parser.add_option(name="-x",
                      type_value="multiple_choice",
                      description="interpolation method",
                      mandatory=False,
                      default_value='spline',
                      example=['nn', 'linear', 'spline'])
    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
Beispiel #29
0
def get_parser():
    param_default = Param()
    parser = Parser(__file__)
    parser.usage.set_description(
        """Flatten the spinal cord in the sagittal plane (to make nice pictures). Output data
    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='-x',
                      type_value='multiple_choice',
                      description='Final interpolation.',
                      mandatory=False,
                      example=['nearestneighbour', 'trilinear', 'sinc'],
                      default_value=str(param_default.interp))
    parser.add_option(name='-d',
                      type_value='int',
                      description='Degree of fitting polynome.',
                      mandatory=False,
                      default_value=param_default.deg_poly)
    parser.add_option(name='-f',
                      type_value='multiple_choice',
                      description='Fitting algorithm.',
                      mandatory=False,
                      example=['hanning', 'nurbs'],
                      default_value='hanning')
    parser.add_option(
        name='-r',
        type_value='multiple_choice',
        description=
        'Removes the temporary folder and debug folder used for the algorithm at the end of execution',
        mandatory=False,
        default_value=str(param_default.remove_temp_files),
        example=['0', '1'])
    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("""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