Skip to content

Commit 24c5bfa

Browse files
author
IvanARashid
committed
Updated signal normalization for osipi_fit(), finds the minimum b-value signals and normalized the entire array to its mean.
1 parent b639ee9 commit 24c5bfa

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/wrappers/OsipiBase.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,14 @@ def osipi_fit(self, data, bvalues=None, **kwargs):
103103
#args = [data[ijk], use_bvalues]
104104
#fit = list(self.ivim_fit(*args, **kwargs))
105105
#results[ijk] = fit
106+
minimum_bvalue = np.min(use_bvalues) # We normalize the signal to the minimum bvalue. Should be 0 or very close to 0.
107+
b0_indices = np.where(use_bvalues == minimum_bvalue)[0]
106108

107109
for ijk in tqdm(np.ndindex(data.shape[:-1]), total=np.prod(data.shape[:-1])):
108110
# Normalize array
109111
single_voxel_data = data[ijk]
110-
single_voxel_data_s0 = single_voxel_data[0]
111-
single_voxel_data_normalized = single_voxel_data/single_voxel_data_s0
112+
single_voxel_data_normalization_factor = np.mean(single_voxel_data[b0_indices])
113+
single_voxel_data_normalized = single_voxel_data/single_voxel_data_normalization_factor
112114

113115
args = [single_voxel_data_normalized, use_bvalues]
114116
fit = self.ivim_fit(*args, **kwargs) # For single voxel fits, we assume this is a dict with a float value per key.

0 commit comments

Comments
 (0)