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

ENH: Nipype-less implementation (refactor) #16

Merged
merged 21 commits into from Apr 8, 2021
Merged

ENH: Nipype-less implementation (refactor) #16

merged 21 commits into from Apr 8, 2021

Commits on Apr 7, 2021

  1. Configuration menu
    Copy the full SHA
    3c443aa View commit details
    Browse the repository at this point in the history
  2. Apply suggestions from code review

    Co-authored-by: Ariel Rokem <arokem@gmail.com>
    oesteban and arokem committed Apr 7, 2021
    Configuration menu
    Copy the full SHA
    dd5bf48 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    335c701 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    acf01e0 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    6fc609b View commit details
    Browse the repository at this point in the history
  6. enh: add seeding option

    oesteban committed Apr 7, 2021
    Configuration menu
    Copy the full SHA
    816599c View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    98e1289 View commit details
    Browse the repository at this point in the history
  8. fix: streamlining registration

    I'm making progress on the integration with DIPY's regitration. However,
    I'm hitting the following issue:
    
    ```Python
    >>> EddyMotionEstimator.fit(data)
    Optimizing level 0 [max iter: 100]
    ---------------------------------------------------------------------------
    TypeError                                 Traceback (most recent call last)
    <ipython-input-35-e34da2fc4915> in <module>
    ----> 1 EddyMotionEstimator.fit(data)
    
    ~/workspace/EddyMotionCorrection/emc/estimator.py in fit(dwdata, n_iter, align_kwargs, model, seed, **kwargs)
         99
        100                 init_affine = dwdata.em_affines[i] if dwdata.em_affines else np.eye(4)
    --> 101                 xform = registration.optimize(
        102                     predicted,  # fixed
        103                     data_test[0],  # moving
    
    ~/.anaconda/lib/python3.8/site-packages/dipy/align/imaffine.py in optimize(***failed resolving arguments***)
       1099                 self.options['maxiter'] = max_iter
       1100
    -> 1101             opt = Optimizer(self.metric.distance_and_gradient,
       1102                             self.params0,
       1103                             method=self.method, jac=True,
    
    ~/.anaconda/lib/python3.8/site-packages/dipy/core/optimize.py in __init__(self, fun, x0, args, method, jac, hess, hessp, bounds, constraints, tol, callback, options, evolution)
        127         else:
        128
    --> 129             res = minimize(fun, x0, args, method, jac, hess, hessp, bounds,
        130                            constraints, tol, callback, options)
        131
    
    ~/.anaconda/lib/python3.8/site-packages/scipy/optimize/_minimize.py in minimize(fun, x0, args, method, jac, hess, hessp, bounds, constraints, tol, callback, options)
        615                                   **options)
        616     elif meth == 'l-bfgs-b':
    --> 617         return _minimize_lbfgsb(fun, x0, args, jac, bounds,
        618                                 callback=callback, **options)
        619     elif meth == 'tnc':
    
    ~/.anaconda/lib/python3.8/site-packages/scipy/optimize/lbfgsb.py in _minimize_lbfgsb(fun, x0, args, jac, bounds, disp, maxcor, ftol, gtol, eps, maxfun, maxiter, iprint, callback, maxls, finite_diff_rel_step, **unknown_options)
        304             iprint = disp
        305
    --> 306     sf = _prepare_scalar_function(fun, x0, jac=jac, args=args, epsilon=eps,
        307                                   bounds=new_bounds,
        308                                   finite_diff_rel_step=finite_diff_rel_step)
    
    ~/.anaconda/lib/python3.8/site-packages/scipy/optimize/optimize.py in _prepare_scalar_function(fun, x0, jac, args, bounds, epsilon, finite_diff_rel_step, hess)
        259     # ScalarFunction caches. Reuse of fun(x) during grad
        260     # calculation reduces overall function evaluations.
    --> 261     sf = ScalarFunction(fun, x0, args, grad, hess,
        262                         finite_diff_rel_step, bounds, epsilon=epsilon)
        263
    
    ~/.anaconda/lib/python3.8/site-packages/scipy/optimize/_differentiable_functions.py in __init__(self, fun, x0, args, grad, hess, finite_diff_rel_step, finite_diff_bounds, epsilon)
         74
         75         self._update_fun_impl = update_fun
    ---> 76         self._update_fun()
         77
         78         # Gradient evaluation
    
    ~/.anaconda/lib/python3.8/site-packages/scipy/optimize/_differentiable_functions.py in _update_fun(self)
        164     def _update_fun(self):
        165         if not self.f_updated:
    --> 166             self._update_fun_impl()
        167             self.f_updated = True
        168
    
    ~/.anaconda/lib/python3.8/site-packages/scipy/optimize/_differentiable_functions.py in update_fun()
         71
         72         def update_fun():
    ---> 73             self.f = fun_wrapped(self.x)
         74
         75         self._update_fun_impl = update_fun
    
    ~/.anaconda/lib/python3.8/site-packages/scipy/optimize/_differentiable_functions.py in fun_wrapped(x)
         68         def fun_wrapped(x):
         69             self.nfev += 1
    ---> 70             return fun(x, *args)
         71
         72         def update_fun():
    
    ~/.anaconda/lib/python3.8/site-packages/scipy/optimize/optimize.py in __call__(self, x, *args)
         72     def __call__(self, x, *args):
         73         """ returns the the function value """
    ---> 74         self._compute_if_needed(x, *args)
         75         return self._value
         76
    
    ~/.anaconda/lib/python3.8/site-packages/scipy/optimize/optimize.py in _compute_if_needed(self, x, *args)
         66         if not np.all(x == self.x) or self._value is None or self.jac is None:
         67             self.x = np.asarray(x).copy()
    ---> 68             fg = self.fun(x, *args)
         69             self.jac = fg[1]
         70             self._value = fg[0]
    
    ~/.anaconda/lib/python3.8/site-packages/dipy/align/imaffine.py in distance_and_gradient(self, params)
        783         """
        784         try:
    --> 785             self._update_mutual_information(params, True)
        786         except (AffineInversionError, AffineInvalidValuesError):
        787             return np.inf, 0 * self.metric_grad
    
    ~/.anaconda/lib/python3.8/site-packages/dipy/align/imaffine.py in _update_mutual_information(self, params, update_gradient)
        670
        671         # Update the histogram with the current joint intensities
    --> 672         static_values, moving_values = self._update_histogram()
        673
        674         H = self.histogram  # Shortcut to `self.histogram`
    
    ~/.anaconda/lib/python3.8/site-packages/dipy/align/imaffine.py in _update_histogram(self)
        631             pts = sp_to_moving.dot(self.samples.T).T  # Points on moving grid
        632             pts = pts[..., :self.dim]
    --> 633             self.moving_vals, inside = self.interp_method(self.moving, pts)
        634             self.moving_vals = np.array(self.moving_vals)
        635             static_values = self.static_vals
    
    dipy/core/interpolation.pyx in dipy.core.interpolation.__pyx_fused_cpdef()
    
    TypeError: No matching signature found
    ```
    oesteban committed Apr 7, 2021
    Configuration menu
    Copy the full SHA
    eece6ae View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    96f8be2 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    9217b8f View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    3745146 View commit details
    Browse the repository at this point in the history
  12. enh: speed up registration

    oesteban committed Apr 7, 2021
    Configuration menu
    Copy the full SHA
    e2a6026 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    f944412 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    bfbcac8 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    e242aa4 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    b324622 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    cfeb543 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    481bd7b View commit details
    Browse the repository at this point in the history
  19. sty: run black

    oesteban committed Apr 7, 2021
    Configuration menu
    Copy the full SHA
    203b69b View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    da92244 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    c95ab36 View commit details
    Browse the repository at this point in the history