OSCR

Anisotropic conductivity modeling for tDCS in Parkinson’s disease using multidimensional diffusion MRI

Code ↔ Paper

21 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.

The 21 matches · 6 of them tie a paragraph to a whole file without given lines: weak matches, whose lines are not tinted
  1. [1] § Methods › Registration and tensor reorientation ↔ analysis/qc_harness.py, lines 167 to 234 · score 0.90 · superior inferior, cerebral peduncles, edge alignment, corpus callosum, boundary, frame · Report a mismatch
  2. [2] § Methods › Association with mechanical properties ↔ analysis/09_mre_cohort_corr.py, lines 133 to 274 · score 0.90 · CSF morphology, partial Pearson, CSF fraction, CSF volume, added age, coefficients · Report a mismatch
  3. [3] § Methods › Registration and tensor reorientation ↔ pipeline/02_register_dmri_to_T1.sh, lines 37 to 119 · score 0.87 · rigid pre, DOF affine, charm T2, mesh elements, conductivity tensors, FSL · Report a mismatch
  4. [4] § Methods › E-field metrics and statistics ↔ analysis/aggregate_matched_control.py, lines 117 to 157 · score 0.85 · subject clustered bootstrap, absolute percentage, V1 angle, orientation divergence, replacement, interval · Report a mismatch
  5. [5] § Methods › E-field metrics and statistics ↔ analysis/06_cohort_stats.py, lines 61 to 200 · score 0.83 · Mann Whitney, rank biserial, linear age, Wilcoxon, residuals, Cohen · Report a mismatch
  6. [6] § Methods › Regions of interest ↔ analysis/build_rois.py, lines 1 to 25 · score 0.82 · Desikan Killiany, FreeSurfer, WM lobes, parietal, wmparc, frontal · Report a mismatch
  7. [7] § Methods › Registration and tensor reorientation ↔ pipeline/08b_matched_reg_control.sh, lines 50 to 111 · score 0.80 · rigid pre, mutual information, DOF affine, FSL, FLIRT, alignment · Report a mismatch
  8. [8] § Methods › Conductivity models ↔ config/config.example.sh, the whole file · a weak match · score 0.80 · spherical encoding series, brain mask, covariance fit, single shell, oriented, MD dMRI · Report a mismatch
  9. [9] § Methods › Conductivity models ↔ pipeline/prepare_dmri_tensor.py, lines 65 to 88 · score 0.76 · brain voxels, positive definite, cumulant, plausible, physiological, ms · Report a mismatch
  10. [10] § Results › Association between predicted E-field and MRE stiffness ↔ analysis/09_mre_cohort_corr.py, lines 133 to 274 · score 0.74 · partial Pearson, CSF fraction, CSF volume, attenuated, collinear, regression · Report a mismatch
  11. [11] § Methods › Conductivity models ↔ pipeline/run_qti_cov_cohort.m, the whole file · a weak match · score 0.71 · covariance fit, motion, elastix, eddy, topup, Synb0 · Report a mismatch
  12. [12] § Results › Participants ↔ analysis/qc_harness.py, lines 167 to 234 · score 0.71 · superior inferior, cerebral peduncle, corpus callosum, reoriented, segmentation, dMRI · Report a mismatch
  13. [13] § Methods › Conductivity models ↔ pipeline/01_dwi2cond.sh, the whole file · a weak match · score 0.71 · T1 coregistration, dwi2cond, single shell, DTI model, FSL, dtifit · Report a mismatch
  14. [14] § Results › Orientation divergence between the two anisotropic models ↔ analysis/aggregate_matched_control.py, lines 1 to 25 · score 0.69 · subject clustered bootstrap, absolute percentage, V1 angle, CI, orientation, dMRI · Report a mismatch
  15. [15] § Methods › Electrode montages ↔ pipeline/04_run_simulations.py, lines 1 to 35 · score 0.63 · tDCS, cathode, anode, pads, simulated, DLPFC · Report a mismatch
  16. [16] § Methods › Head model ↔ analysis/qc_harness.py, lines 101 to 140 · score 0.63 · SimNIBS, compact, spongy, bone, tetrahedral, scalp · Report a mismatch
  17. [17] § Methods › Conductivity models ↔ config/config.example.sh, the whole file · a weak match · score 0.61 · covariance fit, single shell, eddy, rotated, topup, FSL · Report a mismatch
  18. [18] § Methods › Registration and tensor reorientation ↔ pipeline/run_qti_cov_cohort.m, the whole file · a weak match · score 0.59 · covariance fit, MD dMRI tensors, spherical, smoothing, encoded, linear · Report a mismatch
  19. [19] § Results › Group comparison (PD vs. HC) ↔ analysis/06_cohort_stats.py, lines 61 to 200 · score 0.58 · Mann Whitney, age adjusted, residuals, Cohen, HC, dMRI · Report a mismatch
  20. [20] § Methods › Head model ↔ pipeline/00_charm.sh, the whole file · a weak match · score 0.56 · head model, SimNIBS, tetrahedral, pipeline, charm, mesh · Report a mismatch
  21. [21] § Methods › Study design ↔ pipeline/04_run_simulations.py, lines 1 to 35 · score 0.54 · tDCS, SimNIBS, cathodes, anode, pads, DLPFC · 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 · 587 lines · 29 KB · MIT · 3 matches

  1. """
  2. qc_harness.py - post-pipeline per-subject QC: one qc_summary.csv row per subject with sanity
  3. metrics, a PASS/FLAG per stage, and an overall verdict. Beyond the absolute thresholds, any
  4. metric > 3 MAD from the cohort median is also flagged. An outlier is a signal to inspect/fix.
  5. Usage:
  6. simnibs_python analysis/qc_harness.py # the subject in config/config.sh
  7. simnibs_python analysis/qc_harness.py --cohort config/cohort.json # {"subjects":[{"id",...}]} or [{"id","work","m2m"}...]
  8. simnibs_python analysis/qc_harness.py --calibrate # suggest cohort-percentile thresholds, then exit
  9. """
  10. import os, sys, csv, json, glob, argparse
  11. import numpy as np
  12. import nibabel as nib
  13. sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "pipeline"))
  14. from _config import cfg # noqa: E402
  15. sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
  16. from _sims import sim_mesh, MODELS # noqa: E402 (shared montage-aware mesh lookup)
  17. from _rois import eigvals_6comp, fa_from_evals # noqa: E402 (shared eigendecomp + FA; one source of truth)
  18. # Absolute thresholds seeded from a single-subject pilot (n=1). [PROV] items are provisional
  19. # single-subject cutoffs to recalibrate as a cohort percentile (--calibrate) once 5-8 subjects
  20. # exist. The MAD>3 outlier pass in main() (active only at n>=4) is the real per-subject guard;
  21. # on one subject only these absolute thresholds are in force.
  22. THR = dict(
  23. charm_tet_q_med_min=0.10, charm_tet_q_badfrac_max=0.05, # broadly-poor mesh / too many slivers
  24. tissue_plausible={"WM": (3e5, 7.5e5), "GM": (4e5, 8e5), "CSF": (5e4, 6e5),
  25. "bone": (2e5, 8.5e5), "scalp": (5e5, 2.5e6)}, # mm3; upper bounds recalibrated to the n=29 cohort
  26. cc_fa_min=0.25, csf_fa_max=0.25, # dwi2cond; cc_fa_min recalibrated to the n=29 cohort min
  27. reg_containment_min=0.95, # dMRI FOV covers brain (gross misreg / cutoff)
  28. cc_v1x_min=0.6, # [PROV] CC V1 left-right (tensor reorientation)
  29. peduncle_siz_min=0.55, # [PROV] cerebral-peduncle V1 superior-inferior in the SimNIBS frame
  30. reg_grad_corr_min=0.08, # [PROV] b0<->T1 edge alignment (mid-range shift)
  31. efield_p95_range=(0.10, 0.60), efield_spike=8.0, # 03: p95 |E| range; max/p95 spike [PROV] default mesh ~6 (tail artifact, not the median readout); recalibrate at cohort scale
  32. electrode_tol_mm=15.0,
  33. )
  34. SIGMA0 = {"WM": 0.126, "GM": 0.275} # tissue baseline conductivities (S/m), vn anchors
  35. SAMSEG = dict(wm=(2, 41), gm=(3, 42), csf=(4, 43, 14, 15, 24), brainstem=(16,))
  36. NUCLEI = ["Pu", "Ca", "NAC", "GPe", "GPi", "SNc", "SNr", "VTA", "RN", "STN"]
  37. def _load(p):
  38. return nib.load(p) if os.path.exists(p) else None
  39. def _data(p):
  40. img = _load(p)
  41. return np.asarray(img.dataobj) if img is not None else None
  42. def _roi_dir(reg):
  43. """Group 1 ROI dir: the recon-all parcellation (freesurfer_rois) built by analysis/build_rois.py.
  44. Mirrors analysis/_rois.load_labeled so QC reads the same masks."""
  45. return os.path.join(reg, "freesurfer_rois")
  46. def _eigs_masked(t, sel):
  47. """Ascending eigenvalues (N,3) of the 6-comp tensor `t` over the selected voxels only. Delegates to
  48. _rois.eigvals_6comp (one source of truth for the FSL pack + the eigvalsh values-only fast path)."""
  49. return eigvals_6comp(t, sel)
  50. def _tensor_eigs(path, mask=None):
  51. """Return sorted eigenvalues (N,3) of a 6-comp tensor NIfTI, optionally within mask."""
  52. t = _data(path)
  53. if t is None:
  54. return None
  55. sel = (np.abs(t[..., 0]) > 1e-9) if mask is None else mask
  56. return _eigs_masked(t, sel)
  57. def _fa(eigs):
  58. """Mean FA over voxels, from ascending eigenvalues (N,3); uses _rois.fa_from_evals (per-voxel)."""
  59. return np.nanmean(fa_from_evals(eigs))
  60. def _vn_check(e, sigma0):
  61. """Volume-normalization sanity checks on diffusion-tensor eigenvalues `e` (N,3, ascending).
  62. SimNIBS's vn step scales each voxel's D to sigma = D * sigma0 / geomean(eig D). Reconstructing
  63. sigma from the SAME eigenvalues makes geomean(eig sigma) == sigma0 hold by construction, so that
  64. identity is NOT a check (it can only be violated by reading SimNIBS's own assigned conductivity,
  65. which this function does not have). What this DOES verify:
  66. Returns (degfrac, sigma_hi, sigma_lo):
  67. degfrac - fraction NOT positive-definite (vn undefined there). MUST be read from the raw
  68. smallest eigenvalue e[:,0]: a clamped geom-mean is always > 0 and would silently
  69. report 0 (the bug this function exists to prevent).
  70. sigma_hi/lo - 99th/1st percentile of the reconstructed conductivity eigenvalues, i.e. whether
  71. the tensor shape scaled to sigma0 lands in a physiological conductivity range.
  72. """
  73. good = np.isfinite(e).all(axis=1) & (e[:, 0] > 0)
  74. degfrac = float(np.mean(~good))
  75. if not good.any():
  76. return degfrac, float("nan"), float("nan")
  77. eg = e[good] # positive-definite -> no clamp needed
  78. g = np.exp(np.mean(np.log(eg), axis=1))
  79. sig = eg * (sigma0 / g[:, None]) # reconstructed conductivity eigenvalues
  80. return degfrac, float(np.percentile(sig, 99)), float(np.percentile(sig, 1))
  81. # stage checks: each returns (metrics dict, list of flag strings)
  82. def qc_charm(P):
  83. m, f = {}, []
  84. m2m = P["m2m"]
  85. mesh = next(iter(glob.glob(os.path.join(m2m, "*.msh"))), None)
  86. ft = os.path.join(m2m, "final_tissues.nii.gz")
  87. m["charm_m2m"] = int(os.path.isdir(m2m)); m["charm_mesh"] = int(mesh is not None)
  88. m["charm_tissues"] = int(os.path.exists(ft))
  89. if not (m["charm_m2m"] and mesh and m["charm_tissues"]):
  90. f.append("charm:missing_output"); return m, f
  91. try:
  92. from simnibs import mesh_io
  93. msh = mesh_io.read_msh(mesh)
  94. m["charm_n_tet"] = int((msh.elm.elm_type == 4).sum())
  95. try:
  96. # tetrahedra_quality() -> (radius_edge_ratio, inscribed/circumscribed ratio); [1] is the
  97. # standard tet quality (1.0 = ideal, low = sliver), sized to ALL elements so triangles are
  98. # NaN -> keep finite (the tets). Gate on median + sliver fraction, not min (a few slivers
  99. # are normal and the FEM handles them).
  100. q = msh.tetrahedra_quality()[1].value
  101. qt = q[np.isfinite(q)]
  102. m["charm_tet_q_med"] = round(float(np.median(qt)), 3)
  103. m["charm_tet_q_badfrac"] = round(float(np.mean(qt < 0.1)), 4)
  104. if np.median(qt) < THR["charm_tet_q_med_min"] or np.mean(qt < 0.1) > THR["charm_tet_q_badfrac_max"]:
  105. f.append("charm:low_tet_quality")
  106. except Exception:
  107. m["charm_tet_q_med"] = np.nan; m["charm_tet_q_badfrac"] = np.nan
  108. except Exception as e:
  109. m["charm_n_tet"] = np.nan; m["charm_tet_q_med"] = np.nan; m["charm_tet_q_badfrac"] = np.nan
  110. f.append(f"charm:mesh_read({type(e).__name__})")
  111. seg = _data(ft); vx = abs(np.linalg.det(_load(ft).affine[:3, :3]))
  112. # SimNIBS charm final_tissues labels: WM=1, GM=2, CSF=3, scalp=5; bone is SPLIT into 7=compact +
  113. # 8=spongy (generic bone label 4 is EMPTY in charm output), so total bone = 7+8.
  114. lut = {"WM": [1], "GM": [2], "CSF": [3], "bone": [7, 8], "scalp": [5]}
  115. for name, labs in lut.items():
  116. v = float(np.isin(seg, labs).sum() * vx); m[f"vol_{name}_mm3"] = round(v)
  117. lo, hi = THR["tissue_plausible"].get(name, (0, 1e12))
  118. if not (lo <= v <= hi):
  119. f.append(f"charm:vol_{name}_implausible")
  120. return m, f
  121. def qc_dwi2cond(P):
  122. m, f = {}, []
  123. dti = os.path.join(P["m2m"], "DTI_coregT1_tensor.nii.gz")
  124. if not os.path.exists(dti):
  125. f.append("dwi2cond:missing"); return m, f
  126. seg = _data(P["samseg"])
  127. cc = _data(P.get("cc_mask")) if P.get("cc_mask") else None
  128. cc_mask = (cc > 0) if cc is not None else None
  129. csf_mask = np.isin(seg, SAMSEG["csf"]) if seg is not None else None
  130. if cc_mask is not None:
  131. ec = _tensor_eigs(dti, cc_mask); m["dwi2cond_cc_fa"] = round(_fa(ec), 3)
  132. if m["dwi2cond_cc_fa"] < THR["cc_fa_min"]:
  133. f.append("dwi2cond:cc_fa_low")
  134. if csf_mask is not None:
  135. es = _tensor_eigs(dti, csf_mask); m["dwi2cond_csf_fa"] = round(_fa(es), 3)
  136. if m["dwi2cond_csf_fa"] > THR["csf_fa_max"]:
  137. f.append("dwi2cond:csf_fa_high")
  138. eall = _tensor_eigs(dti)
  139. m["dwi2cond_neg_eig_frac"] = round(float(np.mean(eall[:, 0] <= 0)), 4) if eall is not None else np.nan
  140. if eall is not None and (eall[:, 0] <= 0).mean() > 0.001:
  141. f.append("dwi2cond:neg_eigenvalues")
  142. return m, f
  143. def qc_register(P):
  144. m, f = {}, []
  145. seg = _data(P["samseg"])
  146. dm = _data(os.path.join(P["reg"], "dMRI_mask_T1.nii.gz"))
  147. if seg is None or dm is None:
  148. f.append("register:missing"); return m, f
  149. # The registered dMRI brain mask is ~2x the SAMSEG brain (includes neck/inferior FOV), so Dice or
  150. # centroid distance is size-confounded (caps ~0.62 / ~8 mm even when aligned). Use size-INDEPENDENT
  151. # signals instead:
  152. # (1) containment - does the dMRI FOV cover the brain? Catches gross misreg / FOV cutoff.
  153. # (2) CC reorientation - do corpus-callosum V1 point left-right? Catches tensor-reorient errors
  154. # (highest-risk step: a flip/rotation collapses |V1_x| in the CC).
  155. brain = np.isin(seg, [2, 41, 3, 42, 10, 49, 11, 50, 12, 51, 13, 52, 16, 17, 18, 53, 54, 26, 58, 28, 60])
  156. dmm = dm > 0
  157. m["reg_containment"] = round(float((dmm & brain).sum() / max(int(brain.sum()), 1)), 4)
  158. if m["reg_containment"] < THR["reg_containment_min"]:
  159. f.append("register:brain_not_covered")
  160. v1 = _data(os.path.join(P["reg"], "v1_T1.nii.gz"))
  161. cc = _data(P.get("cc_mask")) if P.get("cc_mask") else None
  162. if v1 is not None and cc is not None and (cc > 0).any():
  163. ccm = cc > 0
  164. nrm = np.linalg.norm(v1[ccm], axis=1)
  165. ok = nrm > 1e-6
  166. if ok.any():
  167. v1x = np.abs(v1[ccm][ok, 0]) / nrm[ok]
  168. m["reg_cc_v1x"] = round(float(np.median(v1x)), 3) # median: robust to CC-edge partial volume
  169. if np.median(v1x) < THR["cc_v1x_min"]:
  170. f.append("register:cc_not_LR") # tensor reorientation failed
  171. # (2b) cerebral-peduncle reorientation in the SimNIBS frame. CC V1x above is voxel-frame and the
  172. # CC L-R signal is resolution-limited at 2.5 mm; the peduncle is a thick coherent S-I tract, the
  173. # reliable orientation gate. SimNIBS rotates the tensor by M = colnorm(affine).diag(-1,1,1 if det>0)
  174. # (cond_utils.cond2elmdata) before the FEM, so we score M@v1 against world-z (superior-inferior).
  175. ped = _data(os.path.join(_roi_dir(P["reg"]), "roi_Mesencephalon.nii.gz"))
  176. if v1 is not None and ped is not None and (ped > 0).any():
  177. aff = nib.load(os.path.join(P["reg"], "v1_T1.nii.gz")).affine[:3, :3]
  178. M = aff / np.linalg.norm(aff, axis=0)[:, None]
  179. if np.linalg.det(M) > 0:
  180. M = M.dot(np.diag([-1.0, 1.0, 1.0]))
  181. vw = v1[ped > 0] @ M.T
  182. nrm = np.linalg.norm(vw, axis=1); ok = nrm > 1e-6
  183. if ok.any():
  184. siz = np.abs(vw[ok, 2]) / nrm[ok]
  185. m["reg_peduncle_siz"] = round(float(np.median(siz)), 3)
  186. if np.median(siz) < THR["peduncle_siz_min"]:
  187. f.append("register:peduncle_not_SI") # reorientation / registration off
  188. # (3) edge alignment - gradient-magnitude correlation of registered b0 vs T1 inside the brain.
  189. # Containment and CC-V1 miss a few-mm rigid shift that still covers the brain; a shift misaligns
  190. # tissue boundaries, so |grad| correlation drops sharply (BBR principle): ~0.19 aligned, ~-40% at
  191. # a 4 mm shift. (NMI on this b0/T1 pair sits near the information floor and barely moves, so unused.)
  192. try:
  193. from scipy import ndimage
  194. b0 = _data(os.path.join(P["reg"], "s0_T1.nii.gz")) # registered dMRI S0 in T1 space
  195. t1 = _data(os.path.join(P["m2m"], "T1.nii.gz"))
  196. if b0 is not None and t1 is not None:
  197. inner = ndimage.binary_erosion(brain, iterations=2) # avoid the mask boundary itself
  198. def _gmag(v):
  199. gx, gy, gz = np.gradient(ndimage.gaussian_filter(v.astype(float), 1.0))
  200. return np.sqrt(gx * gx + gy * gy + gz * gz)
  201. a = _gmag(b0)[inner]; b = _gmag(t1)[inner]
  202. a = a - a.mean(); b = b - b.mean()
  203. gc = float((a * b).sum() / (np.sqrt((a * a).sum() * (b * b).sum()) + 1e-30))
  204. m["reg_grad_corr"] = round(gc, 3)
  205. if gc < THR["reg_grad_corr_min"]:
  206. f.append("register:edge_misaligned") # [PROV] likely a few-mm shift
  207. except Exception:
  208. pass # scipy missing or b0 absent -> skip; containment+CC still gate
  209. return m, f
  210. def qc_conductivity(P):
  211. m, f = {}, []
  212. seg = _data(P["samseg"])
  213. # The MD-dMRI conductivity input is the plain QTI mean tensor <D> (tensor_MD_dMRI.nii.gz).
  214. tensors = [("MDdMRI", "tensor_MD_dMRI.nii.gz")]
  215. for tag, fname in tensors:
  216. path = os.path.join(P["work"], fname)
  217. if not os.path.exists(path):
  218. f.append(f"cond:{tag}_missing"); continue
  219. t = _data(path) # load once; reuse for global + per-tissue
  220. naninf = bool(np.isnan(t).any() or np.isinf(t).any())
  221. m[f"cond_{tag}_nan"] = int(naninf)
  222. if naninf:
  223. f.append(f"cond:{tag}_naninf")
  224. valid = np.abs(t[..., 0]) > 1e-9
  225. if not valid.any():
  226. f.append(f"cond:{tag}_empty"); continue
  227. eigs = _eigs_masked(t, valid)
  228. negfrac = float(np.mean(eigs[:, 0] <= 0))
  229. m[f"cond_{tag}_neg_eig_frac"] = round(negfrac, 5)
  230. if negfrac > 0:
  231. f.append(f"cond:{tag}_neg_eig")
  232. ratio = eigs[:, 2] / np.maximum(eigs[:, 0], 1e-9)
  233. m[f"cond_{tag}_cap8_frac"] = round(float(np.mean(ratio > 8)), 4)
  234. # Per-tissue mean diffusivity = geom-mean of the D eigenvalues. tensor_MD_dMRI is the DIFFUSION
  235. # tensor; SimNIBS applies vn (geom-mean sigma -> sigma0) at sim time, so sigma0 is verified
  236. # INDIRECTLY via the E-field range in qc_sims. Here we sanity-check the tensor: positive, real
  237. # MD-scale, not corrupt/zeroed.
  238. if seg is not None:
  239. for tis, labs in [("WM", SAMSEG["wm"]), ("GM", SAMSEG["gm"])]:
  240. tm = np.isin(seg, labs) & valid
  241. if not tm.any():
  242. continue
  243. e = _eigs_masked(t, tm)
  244. md_med = float(np.median(np.exp(np.mean(np.log(np.maximum(e, 1e-12)), axis=1))))
  245. m[f"cond_{tag}_{tis}_md"] = round(md_med, 3)
  246. if not (0.2 <= md_med <= 3.0): # plausible mean diffusivity band (um^2/ms)
  247. f.append(f"cond:{tag}_{tis}_md_implausible")
  248. # vn check (see _vn_check): count voxels that cannot be vn-normalized (not
  249. # positive-definite) and confirm the reconstructed sigma is physiological.
  250. s0 = SIGMA0.get(tis)
  251. if s0:
  252. degfrac, sig_hi, sig_lo = _vn_check(e, s0)
  253. m[f"cond_{tag}_{tis}_vn_degfrac"] = round(degfrac, 5)
  254. if degfrac > 0.001:
  255. f.append(f"cond:{tag}_{tis}_vn_degenerate") # D cannot be vn-normalized here
  256. if np.isfinite(sig_hi):
  257. m[f"cond_{tag}_{tis}_sigma_hi"] = round(sig_hi, 3)
  258. if sig_hi > 2.0 or sig_lo < 1e-3:
  259. f.append(f"cond:{tag}_{tis}_sigma_nonphysio") # runaway / insulating sigma
  260. return m, f
  261. def qc_sims(P):
  262. m, f = {}, []
  263. try:
  264. from simnibs import mesh_io
  265. except Exception:
  266. f.append("sims:no_simnibs"); return m, f
  267. montage = P.get("montage", "M1")
  268. for model in MODELS: # ISO, DTI, MD-dMRI
  269. mod = model.replace("-", "") # metric label: ISO / DTI / MDdMRI
  270. mp = sim_mesh(P["work"], montage, model, P["id"])
  271. if not mp:
  272. f.append(f"sims:{mod}_missing"); continue
  273. msh = mesh_io.read_msh(mp)
  274. gm = (msh.elm.tag1 == 2)
  275. E = msh.field["magnE"].value
  276. p95 = float(np.percentile(E[gm], 95)); mx = float(np.max(E[gm]))
  277. m[f"E_{mod}_p95"] = round(p95, 3); m[f"E_{mod}_spike"] = round(mx / max(p95, 1e-9), 1)
  278. if not (THR["efield_p95_range"][0] <= p95 <= THR["efield_p95_range"][1]):
  279. f.append(f"sims:{mod}_p95_out_of_range")
  280. if mx / max(p95, 1e-9) > THR["efield_spike"]:
  281. f.append(f"sims:{mod}_spike")
  282. return m, f
  283. def qc_rois(P):
  284. m, f = {}, []
  285. n_empty = 0; n_total = 0
  286. for p in glob.glob(os.path.join(_roi_dir(P["reg"]), "roi_*.nii.gz")):
  287. n_total += 1
  288. if (_data(p) > 0).sum() == 0:
  289. n_empty += 1; f.append(f"rois:empty({os.path.basename(p)})")
  290. m["roi_n_total"] = n_total; m["roi_n_empty"] = n_empty
  291. if n_total == 0:
  292. f.append("rois:none_built")
  293. return m, f
  294. def qc_nuclei(P):
  295. # Group 2 deep nuclei (CIT168/Pauli) are OVERLAP-ALLOWED separate binary masks (07_build_nuclei.sh).
  296. # Glob the per-nucleus masks; do NOT read nuclei_labeled.nii.gz (winner-take-all int labels destroy
  297. # the intended overlap). Pairwise overlap is expected (midbrain/STN), logged not flagged.
  298. m, f = {}, []
  299. nd = os.path.join(P["reg"], "atlas_rois", "nuclei")
  300. paths = sorted(glob.glob(os.path.join(nd, "roi_*.nii.gz")))
  301. paths = [p for p in paths if os.path.basename(p) != "nuclei_labeled.nii.gz"]
  302. masks = {}
  303. for p in paths:
  304. d = _data(p)
  305. if d is None:
  306. continue
  307. b = d > 0
  308. masks[os.path.basename(p)] = b
  309. if b.sum() == 0:
  310. f.append(f"nuclei:empty({os.path.basename(p)})")
  311. m["nuclei_n_total"] = len(masks)
  312. m["nuclei_n_empty"] = sum(1 for b in masks.values() if b.sum() == 0)
  313. names = sorted(masks)
  314. n_ov = 0
  315. for i in range(len(names)):
  316. for j in range(i + 1, len(names)):
  317. if (masks[names[i]] & masks[names[j]]).any():
  318. n_ov += 1
  319. m["nuclei_n_overlap_pairs"] = n_ov # expected (overlap-allowed), reported not flagged
  320. if paths and not masks:
  321. f.append("nuclei:unreadable")
  322. # presence: each nucleus should have an L and R mask (07 emits roi_{L,R}_{nucleus}.nii.gz)
  323. if masks:
  324. for nuc in NUCLEI:
  325. for side in ("L", "R"):
  326. if f"roi_{side}_{nuc}.nii.gz" not in masks:
  327. f.append(f"nuclei:missing(roi_{side}_{nuc})")
  328. return m, f
  329. def qc_roi_efield_csv(P):
  330. # Mask presence (qc_rois/qc_nuclei) is necessary but not sufficient: an ROI whose mask exists but
  331. # overlaps no GM/WM tetrahedra reads back as all-NaN in the per-subject roi_efield CSV and would
  332. # otherwise pass QC silently. Open the actual CSV that 04_extract_roi_efield.py wrote and flag any
  333. # ROI that is all-NaN across a model's columns.
  334. m, f = {}, []
  335. montage = P.get("montage", "M1")
  336. csv_path = os.path.join(P["results_root"], P["id"], f"roi_efield_{montage}.csv")
  337. if not os.path.exists(csv_path):
  338. f.append(f"roi_efield:missing(roi_efield_{montage}.csv)"); return m, f
  339. rows = list(csv.DictReader(open(csv_path)))
  340. if not rows:
  341. f.append("roi_efield:empty"); return m, f
  342. # Per-model columns are "<model>_p95" / "<model>_median" (model names from _sims.MODELS).
  343. cols = {mod: [f"{mod}_p95", f"{mod}_median"] for mod in MODELS}
  344. def _is_nan(v):
  345. if v is None or v == "":
  346. return True
  347. try:
  348. return not np.isfinite(float(v))
  349. except ValueError:
  350. return True
  351. n_nan_rows = 0
  352. for r in rows:
  353. roi = r.get("ROI", "?")
  354. for mod, mcols in cols.items():
  355. present = [c for c in mcols if c in r]
  356. if present and all(_is_nan(r[c]) for c in present):
  357. n_nan_rows += 1
  358. f.append(f"roi_efield:all_nan({roi},{mod})") # mask exists but no GM/WM overlap
  359. m["roi_efield_n_rows"] = len(rows); m["roi_efield_n_nan"] = n_nan_rows
  360. return m, f
  361. STAGES = [("00_charm", qc_charm), ("01_dwi2cond", qc_dwi2cond), ("02_register", qc_register),
  362. ("03_conductivity", qc_conductivity), ("04_sims", qc_sims), ("05_rois", qc_rois),
  363. ("06_nuclei", qc_nuclei), ("07_roi_efield", qc_roi_efield_csv)]
  364. def _cohort_local_root():
  365. """Root holding the per-subject dirs the cohort.json ids index into: data/cohort_local/<id>/
  366. (each with work/m2m_<id> + registration). Resolved relative to the repo root, NOT cfg["WORK_DIR"]
  367. (which tracks the active single-subject config and may point at the pilot, not the cohort layout).
  368. Override with COHORT_LOCAL_ROOT if the cohort lives elsewhere."""
  369. env = os.environ.get("COHORT_LOCAL_ROOT")
  370. if env:
  371. return env
  372. repo = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  373. return os.path.join(repo, "data", "cohort_local")
  374. def _subject_paths(sid, root):
  375. """Per-subject path dict from the data/cohort_local/<id>/ layout (work/m2m_<id>, registration)."""
  376. base = os.path.join(root, sid)
  377. work = os.path.join(base, "work")
  378. m2m = os.path.join(work, f"m2m_{sid}")
  379. reg = os.path.join(base, "registration")
  380. return {"id": sid, "work": work, "m2m": m2m, "reg": reg,
  381. "samseg": os.path.join(m2m, "segmentation", "labeling.nii.gz"),
  382. "cc_mask": os.path.join(_roi_dir(reg), "roi_CC.nii.gz")}
  383. def resolve_subjects(args):
  384. if args.cohort and os.path.exists(args.cohort):
  385. data = json.load(open(args.cohort))
  386. # Two accepted shapes:
  387. # (a) config/cohort.json: {"montages":[...], "subjects":[{"id","group",...}]} - derive
  388. # per-subject paths from the data/cohort_local/<id>/ layout.
  389. # (b) a flat list of explicit path dicts ([{"id","work","m2m",...}]) - used as-is.
  390. if isinstance(data, dict) and "subjects" in data:
  391. root = _cohort_local_root()
  392. return [_subject_paths(s["id"], root) for s in data["subjects"]]
  393. return data
  394. return [{"id": cfg["SUBJECT"], "work": cfg["WORK_DIR"], "m2m": cfg["M2M_DIR"],
  395. "reg": cfg["REG_DIR"],
  396. "samseg": os.path.join(cfg["M2M_DIR"], "segmentation", "labeling.nii.gz"),
  397. "cc_mask": os.path.join(_roi_dir(cfg["REG_DIR"]), "roi_CC.nii.gz")}]
  398. # Directional metrics -> which tail to guard once a cohort exists ("low" = flag below the lower tail,
  399. # "high" = above the upper). Used by --calibrate to turn single-subject cutoffs into cohort percentiles.
  400. CALIB = {"reg_grad_corr": "low", "reg_cc_v1x": "low", "reg_containment": "low",
  401. "dwi2cond_cc_fa": "low", "charm_tet_q_med": "low",
  402. "dwi2cond_csf_fa": "high", "charm_tet_q_badfrac": "high"}
  403. def _calibrate(out):
  404. p = os.path.join(out, "qc_summary.csv")
  405. if not os.path.exists(p):
  406. print(f"no cohort CSV at {p} - run the harness over the cohort first"); return
  407. rows = list(csv.DictReader(open(p)))
  408. print(f"Cohort threshold calibration from {len(rows)} subject(s) in {p}")
  409. if len(rows) < 5:
  410. print(" WARNING: < 5 subjects - percentile tails are unstable; treat as indicative only.")
  411. for k, side in CALIB.items():
  412. vals = np.array([float(r[k]) for r in rows
  413. if r.get(k) not in (None, "", "nan")], float)
  414. vals = vals[np.isfinite(vals)]
  415. if len(vals) < 3:
  416. continue
  417. med = float(np.median(vals))
  418. if side == "low":
  419. print(f" {k:22s} flag-below: median={med:.3f} p10={np.percentile(vals,10):.3f} "
  420. f"p5={np.percentile(vals,5):.3f} <- set THR near p5")
  421. else:
  422. print(f" {k:22s} flag-above: median={med:.3f} p90={np.percentile(vals,90):.3f} "
  423. f"p95={np.percentile(vals,95):.3f} <- set THR near p95")
  424. def main():
  425. ap = argparse.ArgumentParser()
  426. ap.add_argument("--cohort"); ap.add_argument("--out", default="analysis/qc")
  427. ap.add_argument("--results-root",
  428. default=os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
  429. "analysis", "results"),
  430. help="dir holding <id>/roi_efield_<montage>.csv from 04_extract_roi_efield.py")
  431. ap.add_argument("--montage", default="M1", help="which montage's sims to QC (default M1)")
  432. ap.add_argument("--calibrate", action="store_true",
  433. help="read out/qc_summary.csv and suggest cohort-percentile thresholds, then exit")
  434. ap.add_argument("--emit-metrics", help="write the per-subject numeric metrics to this JSON and exit")
  435. args = ap.parse_args()
  436. if args.calibrate:
  437. _calibrate(args.out); return
  438. subjects = resolve_subjects(args)
  439. os.makedirs(args.out, exist_ok=True)
  440. rows, stage_flags = [], []
  441. for P in subjects:
  442. P.setdefault("reg", os.path.join(P["work"], "registration"))
  443. P.setdefault("samseg", os.path.join(P["m2m"], "segmentation", "labeling.nii.gz"))
  444. P.setdefault("cc_mask", os.path.join(_roi_dir(P["reg"]), "roi_CC.nii.gz"))
  445. P.setdefault("montage", args.montage)
  446. P.setdefault("results_root", args.results_root)
  447. row = {"subject": P["id"]}; flags_by_stage = {}
  448. for stage_name, fn in STAGES:
  449. try:
  450. metrics, flags = fn(P)
  451. except Exception as e:
  452. metrics, flags = {}, [f"{stage_name}:exception({type(e).__name__})"]
  453. row.update(metrics)
  454. flags_by_stage[stage_name] = flags
  455. row[f"{stage_name}_PASS"] = "PASS" if not flags else "FLAG"
  456. row["overall"] = "PASS" if all(row[f"{s}_PASS"] == "PASS" for s, _ in STAGES) else "FLAG"
  457. rows.append(row); stage_flags.append(flags_by_stage)
  458. # cohort MAD outlier flagging, gated at n>=4 (MAD is meaningless below that); a lone subject is
  459. # judged ONLY by the absolute THR. The `numeric` list is still built for the CSV.
  460. numeric = sorted({k for r in rows for k, v in r.items() if isinstance(v, (int, float))})
  461. if len(rows) >= 4:
  462. for k in numeric:
  463. vals = np.array([r.get(k, np.nan) for r in rows], float)
  464. med = np.nanmedian(vals); mad = np.nanmedian(np.abs(vals - med)) * 1.4826
  465. if mad > 0:
  466. for i, r in enumerate(rows):
  467. if np.isfinite(vals[i]) and abs(vals[i] - med) / mad > 3:
  468. stage_flags[i].setdefault("MAD", []).append(f"{k}_outlier")
  469. r["overall"] = "FLAG"
  470. # write CSV
  471. cols = ["subject"] + numeric + [f"{s}_PASS" for s, _ in STAGES] + ["overall"]
  472. csv_path = os.path.join(args.out, "qc_summary.csv")
  473. with open(csv_path, "w", newline="") as fh:
  474. w = csv.DictWriter(fh, fieldnames=cols, extrasaction="ignore"); w.writeheader()
  475. for r in rows:
  476. w.writerow(r)
  477. if args.emit_metrics:
  478. snap = {r["subject"]: {k: r[k] for k in numeric if k in r} for r in rows}
  479. with open(args.emit_metrics, "w") as fh:
  480. json.dump(snap, fh, indent=2, sort_keys=True)
  481. print(f"metrics -> {args.emit_metrics}")
  482. return
  483. # PNGs: flagged subjects + random 10% sample
  484. rng = np.random.default_rng(0)
  485. flagged = [i for i, r in enumerate(rows) if r["overall"] == "FLAG"]
  486. sample = set(flagged) | set(rng.choice(len(rows), max(1, len(rows) // 10), replace=False).tolist())
  487. png_dir = os.path.join(args.out, "qc_report"); os.makedirs(png_dir, exist_ok=True)
  488. for i in sorted(sample):
  489. try:
  490. _overlay_png(subjects[i], png_dir)
  491. except Exception as e:
  492. print(f" PNG failed for {subjects[i]['id']}: {type(e).__name__}")
  493. # console summary
  494. print(f"\nQC summary ({len(rows)} subject(s)) -> {csv_path}")
  495. for i, r in enumerate(rows):
  496. if r["overall"] == "FLAG":
  497. fl = [f for s in stage_flags[i].values() for f in s]
  498. print(f" FLAG {r['subject']}: {', '.join(fl)}")
  499. else:
  500. print(f" PASS {r['subject']}")
  501. print(f"PNGs ({len(sample)}: flagged + 10% sample) -> {png_dir}")
  502. def _overlay_png(P, png_dir):
  503. import matplotlib
  504. matplotlib.use("Agg")
  505. import matplotlib.pyplot as plt
  506. t1 = _data(os.path.join(P["m2m"], "T1.nii.gz"))
  507. if t1 is None:
  508. return
  509. lab = _data(os.path.join(_roi_dir(P["reg"]), "roi_labels_meshspace.nii.gz")) # recon-all ROI labels
  510. # center slices on the ROI-label centroid so small ROIs (CC, mesencephalon) are in-plane
  511. if lab is not None and (lab > 0).any():
  512. ci, cj, ck = (int(round(c)) for c in np.array(np.where(lab > 0)).mean(axis=1))
  513. else:
  514. ci, cj, ck = (s // 2 for s in t1.shape[:3])
  515. fig, ax = plt.subplots(1, 3, figsize=(12, 4))
  516. planes = [(t1[ci, :, :], None if lab is None else lab[ci, :, :]),
  517. (t1[:, cj, :], None if lab is None else lab[:, cj, :]),
  518. (t1[:, :, ck], None if lab is None else lab[:, :, ck])]
  519. for a, (bg, ov) in zip(ax, planes):
  520. a.imshow(np.rot90(bg), cmap="gray")
  521. if ov is not None:
  522. a.imshow(np.rot90(np.ma.masked_equal(ov, 0)), cmap="tab10", alpha=0.5, vmin=1, vmax=10)
  523. a.axis("off")
  524. fig.suptitle(f"{P['id']} - T1 + Group 1 volume ROIs"); fig.tight_layout()
  525. fig.savefig(os.path.join(png_dir, f"{P['id']}_overlay.png"), dpi=80); plt.close(fig)
  526. if __name__ == "__main__":
  527. main()

qc_harness.py at commit f4ad4bf, under MIT · at the source

Overview

Authors: Santiago Osorio Jurado1,2, Mikael Skorpil3, Per Svenningsson4, Rodrigo Moreno2,5, Christoffer Olsson2
  1. Department of Biomedical Engineering, The City College of New York, City University of New York, New York, NY, United States
  2. Department of Biomedical Engineering and Health Systems, KTH Royal Institute of Technology, Stockholm, Sweden
  3. Department of Molecular Medicine and Surgery, Karolinska Institutet, Stockholm, Sweden
  4. Department of Clinical Neuroscience, Karolinska Institutet, Stockholm, Sweden
  5. Department of Neurobiology, Care Sciences and Society, Karolinska Institutet, Stockholm, Sweden
Journal: Frontiers in human neuroscience, volume 20, article 1972676
Dates: received 19 August 2026; accepted 6 October 2026; published online 21 October 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI · PMCID PMC13730951
Status: code verified (how the code is found and verified)
Categories: structural MRI / diffusion (modality), other (modality), human (organism), Parkinson's (population)
Methods: Connectivity, Statistics, Preprocessing, Machine learning, fMRI & imaging, Physiology & signal measures
Keywords: diffusion MRI, electric field modeling, finite element method, Parkinson disease, q-space trajectory imaging, transcranial direct current stimulation
Citations: not cited yet (Europe PMC); 68 references in the paper

Abstract

Introduction: Predictions of the electric field (E-field) induced by transcranial direct current stimulation (tDCS) depend on how brain conductivity is modeled. White matter anisotropy is conventionally estimated from single-shell diffusion tensor imaging (DTI). Multidimensional diffusion MRI (MD-dMRI), specifically q-space trajectory imaging (QTI), instead gives a mean tensor expected to carry less kurtosis bias. Our primary question was whether replacing the conventional single-shell tensor with this mean tensor would change the predicted E-field.

Methods: We built, to our knowledge, the first MD-dMRI tDCS conductivity model and compared it against DTI and isotropic models in 29 participants (12 with Parkinson’s disease and 17 controls) across four montages, with the same mesh, electrodes, and solver.

Results: The two anisotropic models differed mainly in tensor orientation (18–25 degrees across the white matter), with E-field magnitudes differing by 6.6% or less. E-fields were not significantly different between patients and controls in any region or montage (which was an exploratory, underpowered comparison). Whole-brain E-field correlated with MR elastography stiffness (partial r = 0.58) but attenuated to non-significance once cerebrospinal fluid (CSF) morphology was accounted for (r = 0.06 to 0.09).

Discussion: With no ground-truth E-field or conductivity available, the study establishes the feasibility of the MD-dMRI model and characterizes E-field sensitivity rather than improved dosimetry accuracy. The choice of diffusion tensor is second order for the predicted E-field, which is primarily influenced by individual anatomy. For Parkinson’s disease, modeling efforts should focus on CSF- and atrophy-aware head models and dose normalization, rather than a more complex diffusion tensor.

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 21 matches between paragraphs and lines of code.

santioso-hue/MRE-tDCS-PD

License: MIT
State: the link answers, verified on 7 November 2026
Evidence: files inventoried
Commit: f4ad4bfe2893d5f92fc7ced3a401ff5e44b1ee02, 16 July 2026
Languages: Python (27), Shell (10), MATLAB (1)
Size: 46 files, 38 scripts
Software Heritage: not archived
Found in: “Data availability statement”
Holds: README, license file, CITATION.cff, environment (requirements.txt), tests
Not found: continuous integration, documentation
Tools: NumPy (22 files), NiBabel (12 files), FSL (9 files), SciPy (7 files), FreeSurfer (1 file), Matplotlib (1 file), MRtrix3 (1 file)
Availability: 1 check, the latest on 7 November 2026: the link answers
  • 7 November 2026: the link answers
40 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;
  • 38 scripts, each with its path and the digest of its content;
  • 21 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 availability statement

The MR imaging data analyzed here are subject to ethical and legal restrictions and cannot be shared publicly. Anonymized data can be made available to researchers who meet the applicable legal and ethical requirements, on reasonable request to the corresponding author. The analysis and modeling code is openly available at https://github.com/santioso-hue/MRE-tDCS-PD.

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, 7 November 2026: the first record

Recorded: type, language, journal, volume, pages, dates, 5 authors, 6 keywords, 67 references.

Cite

This paper

Osorio Jurado, S., Skorpil, M., Svenningsson, P., Moreno, R., & Olsson, C. (2026). Anisotropic conductivity modeling for tDCS in Parkinson’s disease using multidimensional diffusion MRI. Frontiers in human neuroscience, 20, 1972676.

BibTeX

@article{osoriojurado2026anisotropic,
author = {Osorio Jurado, Santiago and Skorpil, Mikael and Svenningsson, Per and Moreno, Rodrigo and Olsson, Christoffer},
title = {{Anisotropic conductivity modeling for tDCS in Parkinson’s disease using multidimensional diffusion MRI}},
journal = {Frontiers in human neuroscience},
year = {2026},
month = nov,
volume = {20},
pages = {1972676},
publisher = {Frontiers Media SA},
issn = {1662-5161},
pmcid = {PMC13730951}
}

RIS

TY - JOUR
AU - Osorio Jurado, Santiago
AU - Skorpil, Mikael
AU - Svenningsson, Per
AU - Moreno, Rodrigo
AU - Olsson, Christoffer
TI - Anisotropic conductivity modeling for tDCS in Parkinson’s disease using multidimensional diffusion MRI
T2 - Frontiers in human neuroscience
J2 - Front Hum Neurosci
PY - 2026
DA - 2026/11/05
VL - 20
SP - 1972676
SN - 1662-5161
PB - Frontiers Media SA
LA - en
ER -

CSL-JSON

{
"id": "pmcid:PMC13730951",
"type": "article-journal",
"title": "Anisotropic conductivity modeling for tDCS in Parkinson’s disease using multidimensional diffusion MRI",
"container-title": "Frontiers in human neuroscience",
"author": [
{
"family": "Osorio Jurado",
"given": "Santiago"
},
{
"family": "Skorpil",
"given": "Mikael"
},
{
"family": "Svenningsson",
"given": "Per"
},
{
"family": "Moreno",
"given": "Rodrigo"
},
{
"family": "Olsson",
"given": "Christoffer"
}
],
"container-title-short": "Front Hum Neurosci",
"volume": "20",
"page": "1972676",
"PMCID": "PMC13730951",
"ISSN": "1662-5161",
"publisher": "Frontiers Media SA",
"language": "en",
"issued": {
"date-parts": [
[
2026,
11,
5
]
]
}
}

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.1162/imag_a_00481 [code]
The effect of brain tissue anisotropy on the electric field caused by transcranial electric stimulation: Sensitivity analysis and magnetic resonance electrical impedance tomography.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: 21 references
[2] doi:10.3390/brainsci16010044
Methods of Computational Modelling in Studies of Transcranial Direct Current Stimulation (tDCS) in Adults to Inform Protocols for Tinnitus Treatment: A Scoping Review.
Journal: Brain sciences
In common: other, 14 references
[3] doi:10.1038/s41598-023-45905-7 [code]
The impact of brain lesions on tDCS-induced electric fields.
Journal: Scientific reports
In common: other, 12 references
[4] doi:10.1162/imag_a_00526 [code]
Microstructure-informed brain tissue classification using clustering of quantitative MRI measures.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: MRtrix3, FSL, NiBabel, 3 other tools, structural MRI / diffusion, 7 references
[5] doi:10.1162/imag_a_00051 [code]
Unique information from common diffusion MRI models about white-matter differences across the human adult lifespan.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: FSL, NiBabel, SciPy, 1 other tool, structural MRI / diffusion, 8 references
[6] doi:10.1038/s42003-025-08981-1 [code]
Microstructural maturation of the adult mouse brain.
Journal: Communications biology
In common: MRtrix3, FSL, NumPy, structural MRI / diffusion, 7 references
[7] doi:10.1038/s41597-025-04886-0 [code]
Human head models and populational framework for simulating brain stimulations.
Journal: Scientific data
In common: NumPy, 9 references
[8] doi:10.1371/journal.pcbi.1011572 [code]
Dose-response in modulating brain function with transcranial direct current stimulation: From local to network levels.
Journal: PLoS computational biology
In common: other, 8 references
[9] doi:10.1002/hbm.26492
Are we really targeting and stimulating DLPFC by placing transcranial electrical stimulation (tES) electrodes over F3/F4?
Journal: Human brain mapping
In common: other, 8 references
[10] doi:10.1038/s41598-024-80372-8 [code]
Tensor-valued diffusion MRI detects brain microstructural abnormalities in HIV infected individuals with cognitive impairment.
Journal: Scientific reports
In common: FreeSurfer, structural MRI / diffusion, 8 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/repo/github.com/santioso-hue/mre-tdcs-pd.svg)](https://openscicode.org/badge/repo/github.com/santioso-hue/mre-tdcs-pd)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/repo/github.com/santioso-hue/mre-tdcs-pd.svg
   :target: https://openscicode.org/badge/repo/github.com/santioso-hue/mre-tdcs-pd
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/repo/github.com/santioso-hue/mre-tdcs-pd"><img src="https://openscicode.org/badge/repo/github.com/santioso-hue/mre-tdcs-pd.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.