@@ -105,7 +105,12 @@ def osipi_fit(self, data, bvalues=None, **kwargs):
105
105
#results[ijk] = fit
106
106
107
107
for ijk in tqdm (np .ndindex (data .shape [:- 1 ]), total = np .prod (data .shape [:- 1 ])):
108
- args = [data [ijk ], use_bvalues ]
108
+ # Normalize array
109
+ 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
+
113
+ args = [single_voxel_data_normalized , use_bvalues ]
109
114
fit = self .ivim_fit (* args , ** kwargs ) # For single voxel fits, we assume this is a dict with a float value per key.
110
115
for key in list (fit .keys ()):
111
116
results [key ][ijk ] = fit [key ]
@@ -141,7 +146,11 @@ def osipi_fit_full_volume(self, data, bvalues=None, **kwargs):
141
146
for key in self .result_keys :
142
147
results [key ] = np .empty (list (data .shape [:- 1 ]))
143
148
144
- args = [data , use_bvalues ]
149
+ normalization_factors = np .array ([data [..., 0 ] for i in range (data .shape [- 1 ])])
150
+ normalization_factors = np .moveaxis (normalization_factors , 0 , - 1 )
151
+ data_normalized = data / normalization_factors
152
+
153
+ args = [data_normalized , use_bvalues ]
145
154
fit = self .ivim_fit_full_volume (* args , ** kwargs ) # Assume this is a dict with an array per key representing the parametric maps
146
155
for key in list (fit .keys ()):
147
156
results [key ] = fit [key ]
0 commit comments