Skip to content

Commit

Permalink
Fixed support for >1D inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanARashid committed Jan 19, 2024
1 parent ff486c3 commit 05cf746
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/wrappers/OsipiBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from scipy.stats import norm
import pathlib
import sys
from tqdm import tqdm

class OsipiBase:
"""The base class for OSIPI IVIM fitting"""
Expand Down Expand Up @@ -84,10 +85,11 @@ def osipi_fit(self, data, bvalues=None, **kwargs):
#args = [arg for arg in args if arg is not None]

# 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]):
results = np.empty(list(data.shape[:-1])+[3]) # Create an array with the voxel dimensions + the ones required for the fit
for ijk in tqdm(np.ndindex(data.shape[:-1]), total=np.prod(data.shape[:-1])):
args = [data[ijk], use_bvalues]
results[ijk] = self.ivim_fit(*args, **kwargs)
fit = list(self.ivim_fit(*args, **kwargs))
results[ijk] = fit

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

0 comments on commit 05cf746

Please sign in to comment.