diff --git a/scripts/scil_score_bundles.py b/scripts/scil_score_bundles.py index 40ebe32fe..a68a028b6 100644 --- a/scripts/scil_score_bundles.py +++ b/scripts/scil_score_bundles.py @@ -72,8 +72,8 @@ def _build_arg_parser(): "file are considered \nas absolute paths.") g = p.add_argument_group("Preprocessing") - g.add_argument("--remove_invalid", action="store_true", - help="Remove invalid streamlines before scoring.") + g.add_argument("--ignore_invalid", action="store_true", + help="Ignore invalid streamlines in loaded tractograms.") add_json_args(p) add_overwrite_arg(p) @@ -84,6 +84,7 @@ def _build_arg_parser(): def load_and_verify_everything(parser, args): + bbox_check = False if args.ignore_invalid else True assert_inputs_exist(parser, [args.gt_config]) if not os.path.isdir(args.bundles_dir): @@ -137,7 +138,7 @@ def load_and_verify_everything(parser, args): for bundle in bundle_names: vb_name = os.path.join(vb_path, bundle + '_VS.trk') if os.path.isfile(vb_name): - sft = load_tractogram(vb_name, 'same', bbox_valid_check=False) + sft = load_tractogram(vb_name, 'same', bbox_valid_check=bbox_check) vb_sft_list.append(sft) if ref_sft is None: ref_sft = sft @@ -150,7 +151,7 @@ def load_and_verify_everything(parser, args): if wpc_path is not None: logging.info("Loading WPC bundles") for bundle in glob.glob(wpc_path + '/*'): - sft = load_tractogram(bundle, 'same', bbox_valid_check=False) + sft = load_tractogram(bundle, 'same', bbox_valid_check=bbox_check) wpc_sft_list.append(sft) if ref_sft is None: ref_sft = sft @@ -164,7 +165,7 @@ def load_and_verify_everything(parser, args): logging.info("Loading invalid bundles") for bundle in glob.glob(ib_path + '/*'): ib_names.append(os.path.basename(bundle)) - sft = load_tractogram(bundle, 'same', bbox_valid_check=False) + sft = load_tractogram(bundle, 'same', bbox_valid_check=bbox_check) ib_sft_list.append(ref_sft) if ref_sft is None: ref_sft = sft @@ -173,7 +174,8 @@ def load_and_verify_everything(parser, args): # Load either NC or IS if nc_filename is not None: - nc_sft = load_tractogram(nc_filename, 'same', bbox_valid_check=False) + nc_sft = load_tractogram(nc_filename, 'same', + bbox_valid_check=bbox_check) ref_sft = nc_sft else: nc_sft = None diff --git a/scripts/tests/test_score_bundles.py b/scripts/tests/test_score_bundles.py index fcd0ff3dc..5990ce89f 100644 --- a/scripts/tests/test_score_bundles.py +++ b/scripts/tests/test_score_bundles.py @@ -43,6 +43,6 @@ def test_score_bundles(script_runner): json.dump(json_contents, f) ret = script_runner.run('scil_score_bundles.py', - "config_file.json", "./") + "config_file.json", "./", '--ignore_invalid') assert ret.success