OSCR

9.4 Tesla MRI in focal epilepsy patients with high-resolution surface-based profiling of focal cortical dysplasias

Code ↔ Paper

8 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

4 blocks of code here have a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.

The 8 matches
  1. [1] § Methods › Surface-based analysis › Surface-based features and lesion profiles ↔ map_vol_to_surf_features.py, lines 66 to 112 · score 0.76 · N4 bias field, MPRAGE T1w, mri_coreg, intensity, FLAIR, volumes · block oscr:b:XKRZXZQP7VPQC-8 · Report a mismatch
  2. [2] § Methods › Surface-based analysis › Registration to a template space ↔ roi_vol_to_label_fsaveragesym.py, lines 82 to 110 · score 0.72 · geodesic distance, field strength, cortical surface, hemisphere, FreeSurfer, centroid · block oscr:b:X2W8FAFN7DWXJ-A · Report a mismatch
  3. [3] § Methods › MRI data acquisition › 9.4T MRI ↔ map_vol_to_surf_features.py, lines 156 to 196 · score 0.64 · T1 maps, slabs, MP2RAGE, GRE, offline, Echoes · block oscr:b:SH8N8JFJXJNFZ-4 · Report a mismatch
  4. [4] § Methods › Surface-based analysis › High-resolution profiling of T2* data ↔ plot_laynii.ipynb, lines 302 to 333 · score 0.62 · lesion centroid, target profile, scatterplot, RMSE, laynii, voxel · Report a mismatch
  5. [5] § Methods › Surface-based analysis › Segmentation and cortical surface reconstruction ↔ mp2rage_robust_denoise.py, lines 10 to 81 · score 0.60 · uniform T1, MP2RAGE, denoised, beta · block oscr:b:MS6EYT665FRJP-R · Report a mismatch
  6. [6] § Methods › Surface-based analysis › Segmentation and cortical surface reconstruction ↔ map_vol_to_surf_features.py, lines 156 to 196 · score 0.60 · N4 bias field, MP2RAGE, FreeSurfer, brain · block oscr:b:SH8N8JFJXJNFZ-4 · Report a mismatch
  7. [7] § Methods › Surface-based analysis › Registration to a template space ↔ plot_surf_features.ipynb, lines 161 to 254 · score 0.58 · contralateral hemisphere, homotopic regions, lesional, pial · Report a mismatch
  8. [8] § Methods › MRI data acquisition › 9.4T MRI ↔ mp2rage_robust_denoise.py, lines 10 to 81 · score 0.50 · UNI, positioned, MP2RAGE, coil, inversion, Max · block oscr:b:MS6EYT665FRJP-R · Report a mismatch

Paper

Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

