diff --git a/scripts/scil_compute_local_tracking.py b/scripts/scil_compute_local_tracking.py index ccba3afde..1c1ee65cc 100755 --- a/scripts/scil_compute_local_tracking.py +++ b/scripts/scil_compute_local_tracking.py @@ -63,7 +63,10 @@ def _build_arg_parser(): choices=['det', 'prob', 'eudx'], help='Algorithm to use. [%(default)s]') add_sphere_arg(track_g, symmetric_only=True) - + track_g.add_argument('--sub_sphere', + type=int, default=0, + help='Subdivides each face of the sphere into 4^s new faces. ' + '[%(default)s]') add_seeding_options(p) out_g = add_out_options(p) @@ -78,7 +81,7 @@ def _build_arg_parser(): def _get_direction_getter(args): odf_data = nib.load(args.in_odf).get_fdata(dtype=np.float32) - sphere = HemiSphere.from_sphere(get_sphere(args.sphere)) + sphere = HemiSphere.from_sphere(get_sphere(args.sphere)).subdivide(args.sub_sphere) theta = get_theta(args.theta, args.algo) non_zeros_count = np.count_nonzero(np.sum(odf_data, axis=-1)) diff --git a/scripts/tests/test_compute_local_tracking.py b/scripts/tests/test_compute_local_tracking.py index 9d0c40770..c5f24f14c 100644 --- a/scripts/tests/test_compute_local_tracking.py +++ b/scripts/tests/test_compute_local_tracking.py @@ -32,6 +32,21 @@ def test_execution_tracking_fodf(script_runner): assert ret.success +def test_execution_sphere_subdivide(script_runner): + os.chdir(os.path.expanduser(tmp_dir.name)) + in_fodf = os.path.join(get_home(), 'tracking', + 'fodf.nii.gz') + in_mask = os.path.join(get_home(), 'tracking', + 'seeding_mask.nii.gz') + + ret = script_runner.run('scil_compute_local_tracking.py', in_fodf, + in_mask, in_mask, 'local_sphere.trk', '--nt', '1000', + '--compress', '0.1', '--sh_basis', 'descoteaux07', + '--min_length', '20', '--max_length', '200', + '--sub_sphere', '2') + assert ret.success + + def test_execution_tracking_fodf_no_compression(script_runner): os.chdir(os.path.expanduser(tmp_dir.name)) in_fodf = os.path.join(get_home(), 'tracking',