def get_parser(): parser = SCTArgumentParser( description='Generate Quality Control (QC) report following SCT processing.', epilog='Examples:\n' 'sct_qc -i t2.nii.gz -s t2_seg.nii.gz -p sct_deepseg_sc\n' 'sct_qc -i t2.nii.gz -s t2_seg_labeled.nii.gz -p sct_label_vertebrae\n' 'sct_qc -i t2.nii.gz -s t2_seg.nii.gz -p sct_deepseg_sc -qc-dataset mydata -qc-subject sub-45' ) parser.add_argument('-i', metavar='IMAGE', help='Input image #1 (mandatory)', required=True) parser.add_argument('-p', help='SCT function associated with the QC report to generate', choices=('sct_propseg', 'sct_deepseg_sc', 'sct_deepseg_gm', 'sct_register_multimodal', 'sct_register_to_template', 'sct_warp_template', 'sct_label_vertebrae', 'sct_detect_pmj', 'sct_label_utils', 'sct_get_centerline', 'sct_fmri_moco', 'sct_dmri_moco'), required=True) parser.add_argument('-s', metavar='SEG', help='Input segmentation or label', required=False) parser.add_argument('-d', metavar='DEST', help='Input image #2 to overlay on image #1 (requires a segmentation), or output of another ' 'process (e.g., sct_straighten_spinalcord)', required=False) parser.add_argument('-qc', metavar='QC', help='Path to save QC report. Default: ./qc', required=False, default=os.path.join('.', 'qc')) parser.add_argument('-qc-dataset', metavar='DATASET', help='If provided, this string will be mentioned in the QC report as the dataset the process ' 'was run on', required=False) parser.add_argument('-qc-subject', metavar='SUBJECT', help='If provided, this string will be mentioned in the QC report as the subject the process ' 'was run on', required=False) parser.add_argument('-fps', metavar='float', type=float, help='The number of frames per second for output gif images. Only useful for sct_fmri_moco and ' 'sct_dmri_moco.', required=False) parser.add_argument('-v', action='store_true', help="Verbose") parser.add_argument('-h', '--help', action="help", help="show this message and exit") return parser
def get_parser(): param_default = Param() parser = SCTArgumentParser( description= "Crash and integrity testing for functions of the Spinal Cord Toolbox. Internet connection is required for downloading testing data.", ) parser.add_argument( "--function", "-f", help="Test this specific script (eg. 'sct_propseg').", nargs="+", ) def arg_jobs(s): jobs = int(s) if jobs > 0: pass elif jobs == 0: jobs = multiprocessing.cpu_count() else: raise ValueError() return jobs parser.add_argument( "--download", "-d", action="store_true", default=param_default.download, ) parser.add_argument( "--path", "-p", help='Path to testing data. NB: no need to set if using "-d 1"', default=param_default.path_data, ) parser.add_argument( "--remove-temps", "-r", help='Remove temporary files.', action="store_true", default=param_default.remove_tmp_file, ) parser.add_argument( "--jobs", "-j", type=arg_jobs, help= "# of simultaneous tests to run (jobs). 0 or unspecified means # of available CPU threads ({})" .format(multiprocessing.cpu_count()), default=arg_jobs(0), ) parser.add_argument( "--verbose", "-v", action="store_true", default=param_default.verbose, ) parser.add_argument( "--abort-on-failure", help= "Instead of iterating through all tests, abort at the first one that would fail.", action="store_true", ) parser.add_argument( "--continue-from", help= "Instead of running all tests (or those specified by --function, start from this one", ) parser.add_argument( "--check-filesystem", help="Check filesystem for unwanted modifications", action="store_true", ) parser.add_argument( "--execution-folder", help="Folder where to run tests from (default. temporary)", ) parser.add_argument('-h', "--help", help="show this message and exit", action="help") return parser