Python · 410 lines · 20 KB · no license · 3 matches

  1. import os
  2. import glob
  3. import shutil
  4. import argparse
  5. import numpy as np
  6. import scipy.ndimage
  7. import nibabel as nib
  8. import ants
  9. import dataset_paths
  10. import util
  11. def surface_features(freesurfer_dir, subj_id, threads=1):
  12. os.environ['SUBJECTS_DIR'] = freesurfer_dir
  13. vols_3T, vols_94T = coreg_other_vols(freesurfer_dir, subj_id, return_existing_vols=False, threads=threads)
  14. reestimate_thickness_max(freesurfer_dir, subj_id)
  15. reestimate_w_g_contrast(freesurfer_dir, f'sub-{subj_id}_3T')
  16. reestimate_w_g_contrast(freesurfer_dir, f'sub-{subj_id}_94T')
  17. sample_vol2surf_all_volumes(freesurfer_dir, subj_id, vols_3T, vols_94T)
  18. resample_surf_features_fsaverage_sym(freesurfer_dir,
  19. f'sub-{subj_id}_3T',
  20. f'{freesurfer_dir}/sub-{subj_id}_3T/new/surf')
  21. resample_surf_features_fsaverage_sym(freesurfer_dir,
  22. f'sub-{subj_id}_94T',
  23. f'{freesurfer_dir}/sub-{subj_id}_94T/new/surf')
  24. def normalize_intensities(freesurfer_subj_folder, input_filename, output_filename):
  25. filename_aseg = f'{freesurfer_subj_folder}/mri/aseg.mgz'
  26. aseg = nib.load(filename_aseg)
  27. # select lh and rh white matter (indices 2 and 41) and cortex (indices 3 and 42)
  28. wm = np.isin(aseg.get_fdata(),[2, 41]) #.astype(float)
  29. cortex = np.isin(aseg.get_fdata(),[3, 42])
  30. # erode
  31. strel = scipy.ndimage.generate_binary_structure(3, 1)
  32. wm_eroded = scipy.ndimage.binary_erosion(wm, strel)
  33. cortex_eroded = scipy.ndimage.binary_erosion(cortex, strel)
  34. image = nib.load(input_filename)
  35. image_data = image.get_fdata()
  36. wm_median = np.median(image_data[wm_eroded])
  37. cortex_median = np.median(image_data[cortex_eroded])
  38. if 'FLAIR' in input_filename: # T2/FLAIR-contrast, i.e.: cortex has higher intensities than white matter
  39. normalized = (image_data - wm_median) / (cortex_median - wm_median)
  40. else:
  41. normalized = (image_data - cortex_median) / (wm_median - cortex_median)
  42. output = nib.Nifti1Image(normalized, image.affine, image.header)
  43. nib.save(output, output_filename)
  44. def select_single_path(paths, subj_id, b0, sequence):
  45. path = paths[(paths['subj_id'] == subj_id) & (paths['B0'] == b0) & (paths['sequence'] == sequence)]['path'].values
  46. if len(path) == 1:
  47. return path[0]
  48. elif len(path) == 0:
  49. return None
  50. else:
  51. raise ValueError(f'More than 1 path found for {subj_id} {b0} {sequence}')
  52. def coreg_other_vols(freesurfer_dir, subj_id, return_existing_vols=False, threads=1):
  53. paths = dataset_paths.get_3T94T_paths()
  54. # 3T #####################
  55. freesurfer_id_3T = f'sub-{subj_id}_3T'
  56. outdir = f'{freesurfer_dir}/{freesurfer_id_3T}/new'
  57. os.makedirs(outdir, exist_ok=True)
  58. vols_3T = []
  59. # FLAIR
  60. path_FLAIR_3T = select_single_path(paths, subj_id, '3T', 'FLAIR')
  61. outpath_FLAIR_3T = f'{outdir}/FLAIR_N4_to_orig_norm.nii.gz'
  62. if path_FLAIR_3T is not None:
  63. # N4 bias field correction
  64. FLAIR_N4_path = f'{outdir}/FLAIR_N4.nii.gz'
  65. im_FLAIR = ants.image_read(path_FLAIR_3T)
  66. im_FLAIR_N4 = ants.n4_bias_field_correction(im_FLAIR,
  67. convergence={'iters': [50, 50, 50, 50], 'tol': 1e-7},
  68. verbose=False)
  69. ants.image_write(im_FLAIR_N4, FLAIR_N4_path)
  70. # coreg with ref mask (because there is much extra-cerebral tissue in
  71. # FLAIR and good grey-white contrast in the brain)
  72. FLAIR_reg_path = f'{outdir}/FLAIR_N4_to_orig_reg.lta'
  73. cmd = f'mri_coreg --mov {FLAIR_N4_path} --ref {outdir}/../mri/orig.mgz --reg {FLAIR_reg_path} --s {freesurfer_id_3T} --dof 12 --threads {threads}'
  74. util.bash_run(cmd)
  75. FLAIR_N4_to_orig_path = f'{outdir}/FLAIR_N4_to_orig.nii.gz'
  76. cmd = f'mri_vol2vol --mov {FLAIR_N4_path} --o {FLAIR_N4_to_orig_path} --reg {FLAIR_reg_path} --fstarg --trilinear'
  77. util.bash_run(cmd)
  78. # normalize
  79. normalize_intensities(f'{freesurfer_dir}/{freesurfer_id_3T}', FLAIR_N4_to_orig_path, outpath_FLAIR_3T)
  80. vols_3T.append(outpath_FLAIR_3T)
  81. # MPRAGE T1w
  82. path_T1w_3T = select_single_path(paths, subj_id, '3T', 'T1w')
  83. outpath_T1w_3T = f'{outdir}/T1w_N4_to_orig_norm.nii.gz'
  84. if path_T1w_3T is not None:
  85. # N4 bias field correction
  86. T1w_N4_path = f'{outdir}/T1w_N4.nii.gz'
  87. im_T1w = ants.image_read(path_T1w_3T)
  88. im_T1w_N4 = ants.n4_bias_field_correction(im_T1w,
  89. convergence={'iters': [50, 50, 50, 50], 'tol': 1e-7},
  90. verbose=False)
  91. ants.image_write(im_T1w_N4, T1w_N4_path)
  92. # coreg with ref mask (because there is much extra-cerebral tissue in
  93. # the T1w and good grey-white contrast in the brain)
  94. T1w_reg_path = f'{outdir}/T1w_N4_to_orig_reg.lta'
  95. cmd = f'mri_coreg --mov {T1w_N4_path} --ref {outdir}/../mri/orig.mgz --reg {T1w_reg_path} --s {freesurfer_id_3T} --dof 12 --threads {threads}'
  96. util.bash_run(cmd)
  97. T1w_N4_to_orig_path = f'{outdir}/T1w_N4_to_orig.nii.gz'
  98. cmd = f'mri_vol2vol --mov {T1w_N4_path} --o {T1w_N4_to_orig_path} --reg {T1w_reg_path} --fstarg --trilinear'
  99. util.bash_run(cmd)
  100. # normalize
  101. normalize_intensities(f'{freesurfer_dir}/{freesurfer_id_3T}', T1w_N4_to_orig_path, outpath_T1w_3T)
  102. vols_3T.append(outpath_T1w_3T)
  103. # MP2RAGE UNIT1 3T
  104. path_UNIT1_3T = select_single_path(paths, subj_id, '3T', 'UNIT1')
  105. outpath_UNIT1_3T = f'{outdir}/UNIT1_conform_orig.nii.gz'
  106. if path_UNIT1_3T is not None:
  107. # this needs to be output type float because mri_convert otherwise converts to uchar (8bit int)
  108. cmd = f'mri_convert {path_UNIT1_3T} {outdir}/UNIT1_conform_orig.nii.gz --conform -odt float'
  109. util.bash_run(cmd)
  110. vols_3T.append(outpath_UNIT1_3T)
  111. # T1map 3T
  112. path_T1map_3T = select_single_path(paths, subj_id, '3T', 'T1map')
  113. outpath_T1map_3T = f'{outdir}/T1map_conform_orig.nii.gz'
  114. if path_T1map_3T is not None:
  115. # this needs to be output type float because mri_convert otherwise converts to uchar (8bit int)
  116. cmd = f'mri_convert {path_T1map_3T} {outdir}/T1map_conform_orig.nii.gz --conform -odt float'
  117. util.bash_run(cmd)
  118. vols_3T.append(outpath_T1map_3T)
  119. # 94T #####################
  120. freesurfer_id_94T = f'sub-{subj_id}_94T'
  121. outdir = f'{freesurfer_dir}/{freesurfer_id_94T}/new'
  122. os.makedirs(outdir, exist_ok=True)
  123. vols_94T = []
  124. # MP2RAGE UNIT1 94T
  125. path_UNIT1_94T = select_single_path(paths, subj_id, '94T', 'UNIT1')
  126. outpath_UNIT1_94T = f'{outdir}/UNIT1_conform_orig.nii.gz'
  127. if path_UNIT1_94T is not None:
  128. # this needs to be output type float because mri_convert otherwise converts to uchar (8bit int)
  129. cmd = f'mri_convert {path_UNIT1_94T} {outdir}/UNIT1_conform_orig.nii.gz -cm -odt float'
  130. util.bash_run(cmd)
  131. vols_94T.append(outpath_UNIT1_94T)
  132. # T1map
  133. path_T1map_94T = select_single_path(paths, subj_id, '94T', 'T1map')
  134. outpath_T1map_94T = f'{outdir}/T1map_conform_orig.nii.gz'
  135. if path_T1map_94T is not None:
  136. # this needs to be output type float because mri_convert otherwise converts to uchar (8bit int)
  137. cmd = f'mri_convert {path_T1map_94T} {outdir}/T1map_conform_orig.nii.gz -cm -odt float'
  138. util.bash_run(cmd)
  139. vols_94T.append(outpath_T1map_94T)
  140. # QSM 3DFLASH echo 1, we need to coregister this to be able to align the QSM data
  141. path_GREecho1_94T = select_single_path(paths, subj_id, '94T', 'GREecho1')
  142. if path_GREecho1_94T is not None:
  143. # N4 bias field correction
  144. GREecho1_offline_N4_path = f'{outdir}/GREecho1_offline_N4.nii.gz'
  145. im_GREecho1_offline = ants.image_read(path_GREecho1_94T)
  146. im_GREecho1_offline_N4 = ants.n4_bias_field_correction(im_GREecho1_offline,
  147. convergence={'iters': [50, 50, 50, 50], 'tol': 1e-7},
  148. verbose=False)
  149. ants.image_write(im_GREecho1_offline_N4, GREecho1_offline_N4_path)
  150. # coreg without ref mask (because GRE is a slab only and not such a
  151. # good grey-white contrast in the brain), so skull and dura aid in
  152. # registration
  153. GREecho1_offline_reg_path = f'{outdir}/GREecho1_offline_N4_to_orig_reg.lta'
  154. cmd = f'mri_coreg --mov {GREecho1_offline_N4_path} --ref {outdir}/../mri/orig.mgz --reg {GREecho1_offline_reg_path} --s {freesurfer_id_94T} --no-ref-mask --dof 12 --threads {threads}'
  155. util.bash_run(cmd)
  156. GREecho1_offline_N4_to_orig_path = f'{outdir}/GREecho1_offline_N4_to_orig.nii.gz'
  157. cmd = f'mri_vol2vol --mov {GREecho1_offline_N4_path} --o {GREecho1_offline_N4_to_orig_path} --reg {GREecho1_offline_reg_path} --fstarg --trilinear'
  158. util.bash_run(cmd)
  159. # QSM Tke 12
  160. path_QSMTke12_94T = select_single_path(paths, subj_id, '94T', 'QSMTke12')
  161. QSMTKe12_to_orig_path = f'{outdir}/QSMTke12_to_orig.nii.gz'
  162. cmd = f'mri_vol2vol --mov {path_QSMTke12_94T} --o {QSMTKe12_to_orig_path} --reg {GREecho1_offline_reg_path} --fstarg --trilinear'
  163. util.bash_run(cmd)
  164. vols_94T.append(QSMTKe12_to_orig_path)
  165. # QSM Tke 3
  166. path_QSMTke3_94T = select_single_path(paths, subj_id, '94T', 'QSMTke3')
  167. QSMTke3_to_orig_path = f'{outdir}/QSMTke3_to_orig.nii.gz'
  168. cmd = f'mri_vol2vol --mov {path_QSMTke3_94T} --o {QSMTke3_to_orig_path} --reg {GREecho1_offline_reg_path} --fstarg --trilinear'
  169. util.bash_run(cmd)
  170. vols_94T.append(QSMTke3_to_orig_path)
  171. # a different echo 1 in alignment with the R2star
  172. path_R2star_scanner_94T = select_single_path(paths, subj_id, '94T', 'R2star_scanner')
  173. path_GREecho1_scanner_94T = select_single_path(paths, subj_id, '94T', 'GREecho1_scanner')
  174. if path_R2star_scanner_94T is not None:
  175. if not subj_id == 'P009': # special case for P009, see below
  176. # coregister the scanner reconstruction echo 1 to the offline reconstruciton echo 1
  177. GREecho1_scanner_to_offline_reg_path = f'{outdir}/GREecho1_scanner_to_offline_reg.lta'
  178. cmd = f'mri_coreg --mov {path_GREecho1_scanner_94T} --ref {path_GREecho1_94T} --reg {GREecho1_scanner_to_offline_reg_path} --s {freesurfer_id_94T} --no-ref-mask --dof 12 --threads {threads}'
  179. util.bash_run(cmd)
  180. # combine the two registrations
  181. GREecho1_scanner_to_orig_reg_path = f'{outdir}/GREecho1_scanner_to_orig_reg.lta'
  182. cmd = f'mri_concatenate_lta {GREecho1_scanner_to_offline_reg_path} {GREecho1_offline_reg_path} {GREecho1_scanner_to_orig_reg_path}'
  183. util.bash_run(cmd)
  184. GREecho1_scanner_to_orig_path = f'{outdir}/GREecho1_scanner_to_orig.nii.gz'
  185. cmd = f'mri_vol2vol --mov {path_GREecho1_scanner_94T} --o {GREecho1_scanner_to_orig_path} --reg {GREecho1_scanner_to_orig_reg_path} --fstarg --trilinear'
  186. util.bash_run(cmd)
  187. # R2star is in register with the scanner reconstruction echo 1
  188. out = f'{outdir}/R2star_to_orig.nii.gz'
  189. cmd = f'mri_vol2vol --mov {path_R2star_scanner_94T} --o {out} --reg {GREecho1_scanner_to_orig_reg_path} --fstarg --trilinear'
  190. util.bash_run(cmd)
  191. vols_94T.append(out)
  192. # also the T2starmap
  193. path_T2star_scanner_94T = glob.glob(f'data/derivatives/T2starmaps/sub-{subj_id}/**/*T2starmap.nii.gz', recursive=True)
  194. if len(path_T2star_scanner_94T) == 1:
  195. path_T2star_scanner_94T = path_T2star_scanner_94T[0]
  196. out = f'{outdir}/T2star_to_orig.nii.gz'
  197. cmd = f'mri_vol2vol --mov {path_T2star_scanner_94T} --o {out} --reg {GREecho1_scanner_to_orig_reg_path} --fstarg --trilinear'
  198. util.bash_run(cmd)
  199. vols_94T.append(out)
  200. else:
  201. print(f'No unique T2star path found for subject {subj_id}')
  202. else: #special case for P009
  203. # for P009, the R2star was reconstructed offline, so is in register with
  204. # the GREecho1_94T and other files
  205. out = f'{outdir}/R2star_to_orig.nii.gz'
  206. cmd = f'mri_vol2vol --mov {path_R2star_scanner_94T} --o {out} --reg {GREecho1_offline_reg_path} --fstarg --trilinear'
  207. util.bash_run(cmd)
  208. vols_94T.append(out)
  209. # T2starmap
  210. path_T2star_scanner_94T = glob.glob(f'data/derivatives/T2starmaps/sub-{subj_id}/**/*T2starmap.nii.gz', recursive=True)
  211. if len(path_T2star_scanner_94T) == 1:
  212. path_T2star_scanner_94T = path_T2star_scanner_94T[0]
  213. out = f'{outdir}/T2star_to_orig.nii.gz'
  214. cmd = f'mri_vol2vol --mov {path_T2star_scanner_94T} --o {out} --reg {GREecho1_offline_reg_path} --fstarg --trilinear'
  215. util.bash_run(cmd)
  216. vols_94T.append(out)
  217. else:
  218. print(f'No unique T2star path found for subject {subj_id}')
  219. return vols_3T, vols_94T
  220. def reestimate_thickness_max(freesurfer_dir, subj_id, max = 15.0):
  221. """resample cortical thickness with maximum of 15 mm (instead of default 5 mm)"""
  222. # 3T #####################
  223. freesurfer_id_3T = f'sub-{subj_id}_3T'
  224. outdir = f'{freesurfer_dir}/{freesurfer_id_3T}/new/surf'
  225. os.makedirs(outdir, exist_ok=True)
  226. for hemi in ['lh', 'rh']:
  227. if os.path.exists(f'{outdir}/nthickness_{hemi}.mgh'):
  228. continue
  229. cmd = f'mris_thickness -max {max} {freesurfer_id_3T} {hemi} {outdir}/nthickness_{hemi}.mgh'
  230. util.bash_run(cmd)
  231. # because mris_thickness always prepends a lh/rh to the output filename, rename the file
  232. os.rename(f'{outdir}/{hemi}.nthickness_{hemi}.mgh',f'{outdir}/nthickness_{hemi}.mgh')
  233. # 94T #####################
  234. freesurfer_id_94T = f'sub-{subj_id}_94T'
  235. outdir = f'{freesurfer_dir}/{freesurfer_id_94T}/new/surf'
  236. os.makedirs(outdir, exist_ok=True)
  237. for hemi in ['lh', 'rh']:
  238. if os.path.exists(f'{outdir}/nthickness_{hemi}.mgh'):
  239. continue
  240. cmd = f'mris_thickness -max {max} {freesurfer_id_94T} {hemi} {outdir}/nthickness_{hemi}.mgh'
  241. util.bash_run(cmd)
  242. # because mris_thickness always prepends a lh/rh to the output filename, rename the file
  243. os.rename(f'{outdir}/{hemi}.nthickness_{hemi}.mgh',f'{outdir}/nthickness_{hemi}.mgh')
  244. def reestimate_w_g_contrast(freesurfer_dir, freesurfer_id):
  245. outdir = f'{freesurfer_dir}/{freesurfer_id}/new/surf'
  246. os.makedirs(outdir, exist_ok=True)
  247. UNIT1_nifti = f'{freesurfer_dir}/{freesurfer_id}/new/UNIT1_conform_orig.nii.gz'
  248. UNIT1_mgz = f'{freesurfer_dir}/{freesurfer_id}/new/UNIT1_conform_orig.mgz'
  249. if os.path.exists(UNIT1_nifti):
  250. UNIT1 = nib.load(UNIT1_nifti)
  251. UNIT1_data = UNIT1.get_fdata()
  252. if UNIT1_data.min() < 0:
  253. # if the UNIT1 has negative values, it is probably in the range [-0.5,0.5]
  254. # needs to be rescaled to positive values
  255. UNIT1_data = UNIT1_data + 0.5
  256. # write back to new file
  257. UNIT1_nifti = f'{freesurfer_dir}/{freesurfer_id}/new/UNIT1_conform_orig_pos.nii.gz'
  258. nib.save(nib.Nifti1Image(UNIT1_data, UNIT1.affine, UNIT1.header), UNIT1_nifti)
  259. cmd = f'mri_convert {UNIT1_nifti} {UNIT1_mgz}'
  260. util.bash_run(cmd)
  261. cmd = f'pctsurfcon --s {freesurfer_id} --fsvol ../new/UNIT1_conform_orig --b w-g.pct.UNIT1_conform_orig'
  262. util.bash_run(cmd)
  263. for hemi in ['lh', 'rh']:
  264. surf_file = f'{freesurfer_dir}/{freesurfer_id}/surf/{hemi}.w-g.pct.UNIT1_conform_orig.mgh'
  265. shutil.move(surf_file,f'{outdir}/w-g.pct.UNIT1_{hemi}.mgh')
  266. def sample_vol2surf(freesurfer_dir,
  267. freesurfer_subjid,
  268. source_vol,
  269. projfracs,
  270. projdists,
  271. projabs):
  272. outdir = f'{freesurfer_dir}/{freesurfer_subjid}/new/surf'
  273. os.makedirs(outdir, exist_ok=True)
  274. source_base = os.path.basename(source_vol).replace('.nii.gz','')
  275. for hemi in ['lh', 'rh']:
  276. for projfrac in projfracs:
  277. out = f'{outdir}/{source_base}_projrel{projfrac}_{hemi}.mgh'
  278. if not os.path.isfile(out):
  279. cmd = f'mri_vol2surf --src {source_vol} --out {out} --cortex --hemi {hemi} --regheader {freesurfer_subjid} --projfrac {projfrac}'
  280. util.bash_run(cmd)
  281. for projdist in projdists:
  282. out = f'{outdir}/{source_base}_projrel{projdist}_{hemi}.mgh'
  283. if not os.path.isfile(out):
  284. cmd = f'mri_vol2surf --src {source_vol} --out {out} --cortex --hemi {hemi} --regheader {freesurfer_subjid} --projdist {projdist}'
  285. util.bash_run(cmd)
  286. for projab in projabs:
  287. out = f'{outdir}/{source_base}_projabs{projab}_{hemi}.mgh'
  288. if not os.path.isfile(out):
  289. cmd = f'mri_vol2surf --src {source_vol} --out {out} --cortex --hemi {hemi} --regheader {freesurfer_subjid} --projdist {projab} --surf pial'
  290. util.bash_run(cmd)
  291. def sample_vol2surf_all_volumes(freesurfer_dir,
  292. subj_id,
  293. vols_3T,
  294. vols_94T,
  295. projfracs = [0.0, 0.25, 0.5, 0.75],
  296. projdists = [-1.0, -2.0],
  297. projabs = [-1.0, -2.0, -3.0, -4.0, -5.0, -6.0]):
  298. for v in vols_3T:
  299. sample_vol2surf(freesurfer_dir,
  300. f'sub-{subj_id}_3T',
  301. v,
  302. projfracs,
  303. projdists,
  304. projabs)
  305. for v in vols_94T:
  306. sample_vol2surf(freesurfer_dir,
  307. f'sub-{subj_id}_94T',
  308. v,
  309. projfracs,
  310. projdists,
  311. projabs)
  312. def resample_surf_features_fsaverage_sym(freesurfer_dir, freesufer_subjid, folder):
  313. surf_features_lh = glob.glob(f'{folder}/*lh.mgh')
  314. # filter out fsaverage_sym_lh files in case this is re-run
  315. surf_features_lh = [f for f in surf_features_lh if not 'fsaverage_sym' in f]
  316. surf_features_rh = glob.glob(f'{folder}/*rh.mgh')
  317. for f in surf_features_lh:
  318. base = f.replace('.mgh','')
  319. if os.path.isfile(f'{base}_fsaverage_sym_lh.mgh') and not 'abs' in base:
  320. continue
  321. cmd = f'mris_apply_reg --src {f} --trg {base}_fsaverage_sym_lh.mgh --streg {freesurfer_dir}/{freesufer_subjid}/surf/lh.fsaverage_sym.sphere.reg {freesurfer_dir}/fsaverage_sym/surf/lh.sphere.reg'
  322. util.bash_run(cmd)
  323. for f in surf_features_rh:
  324. base = f.replace('.mgh','')
  325. if os.path.isfile(f'{base}_fsaverage_sym_lh.mgh') and not 'abs' in base:
  326. continue
  327. cmd = f'mris_apply_reg --src {f} --trg {base}_fsaverage_sym_lh.mgh --streg {freesurfer_dir}/{freesufer_subjid}/xhemi/surf/lh.fsaverage_sym.sphere.reg {freesurfer_dir}/fsaverage_sym/surf/lh.sphere.reg'
  328. util.bash_run(cmd)
  329. if __name__ == '__main__':
  330. argparser = argparse.ArgumentParser(description='map volume data to freesurfer surface reconstructions')
  331. argparser.add_argument('freesurfer_dir', type=str, help='Path to freesurfer directory')
  332. argparser.add_argument('subj_id', type=str, help='Subject ID (e.g., P001)')
  333. argparser.add_argument('--threads', type=int, default=1, help='Number of threads to use for coregistration (default: 1)')
  334. args = argparser.parse_args()
  335. surface_features(freesurfer_dir=args.freesurfer_dir,
  336. subj_id=args.subj_id,
  337. threads=args.threads)

