Skip to content

Commit

Permalink
Merge pull request #478 from mdesco/fixel_rd_map_remove
Browse files Browse the repository at this point in the history
remove fixel rd_map... not doing what it should...
  • Loading branch information
arnaudbore authored Jul 20, 2021
2 parents 5bd9e2c + 934282b commit 12fb254
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 23 deletions.
11 changes: 1 addition & 10 deletions scripts/scil_compute_mean_fixel_afd_from_bundles.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down Expand Up @@ -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 '
Expand All @@ -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)
Expand All @@ -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__':
Expand Down
13 changes: 2 additions & 11 deletions scripts/scil_compute_mean_fixel_afd_from_hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down Expand Up @@ -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():
Expand Down Expand Up @@ -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__':
Expand Down
2 changes: 1 addition & 1 deletion scripts/tests/test_compute_mean_fixel_afd_from_bundles.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion scripts/tests/test_compute_mean_fixel_afd_from_hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 12fb254

Please sign in to comment.