Skip to content

Commit

Permalink
Added support for >1D fits
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanARashid committed Jan 19, 2024
1 parent f60cd1e commit ff486c3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/wrappers/OsipiBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def initialize(**kwargs):
pass

#def osipi_fit(self, data=None, bvalues=None, thresholds=None, bounds=None, initial_guess=None, **kwargs):
def osipi_fit(self, data, bvalues, **kwargs):
def osipi_fit(self, data, bvalues=None, **kwargs):
"""Fits the data with the bvalues
Returns [S0, f, Dstar, D]
"""
Expand All @@ -68,7 +68,6 @@ def osipi_fit(self, data, bvalues, **kwargs):
#kwargs["bvalues"] = use_bvalues

#args = [data, use_bvalues, use_thresholds]
args = [data, use_bvalues]
#if self.required_bounds or self.required_bounds_optional:
#args.append(use_bounds)
#if self.required_initial_guess or self.required_initial_guess_optional:
Expand All @@ -83,7 +82,12 @@ def osipi_fit(self, data, bvalues, **kwargs):

#args = [data, use_bvalues, use_initial_guess, use_bounds, use_thresholds]
#args = [arg for arg in args if arg is not None]
results = self.ivim_fit(*args, **kwargs)

# Assuming the last dimension of the data is the signal values of each b-value
results = np.empty(data.shape[:-1], dtype=object)
for ijk in np.ndindex(data.shape[:-1]):
args = [data[ijk], use_bvalues]
results[ijk] = self.ivim_fit(*args, **kwargs)

#self.parameter_estimates = self.ivim_fit(data, bvalues)
return results
Expand Down

0 comments on commit ff486c3

Please sign in to comment.