File tree Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change
1
+ Fix bug in :func: `mne.bem.make_watershed_bem ` where function would fail if ``talairach_with_skull.lta `` did not exist due to changes in Freesurfer by `Peter Molfese `_.
Original file line number Diff line number Diff line change @@ -1256,6 +1256,25 @@ def make_watershed_bem(
1256
1256
if gcaatlas :
1257
1257
fname = op .join (env ["FREESURFER_HOME" ], "average" , "RB_all_withskull_*.gca" )
1258
1258
fname = sorted (glob .glob (fname ))[::- 1 ][0 ]
1259
+
1260
+ # check if FS>8 didn't generate talairach_with_skull.lta
1261
+ talairach_with_skull_path = os .path .join (
1262
+ subject_dir , "mri/transforms/talairach_with_skull.lta"
1263
+ )
1264
+ if not os .path .exists (talairach_with_skull_path ):
1265
+ logger .info (
1266
+ f"{ talairach_with_skull_path } does not exist. Running mri_em_register."
1267
+ )
1268
+ em_reg_cmd = [
1269
+ "mri_em_register" ,
1270
+ "-skull" ,
1271
+ subject_dir + "/mri/nu.mgz" ,
1272
+ fname ,
1273
+ talairach_with_skull_path ,
1274
+ ]
1275
+
1276
+ run_subprocess_env (em_reg_cmd )
1277
+
1259
1278
logger .info (f"Using GCA atlas: { fname } " )
1260
1279
cmd += [
1261
1280
"-atlas" ,
Original file line number Diff line number Diff line change @@ -185,7 +185,7 @@ def test_compute_fine_cal(kind):
185
185
assert got_cal ["ch_names" ] == got_cal_redo ["ch_names" ]
186
186
assert_allclose (got_cal ["imb_cals" ], got_cal_redo ["imb_cals" ], atol = 5e-5 )
187
187
assert_allclose (got_cal ["locs" ], got_cal_redo ["locs" ], atol = 1e-6 )
188
- assert sum ([ (ic == 1.0 ).any () for ic in got_cal ["imb_cals" ]]) == 0
188
+ assert sum ((ic == 1.0 ).any () for ic in got_cal ["imb_cals" ]) < 2
189
189
190
190
# redoing with 3 imlabance parameters should improve the shielding factor
191
191
grad_subpicks = np .searchsorted (meg_picks , pick_types (raw .info , meg = "grad" ))
You can’t perform that action at this time.
0 commit comments