map_vol_to_surf_features.py at commit dda99e4, no license · at the source

Overview

Authors: Cornelius Kronlage1,2,3, Pascal Martin1,2, Benjamin Bender4, Gisela E. Hagberg5,6, Jonas Bause5,6, Joana RA Loureiro5,6, Mathilde Ripart3,7, Sophie Adler3,7, Konrad Wagstyl3,7, Holger Lerche1,2, Niels KN Focke1, Klaus Scheffler5,6, Esther Kuehn2,8
  1. Department of Neurology and Epileptology, University of Tuebingen Medical Faculty, Tuebingen, Germany
  2. Hertie Institute for Clinical Brain Research, University of Tuebingen Medical Faculty, Tuebingen, Germany
  3. School of Biomedical Engineering and Imaging Sciences, King’s College London, London, UK
  4. Department of Neuroradiology, University Hospital Tuebingen and University of Tuebingen, Tuebingen, Germany
  5. Department of High-Field Magnetic Resonance, Max-Planck-Institute for Biological Cybernetics, Tuebingen, Germany
  6. Biomedical Magnetic Resonance, University Hospital of Tübingen, Tübingen, Germany
  7. UCL Great Ormond Street Institute of Child Health, University College London, London, UK
  8. German Center for Neurodegenerative Diseases (DZNE), Tübingen, Germany
