From 5ced30df50db02f45774abee24954e4847489fb8 Mon Sep 17 00:00:00 2001 From: Maxime Descoteaux Date: Tue, 20 Jul 2021 06:12:20 -0400 Subject: [PATCH 1/3] remove fixel rd_map... not doing what it should... --- scripts/scil_compute_mean_fixel_afd_from_bundles.py | 11 +---------- scripts/scil_compute_mean_fixel_afd_from_hdf5.py | 13 ++----------- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/scripts/scil_compute_mean_fixel_afd_from_bundles.py b/scripts/scil_compute_mean_fixel_afd_from_bundles.py index 438232775..176e620c8 100755 --- a/scripts/scil_compute_mean_fixel_afd_from_bundles.py +++ b/scripts/scil_compute_mean_fixel_afd_from_bundles.py @@ -7,11 +7,6 @@ This is the "real" fixel-based fODF amplitude along every streamline of the bundle provided, averaged at every voxel. -Radial fODF comes for free from the mathematics, it is the great circle -integral of the fODF orthogonal to the fixel of interest, similar to -a Funk-Radon transform. Hence, radfODF is the fixel-based or HARDI-based -generalization of the DTI radial diffusivity and AFD -the generalization of axial diffusivity. Please use a bundle file rather than a whole tractogram. """ @@ -45,8 +40,6 @@ def _build_arg_parser(): help='Path of the fODF volume in spherical harmonics (SH).') p.add_argument('afd_mean_map', help='Path of the output mean AFD map.') - p.add_argument('rd_mean_map', - help='Path of the output mean radfODF map.') p.add_argument('--length_weighting', action='store_true', help='If set, will weigh the AFD values according to ' @@ -63,7 +56,7 @@ def main(): args = parser.parse_args() assert_inputs_exist(parser, [args.in_bundle, args.in_fodf]) - assert_outputs_exist(parser, args, [args.afd_mean_map, args.rd_mean_map]) + assert_outputs_exist(parser, args, [args.afd_mean_map]) sft = load_tractogram_with_reference(parser, args, args.in_bundle) fodf_img = nib.load(args.in_fodf) @@ -76,8 +69,6 @@ def main(): nib.Nifti1Image(afd_mean_map.astype(np.float32), fodf_img.affine).to_filename(args.afd_mean_map) - nib.Nifti1Image(rd_mean_map.astype(np.float32), - fodf_img.affine).to_filename(args.rd_mean_map) if __name__ == '__main__': diff --git a/scripts/scil_compute_mean_fixel_afd_from_hdf5.py b/scripts/scil_compute_mean_fixel_afd_from_hdf5.py index 3faa45671..b783b8381 100755 --- a/scripts/scil_compute_mean_fixel_afd_from_hdf5.py +++ b/scripts/scil_compute_mean_fixel_afd_from_hdf5.py @@ -7,11 +7,6 @@ This is the "real" fixel-based fODF amplitude along every streamline of the bundle provided, averaged at every voxel. -Radial fODF comes for free from the mathematics, it is the great circle -integral of the fODF orthogonal to the fixel of interest, similar to -a Funk-Radon transform. Hence, radfODF is the fixel-based or HARDI-based -generalization of the DTI radial diffusivity and AFD -the generalization of axial diffusivity. Please use a bundle file rather than a whole tractogram. """ @@ -69,9 +64,8 @@ def _afd_rd_wrapper(args): sh_basis, length_weighting) afd_mean = np.average(afd_mean_map[afd_mean_map > 0]) - rd_mean = np.average(rd_mean_map[rd_mean_map > 0]) - return key, afd_mean, rd_mean + return key, afd_mean def _build_arg_parser(): @@ -140,14 +134,11 @@ def main(): shutil.copy(args.in_hdf5, args.out_hdf5) with h5py.File(args.out_hdf5, 'a') as out_hdf5_file: - for key, afd_fixel, rd_fixel in results_list: + for key, afd_fixel in results_list: group = out_hdf5_file[key] if 'afd_fixel' in group: del group['afd_fixel'] group.create_dataset('afd_fixel', data=afd_fixel) - if 'rd_fixel' in group: - del group['rd_fixel'] - group.create_dataset('rd_fixel', data=rd_fixel) if __name__ == '__main__': From c9b7195d38aeb748e614e1d101c0330f07785537 Mon Sep 17 00:00:00 2001 From: Maxime Descoteaux Date: Tue, 20 Jul 2021 13:41:53 -0400 Subject: [PATCH 2/3] changed tests --- scripts/tests/test_compute_mean_fixel_afd_from_bundles.py | 2 +- scripts/tests/test_compute_mean_fixel_afd_from_hdf5.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/tests/test_compute_mean_fixel_afd_from_bundles.py b/scripts/tests/test_compute_mean_fixel_afd_from_bundles.py index 24657853a..2e2e853e6 100644 --- a/scripts/tests/test_compute_mean_fixel_afd_from_bundles.py +++ b/scripts/tests/test_compute_mean_fixel_afd_from_bundles.py @@ -25,6 +25,6 @@ def test_execution_processing(script_runner): 'fodf_descoteaux07.nii.gz') ret = script_runner.run('scil_compute_mean_fixel_afd_from_bundles.py', in_tracking, in_fodf, - 'afd_test.nii.gz', 'rd_test.nii.gz', + 'afd_test.nii.gz', '--sh_basis', 'descoteaux07', '--length_weighting') assert ret.success diff --git a/scripts/tests/test_compute_mean_fixel_afd_from_hdf5.py b/scripts/tests/test_compute_mean_fixel_afd_from_hdf5.py index 01d68e2b9..34450f1b9 100644 --- a/scripts/tests/test_compute_mean_fixel_afd_from_hdf5.py +++ b/scripts/tests/test_compute_mean_fixel_afd_from_hdf5.py @@ -25,7 +25,7 @@ def test_execution_connectivity(script_runner): in_fodf = os.path.join(get_home(), 'connectivity', 'fodf.nii.gz') ret = script_runner.run('scil_compute_mean_fixel_afd_from_hdf5.py', - in_h5, in_fodf, 'decompose_afd_rd.nii.gz', + in_h5, in_fodf, 'decompose_afd.nii.gz', '--length_weighting', '--sh_basis', 'descoteaux07', '--processes', '1') assert ret.success From 934282b822b1a9ff6a58c2d1d937978c48fb0717 Mon Sep 17 00:00:00 2001 From: arnaudbore Date: Tue, 20 Jul 2021 13:44:49 -0400 Subject: [PATCH 3/3] Update scripts/tests/test_compute_mean_fixel_afd_from_bundles.py --- scripts/tests/test_compute_mean_fixel_afd_from_bundles.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tests/test_compute_mean_fixel_afd_from_bundles.py b/scripts/tests/test_compute_mean_fixel_afd_from_bundles.py index 2e2e853e6..2ddf99767 100644 --- a/scripts/tests/test_compute_mean_fixel_afd_from_bundles.py +++ b/scripts/tests/test_compute_mean_fixel_afd_from_bundles.py @@ -25,6 +25,6 @@ def test_execution_processing(script_runner): 'fodf_descoteaux07.nii.gz') ret = script_runner.run('scil_compute_mean_fixel_afd_from_bundles.py', in_tracking, in_fodf, - 'afd_test.nii.gz', + 'afd_test.nii.gz', '--sh_basis', 'descoteaux07', '--length_weighting') assert ret.success