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

Add csd plus #116

Merged
merged 6 commits into from
Aug 24, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions dmipy/core/modeling_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
MultiTissueConvexOptimizer)
from ..optimizers_fod.csd_cvxpy import CsdCvxpyOptimizer
from ..optimizers_fod.csd_tournier import CsdTournierOptimizer
from ..optimizers_fod.csd_plus import CsdPlusOptimizer
from ..utils.spherical_mean import (
estimate_spherical_mean_multi_shell)
from ..utils.utils import (
Expand Down Expand Up @@ -1919,11 +1920,13 @@ def fit(self, acquisition_scheme, data, mask=None, solver='csd',
mask : (N-1)-dimensional integer/boolean array of size (N_x, N_y, ...),
Optional mask of voxels to be included in the optimization.
solver : string,
Can be 'csd', 'csd_tounier07' or 'csd_cvxpy', with the default
being 'csd'. Using 'csd' will make the algorithm automatically
use the 'tournier07' solver [1]_ if there are no volume fractions
to fit or they are fixed. Otherwise, the slower but more general
cvxpy solver [2]_ is used, which follows the formulation of [3]_.
Can be 'csd', 'csd_tounier07', 'csd_cvxpy' or 'csd_plus', with the
default being 'csd'. Using 'csd' will make the algorithm
automatically use the 'tournier07' solver [1]_ if there are no
volume fractionsto fit or they are fixed. Otherwise, the slower but
more general cvxpy solver [2]_ is used, which follows the
formulation of [3]_. Using 'csd_plus' will make the algorithm use
the global positivity constraints of [5]_.
lambda_lb: positive float,
Weight for Laplace-Beltrami regularization to impose smoothness
into estimated FODs, follows [4]_.
Expand Down Expand Up @@ -1961,6 +1964,9 @@ def fit(self, acquisition_scheme, data, mask=None, solver='csd',
analytical Q-ball imaging." Magnetic Resonance in Medicine: An
Official Journal of the International Society for Magnetic
Resonance in Medicine 58.3 (2007): 497-510.
.. [5] Dela Haije, Tom, Evren Özarslan, and Aasa Feragen. "Enforcing
necessary non-negativity constraints for common diffusion MRI models
using sum of squares programming." NeuroImage 209 (2020): 116405.
"""
self._check_if_kernel_parameters_are_fixed()
self._check_tissue_model_acquisition_scheme(acquisition_scheme)
Expand Down Expand Up @@ -2062,6 +2068,13 @@ def fit(self, acquisition_scheme, data, mask=None, solver='csd',
if verbose:
print('Setup CVXPY FOD optimizer in {} seconds'.format(
time() - start))
elif solver == 'csd_plus':
fit_func = CsdPlusOptimizer(
acquisition_scheme, self, x0_, self.sh_order,
unity_constraint=self.unity_constraint)
if verbose:
print('Setup CSD-PLUS FOD optimizer in {} seconds'.format(
time() - start))
else:
msg = "Unknown solver name {}".format(solver)
raise ValueError(msg)
Expand Down
6 changes: 6 additions & 0 deletions dmipy/data/sos_constraints/sh_constraint_0.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
1,3,3,0.28209479177387814
2,0,0,1.
2,1,1,1.
2,2,2,1.
2,3,3,-1.
2,4,4,1.
Loading