Dates: published online 7 April 2026
Type: Preprint
License: CC BY
Identifiers: DOI 10.64898/2026.04.02.26349812 · OpenAlex W7151257401
Open access: green, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: structural MRI / diffusion (modality), human (organism), epilepsy (population), clinical / translational (subfield)
Methods: Connectivity, Preprocessing
Topic: Epilepsy research and treatment (Clinical Neurology, Medicine), according to OpenAlex
Funding: Wellcome Trust; Deutsche Forschungsgemeinschaft; Bundesministerium für Bildung und Forschung (W-de.NBI-014, W-de.NBI-022, 01GQ2101, W-de.NBI-010); Forschungszentrum Jülich (NBI-022, NBI-010, NBI-008, NBI-014, NBI-013, NBI-016, NBI-004, NBI-001); German Network for Bioinformatics Infrastructure (W‐de.NBI‐013, W‐de.NBI‐016, W‐de.NBI‐014, W-de.NBI-022, W-de.NBI-010, W-de.NBI-004, W-de.NBI-008)
Citations: not cited yet (Europe PMC); 47 references in the paper

Abstract

Background: The detection of subtle epileptogenic lesions such as focal cortical dysplasias (FCDs) is a clinical challenge in the management of drug-resistant focal epilepsy (DRFE). Ultra-high field (UHF) MRI offers increased signal-to-noise ratios and spatial resolution compared to 3 Tesla (T) MRI and may improve diagnostic yield. Here, we present a 9.4T MRI cohort study of patients with DRFE.

