Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

odf_sh_sharpening function fix and new test #384

Merged
merged 2 commits into from Jun 24, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion dipy/reconst/csdeconv.py
Expand Up @@ -608,7 +608,7 @@ def odf_sh_to_sharp(odfs_sh, sphere, basis=None, ratio=3 / 15., sh_order=8, lamb
real_sym_sh = sph_harm_lookup[basis]

B_reg, m, n = real_sym_sh(sh_order, theta, phi)
R, P = forward_sdt_deconv_mat(ratio, n)
R, P = forward_sdt_deconv_mat(ratio, n, r2_term=r2_term)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!


# scale lambda to account for differences in the number of
# SH coefficients and number of mapped directions
Expand Down
13 changes: 12 additions & 1 deletion dipy/reconst/tests/test_csdeconv.py
Expand Up @@ -206,7 +206,7 @@ def test_forward_sdeconv_mat():
def test_r2_term_odf_sharp():
SNR = None
S0 = 1
angle = 75
angle = 45 #45 degrees is a very tight angle to disentangle
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be silly to test both?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah no need to test both


_, fbvals, fbvecs = get_data('small_64D') #get_data('small_64D')

Expand Down Expand Up @@ -236,6 +236,17 @@ def test_r2_term_odf_sharp():
assert_equal(ang_sim > 1.9, True)
assert_equal(directions.shape[0], 2)

# This should pass as well
sdt_model = ConstrainedSDTModel(gtab, ratio=3/15., sh_order=8)
sdt_fit = sdt_model.fit(S)
fodf = sdt_fit.odf(sphere)

directions_gt, _, _ = peak_directions(odf_gt, sphere)
directions, _, _ = peak_directions(fodf, sphere)
ang_sim = angular_similarity(directions_gt, directions)
assert_equal(ang_sim > 1.9, True)
assert_equal(directions.shape[0], 2)



if __name__ == '__main__':
Expand Down