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.') add_verbose(p) add_overwrite_arg(p) return p
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
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
def _build_args_parser(): p = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawTextHelpFormatter, epilog='References: [1] Girard, G., Whittingstall K., Deriche, R., ' 'and Descoteaux, M. (2014). Towards quantitative connectivity ' 'analysis: reducing tractography biases. Neuroimage, 98, ' '266-278.') p._optionals.title = 'Generic options' p.add_argument( 'sh_file', help='Spherical harmonic file. Data must be aligned with \nseed_file ' '(isotropic resolution, nifti, see --basis).') p.add_argument('seed_file', help='Seeding mask (isotropic resolution, nifti).') p.add_argument( 'map_include_file', help='The probability map of ending the streamline and \nincluding it ' 'in the output (CMC, PFT [1]). \n(isotropic resolution, nifti).') p.add_argument( 'map_exclude_file', help='The probability map of ending the streamline and \nexcluding it ' 'in the output (CMC, PFT [1]). \n(isotropic resolution, nifti).') p.add_argument('output_file', help='Streamline output file (must be trk or tck).') track_g = p.add_argument_group('Tracking options') track_g.add_argument( '--algo', default='prob', choices=['det', 'prob'], help='Algorithm to use (must be "det" or "prob"). [%(default)s]') track_g.add_argument('--step', dest='step_size', type=float, default=0.5, help='Step size in mm. [%(default)s]') track_g.add_argument( '--min_length', type=float, default=10., help='Minimum length of a streamline in mm. [%(default)s]') track_g.add_argument( '--max_length', type=float, default=300., help='Maximum length of a streamline in mm. [%(default)s]') track_g.add_argument( '--theta', type=float, help='Maximum angle between 2 steps. ["det"=45, "prob"=20]') track_g.add_argument( '--act', action='store_true', help='If set, uses anatomically-constrained tractography (ACT)\n' 'instead of continuous map criterion (CMC).') track_g.add_argument( '--sfthres', dest='sf_threshold', type=float, default=0.1, help='Spherical function relative threshold. [%(default)s]') track_g.add_argument( '--sfthres_init', dest='sf_threshold_init', type=float, default=0.5, help='Spherical function relative threshold value for the \ninitial ' 'direction. [%(default)s]') add_sh_basis_args(track_g) seed_group = p.add_argument_group( 'Seeding options', 'When no option is provided, uses --npv 1.') seed_sub_exclusive = seed_group.add_mutually_exclusive_group() seed_sub_exclusive.add_argument('--npv', type=int, help='Number of seeds per voxel.') seed_sub_exclusive.add_argument('--nt', type=int, help='Total number of seeds to use.') pft_g = p.add_argument_group('PFT options') pft_g.add_argument( '--particles', type=int, default=15, help='Number of particles to use for PFT. [%(default)s]') pft_g.add_argument('--back', dest='back_tracking', type=float, default=2., help='Length of PFT back tracking in mm. [%(default)s]') pft_g.add_argument( '--forward', dest='forward_tracking', type=float, default=1., help='Length of PFT forward tracking in mm. [%(default)s]') out_g = p.add_argument_group('Output options') out_g.add_argument( '--compress', type=float, help='If set, will compress streamlines. The parameter\nvalue is the ' 'distance threshold. A rule of thumb\nis to set it to 0.1mm for ' 'deterministic\nstreamlines and 0.2mm for probabilitic ' 'streamlines.') out_g.add_argument('--all', dest='keep_all', action='store_true', help='If set, keeps "excluded" streamlines.\n' 'NOT RECOMMENDED, except for debugging.') out_g.add_argument('--seed', type=int, help='Random number generator seed.') add_overwrite_arg(out_g) log_g = p.add_argument_group('Logging options') add_verbose(log_g) return p
def _build_arg_parser(): p = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter) p._optionals.title = 'Generic options' p.add_argument('sh_file', help='Spherical harmonic file. \n' '(isotropic resolution, nifti, see --basis).') p.add_argument('seed_file', help='Seeding mask (isotropic resolution, nifti).') p.add_argument('mask_file', help='Seeding mask(isotropic resolution, nifti).\n' + 'Tracking will stop outside this mask') p.add_argument('output_file', help='Streamline output file (must be trk or tck).') track_g = p.add_argument_group('Tracking options') track_g.add_argument( '--algo', default='prob', choices=['det', 'prob'], help='Algorithm to use (must be "det" or "prob"). [%(default)s]') track_g.add_argument('--step', dest='step_size', type=float, default=0.5, help='Step size in mm. [%(default)s]') track_g.add_argument( '--min_length', type=float, default=10., help='Minimum length of a streamline in mm. [%(default)s]') track_g.add_argument( '--max_length', type=float, default=300., help='Maximum length of a streamline in mm. [%(default)s]') track_g.add_argument( '--theta', type=float, help='Maximum angle between 2 steps. ["eudx"=60, det"=45, "prob"=20]') track_g.add_argument( '--sfthres', dest='sf_threshold', type=float, default=0.1, help='Spherical function relative threshold. [%(default)s]') add_sh_basis_args(track_g) seed_group = p.add_argument_group( 'Seeding options', 'When no option is provided, uses --npv 1.') seed_sub_exclusive = seed_group.add_mutually_exclusive_group() seed_sub_exclusive.add_argument('--npv', type=int, help='Number of seeds per voxel.') seed_sub_exclusive.add_argument('--nt', type=int, help='Total number of seeds to use.') p.add_argument('--sphere', choices=sorted(SPHERE_FILES.keys()), default='symmetric724', help='Set of directions to be used for tracking') out_g = p.add_argument_group('Output options') out_g.add_argument( '--compress', type=float, help='If set, will compress streamlines. The parameter\nvalue is the ' 'distance threshold. A rule of thumb\nis to set it to 0.1mm for ' 'deterministic\nstreamlines and 0.2mm for probabilitic ' 'streamlines.') out_g.add_argument('--seed', type=int, help='Random number generator seed.') add_overwrite_arg(out_g) log_g = p.add_argument_group('Logging options') add_verbose(log_g) return p