Methods: We recruited n=21 DRFE patients (with 3T-MRI findings: 2 positive, 3 equivocal, 16 negative) undergoing presurgical workup, and n=20 healthy controls for 9.4T MRI (0.8 mm isotropic MP2RAGE, slabs of 0.375 x 0.375 x 0.8 mm T2*-weighted GRE) and 3T MRI (MP2RAGE, FLAIR) acquisitions. Visual review for possible epileptogenic lesions was performed by clinical experts. For histopathologically confirmed FCD lesions, we extracted surface-based quantitative features (cortical thickness, qT1, FLAIR, T2*, and QSM values) across cortical depths and distances from the lesion centre and performed high-resolution cortical profiling of 9.4T T2* values.

Results: No new epileptogenic lesions were visually identified at 9.4T in 3T MRI negative patients. In the two patients with histopathologically confirmed lesions, the FCD IIb lesions were visible with distinct qualitative and quantitative features at both field strengths. One of these FCD IIb showed a focal cortical T2* reduction at 9.4T that could here be quantified via automated cortical profiling, consistent with the previously described “black line sign”.

Conclusion: 9.4T MRI findings in epileptogenic lesions underlying DRFE are consistent with those on 3T MRI. While additional lesions were not identified in patients with negative 3T MRI, higher resolution T2*-weighted sequences can reveal a feature not seen at 3T: Cortical profiling of FCDs highlights the black line sign and can possibly help refine surgical or ablation targeting for some FCDs. Further optimization of UHF protocols and analysis methods on larger cohorts may reveal clinically applicable diagnostic benefits.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repository

