@@ -193,6 +193,7 @@ def data_augmentation(input_image_list,
193
193
194
194
195
195
simulated_local_image_list = list ()
196
+ bias_field_array = None
196
197
for j in range (number_of_modalities ):
197
198
198
199
if verbose :
@@ -262,14 +263,17 @@ def data_augmentation(input_image_list,
262
263
if verbose :
263
264
print (" Adding simulated bias field." )
264
265
265
- log_field = ants .simulate_bias_field (image ,
266
- number_of_points = 10 ,
267
- sd_bias_field = sd_simulated_bias_field ,
268
- number_of_fitting_levels = 2 ,
269
- mesh_size = 10 )
270
- log_field = log_field .iMath ("Normalize" )
271
- field_array = np .power (np .exp (log_field .numpy ()), random .sample ((2 , 3 , 4 ), 1 )[0 ])
272
- image = image * ants .from_numpy_like (field_array , image )
266
+
267
+ # Keep the bias field the same across modalities
268
+ if j == 0 :
269
+ log_field = ants .simulate_bias_field (image ,
270
+ number_of_points = 10 ,
271
+ sd_bias_field = sd_simulated_bias_field ,
272
+ number_of_fitting_levels = 2 ,
273
+ mesh_size = 10 )
274
+ log_field = log_field .iMath ("Normalize" )
275
+ bias_field_array = np .power (np .exp (log_field .numpy ()), random .sample ((2 , 3 , 4 ), 1 )[0 ])
276
+ image = image * ants .from_numpy_like (bias_field_array , image )
273
277
274
278
# Histogram intensity warping
275
279
0 commit comments