Пример #1
0
def build_args_p():

    p = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter,
                                description=__doc__)

    p.add_argument('operation',
                   choices=OPERATIONS.keys(),
                   metavar='OPERATION',
                   help='The type of operation to be performed on the '
                   'streamlines. Must\nbe one of the following: '
                   '%(choices)s.')

    p.add_argument('inputs',
                   metavar='INPUT_FILES',
                   nargs='+',
                   help='The list of files that contain the ' +
                   'streamlines to operate on.')

    p.add_argument('output',
                   metavar='OUTPUT_FILE',
                   help='The file where the remaining streamlines '
                   'are saved.')

    add_reference(p)

    p.add_argument('--precision',
                   '-p',
                   metavar='NUMBER_OF_DECIMALS',
                   type=int,
                   help='The precision used when comparing streamlines.')

    p.add_argument('--no_metadata',
                   '-n',
                   action='store_true',
                   help='Strip the streamline metadata from the output.')

    p.add_argument('--save_metadata_indices',
                   '-m',
                   action='store_true',
                   help='Save streamline indices to metadata. Has no '
                   'effect if --no-data\nis present. Will '
                   'overwrite \'ids\' metadata if already present.')

    p.add_argument('--save_indices',
                   '-s',
                   metavar='OUTPUT_INDEX_FILE',
                   help='Save the streamline indices to the supplied '
                   'json file.')

    p.add_argument(
        '--no-bbox-check',
        action='store_true',
        help='Avoid check if all streamline coordinates are within '
        'proper bounding box in voxel space.\nWARNING: By using this option '
        'ill-formatted tractograms are not being detected.')

    add_verbose_arg(p)
    add_overwrite_arg(p)

    return p
Пример #2
0
def _buildArgsParser():
    p = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter,
                                description=DESCRIPTION)

    p.add_argument('in_tractogram', help='Path of the input tractogram file.')
    p.add_argument('out_tractogram',
                   help='Path of the output tractogram file.')

    add_reference(p)

    p.add_argument('--drawn_roi',
                   nargs=3,
                   action='append',
                   metavar=('ROI_NAME', 'MODE', 'CRITERIA'),
                   help='Filename of a hand drawn ROI (.nii or .nii.gz).')
    p.add_argument('--atlas_roi',
                   nargs=4,
                   action='append',
                   metavar=('ROI_NAME', 'ID', 'MODE', 'CRITERIA'),
                   help='Filename of an atlas (.nii or .nii.gz).')
    p.add_argument('--bdo',
                   dest='bdo',
                   nargs=3,
                   action='append',
                   metavar=('BDO_NAME', 'MODE', 'CRITERIA'),
                   help='Filename of a bounding box (bdo) file from MI-Brain.')

    p.add_argument('--x_plane',
                   nargs=3,
                   action='append',
                   metavar=('PLANE', 'MODE', 'CRITERIA'),
                   help='Slice number in X, in voxel space.')
    p.add_argument('--y_plane',
                   nargs=3,
                   action='append',
                   metavar=('PLANE', 'MODE', 'CRITERIA'),
                   help='Slice number in Y, in voxel space.')
    p.add_argument('--z_plane',
                   nargs=3,
                   action='append',
                   metavar=('PLANE', 'MODE', 'CRITERIA'),
                   help='Slice number in Z, in voxel space.')
    p.add_argument('--filtering_list',
                   help='Text file containing one rule per line\n'
                   '(i.e. drawn_roi mask.nii.gz both_ends include).')
    p.add_argument('--no_empty',
                   action='store_true',
                   help='Do not write file if there is no streamline.')
    add_verbose(p)

    add_overwrite_arg(p)

    return p
Пример #3
0
def _build_args_parser():
    p = argparse.ArgumentParser(
        formatter_class=argparse.RawTextHelpFormatter,
        description=__doc__,
        epilog="""Garyfallidis, E., Côté, M. A., Rheault, F., ... &
        Descoteaux, M. (2018). Recognition of white matter
        bundles using local and global streamline-based registration and
        clustering. NeuroImage, 170, 283-295.""")

    p.add_argument('in_tractogram',
                   help='Input tractogram filename (trk or tck).')
    p.add_argument('in_model',
                   help='Model to use for recognition (trk or tck).')
    p.add_argument('transformation',
                   help='4x4 transformation to bring the model onto \n'
                   'the input tractogram')
    p.add_argument('output_name',
                   help='Output tractogram filename.')

    add_reference(p)

    p.add_argument('--wb_clustering_thr', type=float, default=8,
                   help='Clustering threshold used for the whole brain '
                   '[%(default)smm].')
    p.add_argument('--model_clustering_thr', type=float, default=4,
                   help='Clustering threshold used for the model '
                   '[%(default)smm].')
    p.add_argument('--pruning_thr', type=float, default=6,
                   help='MDF threshold used for final streamlines selection '
                   '[%(default)smm].')

    p.add_argument('--slr_threads', type=int, default=None,
                   help='Number of threads for SLR [all].')
    p.add_argument('--seed', type=int, default=None,
                   help='Random number generator seed [%(default)s].')
    p.add_argument('--inverse', action='store_true',
                   help='Use the inverse transformation.')
    p.add_argument('--no_empty', action='store_true',
                   help='Do not write file if there is no streamline.')

    group = p.add_mutually_exclusive_group()
    group.add_argument('--input_pickle',
                       help='Input pickle clusters map file.\n'
                       'Will override the wb_clustering_thr parameter.')
    group.add_argument('--output_pickle',
                       help='Output pickle clusters map file.')

    add_verbose(p)

    add_overwrite_arg(p)

    return p
Пример #4
0
def _build_args_parser():
    p = argparse.ArgumentParser(description=DESCRIPTION,
                                formatter_class=argparse.RawTextHelpFormatter)

    p.add_argument('in_tractogram',
                   metavar='IN_TRACTOGRAM',
                   help='Tractogram filename. Format must be one of \n'
                   'trk, tck, vtk, fib, dpy')

    p.add_argument('output_name',
                   metavar='OUTPUT_NAME',
                   help='Output filename. Format must be one of \n'
                   'trk, tck, vtk, fib, dpy')

    add_reference(p)

    add_overwrite_arg(p)

    return p
Пример #5
0
def _build_arg_parser():
    p = argparse.ArgumentParser(description=DESCRIPTION,
                                epilog=EPILOG,
                                formatter_class=argparse.RawTextHelpFormatter)

    p.add_argument('tract_filename', help='Input streamlines file.')

    add_reference(p)

    p.add_argument('--sphere',
                   default='repulsion724',
                   help='sphere used for the angular discretization.')

    p.add_argument('--mask', help='Use the given mask')

    p.add_argument('--out_mask', help='Mask showing where TDI > 0.')

    p.add_argument('--out_lw_tdi', help='Output length-weighted TDI map.')

    p.add_argument('--out_lw_todi', help='Output length-weighted TODI map.')

    p.add_argument('--out_lw_todi_sh',
                   help='Output length-weighted TODI map, '
                   'with SH coefficient.')

    p.add_argument('--sh_order',
                   type=int,
                   default=8,
                   help='Order of the original SH.')

    p.add_argument('--sh_normed', action='store_true', help='Normalize sh.')

    p.add_argument('--smooth',
                   action='store_true',
                   help='Smooth todi (angular and spatial).')

    add_sh_basis_args(p)
    add_overwrite_arg(p)
    return p