Its files are read in the Code ↔ Paper reader above, with 8 matches between paragraphs and lines of code.

ckronlage/3T9T_profiling_pub

License: none: the authors keep all their rights
State: the link answers, verified on 29 September 2026
Evidence: files inventoried
Commit: dda99e4595514ee89f06624535355b0d7f248f79, 16 February 2026
Languages: Python (10), Jupyter (3), Shell (1)
Size: 20 files, 14 scripts
Software Heritage: not archived
Found in: “Data and code availability”
Holds: README, environment (environment.yml, environment_snakemake.yml), 3 notebooks
Not found: license file, CITATION.cff, tests, continuous integration, documentation
Tools: NiBabel (8 files), NumPy (8 files), pandas (4 files), Matplotlib (3 files), ANTs (2 files), Nilearn (2 files), SciPy (2 files), FreeSurfer (1 file), seaborn (1 file)
Availability: 1 check, the latest on 29 September 2026: the link answers
  • 29 September 2026: the link answers
15 files

The paper's code and data availability statement is in the Data section.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 14 scripts, each with its path and the digest of its content;
  • 8 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

No dataset and no data link were found in the paper.

Data and code availability

The healthy volunteer 9.4T MP2RAGE data has been published as part of a larger dataset40. It is currently not possible to make the patient imaging data openly accessible due to data protection regulations as specified in the ethics application approved by the local ethics committee (Tübingen University, reference number 390/2014BO1). The code used for analysis is available at https://github.com/ckronlage/3T9T_profiling_pub.

Reproduced under the paper's license (CC BY), from the paper cited above.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 29 September 2026: the first record

Recorded: type, journal, dates, 13 authors, 5 funders, 46 references.

Cite

This paper

Kronlage, C., Martin, P., Bender, B., Hagberg, G. E., Bause, J., Loureiro, J. R., Ripart, M., Adler, S., Wagstyl, K., Lerche, H., Focke, N. K., Scheffler, K., & Kuehn, E. (2026). 9.4 Tesla MRI in focal epilepsy patients with high-resolution surface-based profiling of focal cortical dysplasias. medRxiv (preprint). https://doi.org/10.64898/2026.04.02.26349812

BibTeX

@article{kronlage20269,
author = {Kronlage, Cornelius and Martin, Pascal and Bender, Benjamin and Hagberg, Gisela E. and Bause, Jonas and Loureiro, Joana RA and Ripart, Mathilde and Adler, Sophie and Wagstyl, Konrad and Lerche, Holger and Focke, Niels KN and Scheffler, Klaus and Kuehn, Esther},
title = {{9.4 Tesla MRI in focal epilepsy patients with high-resolution surface-based profiling of focal cortical dysplasias}},
journal = {medRxiv (preprint)},
year = {2026},
month = apr,
publisher = {medRxiv},
doi = {10.64898/2026.04.02.26349812},
url = {https://doi.org/10.64898/2026.04.02.26349812}
}

RIS

TY - JOUR
AU - Kronlage, Cornelius
AU - Martin, Pascal
AU - Bender, Benjamin
AU - Hagberg, Gisela E.
AU - Bause, Jonas
AU - Loureiro, Joana RA
AU - Ripart, Mathilde
AU - Adler, Sophie
AU - Wagstyl, Konrad
AU - Lerche, Holger
AU - Focke, Niels KN
AU - Scheffler, Klaus
AU - Kuehn, Esther
TI - 9.4 Tesla MRI in focal epilepsy patients with high-resolution surface-based profiling of focal cortical dysplasias
T2 - medRxiv (preprint)
J2 - medRxiv
PY - 2026
DA - 2026/04/07
PB - medRxiv
DO - 10.64898/2026.04.02.26349812
UR - https://doi.org/10.64898/2026.04.02.26349812
ER -

CSL-JSON

{
"id": "10.64898/2026.04.02.26349812",
"type": "article",
"title": "9.4 Tesla MRI in focal epilepsy patients with high-resolution surface-based profiling of focal cortical dysplasias",
"container-title": "medRxiv (preprint)",
"author": [
{
"family": "Kronlage",
"given": "Cornelius"
},
{
"family": "Martin",
"given": "Pascal"
},
{
"family": "Bender",
"given": "Benjamin"
},
{
"family": "Hagberg",
"given": "Gisela E."
},
{
"family": "Bause",
"given": "Jonas"
},
{
"family": "Loureiro",
"given": "Joana RA"
},
{
"family": "Ripart",
"given": "Mathilde"
},
{
"family": "Adler",
"given": "Sophie"
},
{
"family": "Wagstyl",
"given": "Konrad"
},
{
"family": "Lerche",
"given": "Holger"
},
{
"family": "Focke",
"given": "Niels KN"
},
{
"family": "Scheffler",
"given": "Klaus"
},
{
"family": "Kuehn",
"given": "Esther"
}
],
"container-title-short": "medRxiv",
"DOI": "10.64898/2026.04.02.26349812",
"publisher": "medRxiv",
"URL": "https://doi.org/10.64898/2026.04.02.26349812",
"issued": {
"date-parts": [
[
2026,
4,
7
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1007/s00234-026-04103-8 [code]
Enhanced detection of subtle cortical abnormalities in focal epilepsy using 7 T MRI surface-based models and graph neural networks.
Journal: Neuroradiology
In common: Nilearn, FreeSurfer, NiBabel, 5 other tools, epilepsy, structural MRI / diffusion, 9 references
[2] doi:10.1093/brain/awac224 [code]
Interpretable surface-based detection of focal cortical dysplasias: a Multi-centre Epilepsy Lesion Detection study.
Journal: Brain : a journal of neurology
In common: Nilearn, FreeSurfer, NiBabel, 5 other tools, epilepsy, structural MRI / diffusion, clinical / translational, 4 references
[3] doi:10.1002/epi4.70336 [code]
Quantifying extra-lesional interhemispheric cortical asymmetry in focal cortical dysplasia type II.
Journal: Epilepsia open
In common: Nilearn, NiBabel, seaborn, 4 other tools, epilepsy, structural MRI / diffusion, clinical / translational, 5 references
[4] doi:10.1016/j.isci.2026.117446 [code]
Volume-inflation registration (INFREG) for morphometric analysis of human focal cortical dysplasia type II.
Journal: iScience
In common: FreeSurfer, NiBabel, pandas, 3 other tools, epilepsy, structural MRI / diffusion, 5 references
[5] doi:10.64898/2026.08.18.26360725 [code]
Temporal pole blurring in hippocampal sclerosis reflects seizure-disrupted myelination
Journal: medRxiv (preprint)
In common: Nilearn, FreeSurfer, NiBabel, 5 other tools, epilepsy, structural MRI / diffusion, 3 references
[6] doi:10.1162/imag.a.1366 [code]
MICAFlow: Fast and robust MRI preprocessing bridging research neuroimaging and clinical practice.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: ANTs, Nilearn, FreeSurfer, 4 other tools, epilepsy, structural MRI / diffusion, 4 references
[7] doi:10.1177/15357597251332191 [code]
Imaging Epilepsy: Past, Passing, and to Come.
Journal: Epilepsy currents
In common: Nilearn, FreeSurfer, NiBabel, 5 other tools, epilepsy, structural MRI / diffusion, clinical / translational, 2 references
[8] doi:10.1038/s41467-026-71555-0 [code]
A deep representation learning model to predict response to vagus nerve stimulation.
Journal: Nature communications
In common: ANTs, FreeSurfer, NiBabel, 5 other tools, epilepsy, structural MRI / diffusion, clinical / translational, 3 references
[9] doi:10.1162/imag.a.960 [code]
GOUHFI: A novel contrast- and resolution-agnostic segmentation tool for ultra-high-field MRI.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: ANTs, NiBabel, seaborn, 4 other tools, structural MRI / diffusion, 4 references
[10] doi:10.1162/imag.a.1362 [code]
Human fMRI at 11.7T: Assessing feasibility, stability, and reliability on the Iseult scanner.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: ANTs, Nilearn, FreeSurfer, 6 other tools, 2 references

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Add the badge to the code's README

OSCR: the badge of this paper

If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.

Markdown
<!-- oscr-badge:start -->
[![OSCR](https://openscicode.org/badge/doi/10.64898/2026.04.02.26349812.svg)](https://openscicode.org/badge/doi/10.64898/2026.04.02.26349812)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.64898/2026.04.02.26349812.svg
   :target: https://openscicode.org/badge/doi/10.64898/2026.04.02.26349812
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.64898/2026.04.02.26349812"><img src="https://openscicode.org/badge/doi/10.64898/2026.04.02.26349812.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->

On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".

If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.

Report a mismatch between the code and the paper · Report a code error (signed in)

Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.

Report a reproduction failure (signed in)

Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.