OSCR

NeuroMArVL: An interactive and collaborative web-based tool for visualizing brain networks.

Code ↔ Paper

4 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 4 matches
  1. [1] § IMPLEMENTATION DETAILS › 2D Visualizations ↔ brain-app-server/brain-app/graph2d.ts, lines 266–321 · score 0.67 · node overlaps, COSE bilkent, Compound, nesting, fast
  2. [2] § USAGE DETAILS › Demonstrating NeuroMArVL’s Features ↔ netneurotools/datasets/fetch_template.py, lines 1449–1558 · score 0.56 · diffusion tractography, cortical surface, anatomically, strength, connectomes
  3. [3] § IMPLEMENTATION DETAILS › Included Data ↔ netneurotools/datasets/fetch_template.py, lines 684–744 · score 0.55 · fsLR, spherical, pial, smoothing, midthickness, inflated
  4. [4] § USAGE DETAILS › Data Inputs ↔ netneurotools/datasets/fetch_template.py, lines 1449–1558 · score 0.53 · connection strength, cortical surface, template, inflated, anatomical, human

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

Python · 1,581 lines · 67 KB · BSD-3-Clause · 3 matches

  1. """Functions for fetching template data."""
  2. import json
  3. from sklearn.utils import Bunch
  4. from .datasets_utils import (
  5. SURFACE,
  6. _get_reference_info,
  7. _check_freesurfer_subjid,
  8. fetch_file,
  9. )
  10. def fetch_fsaverage(
  11. version="fsaverage", use_local=False, force=False, data_dir=None, verbose=1
  12. ):
  13. """
  14. Download files for fsaverage FreeSurfer template.
  15. This dataset contains surface files for the fsaverage template including
  16. original, white matter, pial, inflated, and spherical surfaces for both
  17. left and right hemispheres.
  18. If you used this data, please cite 1_, 2_, 3_.
  19. Parameters
  20. ----------
  21. version : str, optional
  22. One of {'fsaverage', 'fsaverage3', 'fsaverage4', 'fsaverage5',
  23. 'fsaverage6'}. Default: 'fsaverage'
  24. use_local : bool, optional
  25. If True, will attempt to use local FreeSurfer data. Default: False
  26. Returns
  27. -------
  28. filenames : :class:`sklearn.utils.Bunch`
  29. Dictionary-like object with keys ['orig', 'white', 'smoothwm', 'pial',
  30. 'inflated', 'sphere'], where corresponding values are Surface
  31. namedtuples containing filepaths for the left (L) and right (R)
  32. hemisphere surface files.
  33. Other Parameters
  34. ----------------
  35. force : bool, optional
  36. If True, will overwrite existing dataset. Default: False
  37. data_dir : str, optional
  38. Path to use as data directory. If not specified, will check for
  39. environmental variable 'NNT_DATA'; if that is not set, will use
  40. `~/nnt-data` instead. Default: None
  41. verbose : int, optional
  42. Modifies verbosity of download, where higher numbers mean more updates.
  43. Default: 1
  44. Notes
  45. -----
  46. The returned surfaces represent different stages of cortical surface
  47. reconstruction and transformations:
  48. - **orig**: Original surface extracted from the brain volume, representing
  49. the initial estimate of the cortical boundary before topology correction.
  50. - **white**: White matter surface, representing the boundary between white
  51. matter and gray matter (inner cortical surface).
  52. - **smoothwm**: Smoothed white matter surface, created by applying
  53. smoothing to the white surface for improved visualization and analysis.
  54. - **pial**: Pial surface, representing the outer boundary of the cortex
  55. (gray matter/CSF interface). This is commonly used for cortical thickness
  56. calculations and surface-based registration.
  57. - **inflated**: Inflated surface, where sulci and gyri are smoothed to
  58. make visualization of the entire cortical surface easier while preserving
  59. topology. Useful for visualizing data across the cortex without occlusion
  60. by folding patterns.
  61. - **sphere**: Spherical surface, where the cortical surface is mapped to a
  62. sphere. This is essential for surface-based registration, inter-subject
  63. alignment, and applying parcellations.
  64. Each surface can be loaded with neuroimaging tools like nibabel and used
  65. for surface-based analyses, visualization, or spatial transformations.
  66. In a typical FreeSurfer installation, these template surfaces can be found
  67. in the subjects directory under ``$FREESURFER_HOME/subjects/`` (e.g.,
  68. ``$FREESURFER_HOME/subjects/fsaverage/surf/``). When ``use_local=True``,
  69. this function will attempt to locate and use these local files instead of
  70. downloading them.
  71. Example directory tree:
  72. ::
  73. ~/nnt-data/tpl-fsaverage
  74. ├── fsaverage
  75. │ ├── LICENSE
  76. │ └── surf
  77. │ ├── lh.curv
  78. │ ├── lh.inflated
  79. │ ├── lh.inflated_avg
  80. │ ├── lh.orig
  81. │ ├── lh.orig_avg
  82. │ ├── lh.pial
  83. │ ├── lh.pial_avg
  84. │ ├── lh.smoothwm
  85. │ ├── lh.sphere
  86. │ ├── lh.sphere.reg.avg
  87. │ ├── lh.white
  88. │ ├── lh.white_avg
  89. │ ├── rh.curv
  90. │ ├── rh.inflated
  91. │ ├── rh.inflated_avg
  92. │ ├── rh.orig
  93. │ ├── rh.orig_avg
  94. │ ├── rh.pial
  95. │ ├── rh.pial_avg
  96. │ ├── rh.smoothwm
  97. │ ├── rh.sphere
  98. │ ├── rh.sphere.reg.avg
  99. │ ├── rh.white
  100. │ └── rh.white_avg
  101. ├── fsaverage3
  102. │ ├── LICENSE
  103. │ └── surf
  104. │ ├── lh.curv
  105. │ ├── lh.inflated
  106. │ ├── lh.inflated_avg
  107. │ ├── lh.orig
  108. │ ├── lh.orig_avg
  109. │ ├── lh.pial
  110. │ ├── lh.pial_avg
  111. │ ├── lh.smoothwm
  112. │ ├── lh.sphere
  113. │ ├── lh.sphere.reg.avg
  114. │ ├── lh.white
  115. │ ├── lh.white_avg
  116. │ ├── rh.curv
  117. │ ├── rh.inflated
  118. │ ├── rh.inflated_avg
  119. │ ├── rh.orig
  120. │ ├── rh.orig_avg
  121. │ ├── rh.pial
  122. │ ├── rh.pial_avg
  123. │ ├── rh.smoothwm
  124. │ ├── rh.sphere
  125. │ ├── rh.sphere.reg.avg
  126. │ ├── rh.white
  127. │ └── rh.white_avg
  128. ├── fsaverage4
  129. │ ├── LICENSE
  130. │ └── surf
  131. │ ├── lh.curv
  132. │ ├── lh.inflated
  133. │ ├── lh.inflated_avg
  134. │ ├── lh.orig
  135. │ ├── lh.orig_avg
  136. │ ├── lh.pial
  137. │ ├── lh.pial_avg
  138. │ ├── lh.smoothwm
  139. │ ├── lh.sphere
  140. │ ├── lh.sphere.reg.avg
  141. │ ├── lh.white
  142. │ ├── lh.white_avg
  143. │ ├── rh.curv
  144. │ ├── rh.inflated
  145. │ ├── rh.inflated_avg
  146. │ ├── rh.orig
  147. │ ├── rh.orig_avg
  148. │ ├── rh.pial
  149. │ ├── rh.pial_avg
  150. │ ├── rh.smoothwm
  151. │ ├── rh.sphere
  152. │ ├── rh.sphere.reg.avg
  153. │ ├── rh.white
  154. │ └── rh.white_avg
  155. ├── fsaverage5
  156. │ ├── LICENSE
  157. │ └── surf
  158. │ ├── lh.curv
  159. │ ├── lh.inflated
  160. │ ├── lh.inflated_avg
  161. │ ├── lh.orig
  162. │ ├── lh.orig_avg
  163. │ ├── lh.pial
  164. │ ├── lh.pial_avg
  165. │ ├── lh.smoothwm
  166. │ ├── lh.sphere
  167. │ ├── lh.sphere.reg.avg
  168. │ ├── lh.white
  169. │ ├── lh.white_avg
  170. │ ├── rh.curv
  171. │ ├── rh.inflated
  172. │ ├── rh.inflated_avg
  173. │ ├── rh.orig
  174. │ ├── rh.orig_avg
  175. │ ├── rh.pial
  176. │ ├── rh.pial_avg
  177. │ ├── rh.smoothwm
  178. │ ├── rh.sphere
  179. │ ├── rh.sphere.reg.avg
  180. │ ├── rh.white
  181. │ └── rh.white_avg
  182. └── fsaverage6
  183. ├── LICENSE
  184. └── surf
  185. ├── lh.curv
  186. ├── lh.inflated
  187. ├── lh.inflated_avg
  188. ├── lh.orig
  189. ├── lh.orig_avg
  190. ├── lh.pial
  191. ├── lh.pial_avg
  192. ├── lh.smoothwm
  193. ├── lh.sphere
  194. ├── lh.sphere.reg.avg
  195. ├── lh.white
  196. ├── lh.white_avg
  197. ├── rh.curv
  198. ├── rh.inflated
  199. ├── rh.inflated_avg
  200. ├── rh.orig
  201. ├── rh.orig_avg
  202. ├── rh.pial
  203. ├── rh.pial_avg
  204. ├── rh.smoothwm
  205. ├── rh.sphere
  206. ├── rh.sphere.reg.avg
  207. ├── rh.white
  208. └── rh.white_avg
  209. 10 directories, 125 files
  210. References
  211. ----------
  212. .. [1] Anders M Dale, Bruce Fischl, and Martin I Sereno. Cortical
  213. surface-based analysis: i. segmentation and surface reconstruction.
  214. Neuroimage, 9(2):179\u2013194, 1999.
  215. .. [2] Bruce Fischl, Martin I Sereno, and Anders M Dale. Cortical
  216. surface-based analysis: ii: inflation, flattening, and a surface-based
  217. coordinate system. Neuroimage, 9(2):195\u2013207, 1999.
  218. .. [3] Bruce Fischl, Martin I Sereno, Roger BH Tootell, and Anders M Dale.
  219. High-resolution intersubject averaging and a coordinate system for the
  220. cortical surface. Human brain mapping, 8(4):272\u2013284, 1999.
  221. Examples
  222. --------
  223. Load the fsaverage template surfaces:
  224. >>> surfaces = fetch_fsaverage(version='fsaverage') # doctest: +SKIP
  225. >>> surfaces.keys() # doctest: +SKIP
  226. dict_keys(['orig', 'white', 'smoothwm', 'pial', 'inflated', 'sphere'])
  227. Access the pial surface paths for left and right hemispheres:
  228. >>> surfaces.pial # doctest: +SKIP
  229. Surface(L=PosixPath('~/nnt-data/tpl-fsaverage/fsaverage/surf/lh.pial'),
  230. R=PosixPath('~/nnt-data/tpl-fsaverage/fsaverage/surf/rh.pial'))
  231. Load the left pial surface with nibabel to examine its structure:
  232. >>> import nibabel as nib # doctest: +SKIP
  233. >>> pial_left = nib.freesurfer.read_geometry(surfaces.pial.L) # doctest: +SKIP
  234. >>> vertices, faces = pial_left # doctest: +SKIP
  235. >>> print(f"Vertices: {vertices.shape}, Faces: {faces.shape}") # doctest: +SKIP
  236. Vertices: (163842, 3), Faces: (327680, 3)
  237. """
  238. versions = ["fsaverage", "fsaverage3", "fsaverage4", "fsaverage5", "fsaverage6"]
  239. if version not in versions:
  240. raise ValueError(
  241. f"The version of fsaverage requested {version} does not "
  242. f"exist. Must be one of {versions}"
  243. )
  244. dataset_name = "tpl-fsaverage"
  245. _get_reference_info(dataset_name, verbose=verbose)
  246. keys = ["orig", "white", "smoothwm", "pial", "inflated", "sphere"]
  247. if use_local:
  248. try:
  249. data_dir = _check_freesurfer_subjid(version)[1]
  250. data = {
  251. k: SURFACE(
  252. data_dir / f"{version}/surf/lh.{k}",
  253. data_dir / f"{version}/surf/rh.{k}",
  254. )
  255. for k in keys
  256. }
  257. except FileNotFoundError:
  258. raise FileNotFoundError(
  259. f"Local FreeSurfer data for {version} not found. "
  260. "Please ensure FreeSurfer is installed and properly set up."
  261. ) from None
  262. else:
  263. fetched = fetch_file(
  264. dataset_name, keys=version, force=force, data_dir=data_dir, verbose=verbose
  265. )
  266. data = {
  267. k: SURFACE(
  268. fetched / f"surf/lh.{k}",
  269. fetched / f"surf/rh.{k}",
  270. )
  271. for k in keys
  272. }
  273. return Bunch(**data)
  274. def fetch_fsaverage_curated(version="fsaverage", force=False, data_dir=None, verbose=1):
  275. """
  276. Download files for fsaverage FreeSurfer template.
  277. This dataset contains surface geometry files (white, pial, inflated,
  278. sphere), medial wall labels, and surface shape files (sulcal depth and
  279. vertex area) in GIFTI format for the fsaverage template at various
  280. densities.
  281. If you used this data, please cite 1_, 2_, 3_, 4_.
  282. Parameters
  283. ----------
  284. version : str, optional
  285. One of {'fsaverage', 'fsaverage4', 'fsaverage5', 'fsaverage6'}.
  286. Default: 'fsaverage'
  287. Returns
  288. -------
  289. filenames : :class:`sklearn.utils.Bunch`
  290. Dictionary-like object with keys ['white', 'pial', 'inflated',
  291. 'sphere', 'medial', 'sulc', 'vaavg'], where corresponding values are
  292. Surface namedtuples containing filepaths for the left (L) and right
  293. (R) hemisphere files in GIFTI format.
  294. Other Parameters
  295. ----------------
  296. force : bool, optional
  297. If True, will overwrite existing dataset. Default: False
  298. data_dir : str, optional
  299. Path to use as data directory. If not specified, will check for
  300. environmental variable 'NNT_DATA'; if that is not set, will use
  301. `~/nnt-data` instead. Default: None
  302. verbose : int, optional
  303. Modifies verbosity of download, where higher numbers mean more updates.
  304. Default: 1
  305. Notes
  306. -----
  307. This function fetches curated fsaverage surfaces from the neuromaps
  308. package (see `neuromaps.datasets.fetch_fsaverage <https://netneurolab.github.io/neuromaps/generated/neuromaps.datasets.fetch_fsaverage.html>`_).
  309. All files are provided in GIFTI format (.gii) rather than FreeSurfer's
  310. native format.
  311. The returned files include:
  312. - **white**: White matter surface geometry (.surf.gii), representing the
  313. boundary between white matter and gray matter. Corresponds to FreeSurfer
  314. surfaces 'lh.white' and 'rh.white'.
  315. - **pial**: Pial surface geometry (.surf.gii), representing the outer
  316. cortical boundary. Corresponds to FreeSurfer surfaces 'lh.pial' and
  317. 'rh.pial'.
  318. - **inflated**: Inflated surface geometry (.surf.gii) for improved
  319. visualization of sulci and gyri. Corresponds to FreeSurfer surfaces
  320. 'lh.inflated' and 'rh.inflated'.
  321. - **sphere**: Spherical surface geometry (.surf.gii) used for surface-based
  322. registration and applying parcellations. Corresponds to FreeSurfer
  323. surfaces 'lh.sphere' and 'rh.sphere'.
  324. - **medial**: Medial wall mask (.label.gii) indicating vertices to exclude
  325. from analyses (vertices with no cortex). Not a standard FreeSurfer
  326. output; derived by neuromaps to mark the no-medial-wall vertices.
  327. - **sulc**: Sulcal depth map (.shape.gii) providing sulcal/gyral patterns
  328. on the midthickness surface. Corresponds to FreeSurfer 'lh.sulc' and
  329. 'rh.sulc' values resampled to the midthickness surface.
  330. - **vaavg**: Vertex area map (.shape.gii) representing the average vertex
  331. area on the midthickness surface. Not a standard FreeSurfer output;
  332. computed from mesh triangle areas and averaged per vertex.
  333. The vertex density varies by version: fsaverage (164k vertices),
  334. fsaverage6 (41k), fsaverage5 (10k), and fsaverage4 (3k).
  335. Example directory tree:
  336. ::
  337. ~/nnt-data/tpl-fsaverage_curated
  338. ├── fsaverage
  339. │ ├── tpl-fsaverage_den-164k_hemi-L_desc-nomedialwall_dparc.label.gii
  340. │ ├── tpl-fsaverage_den-164k_hemi-L_desc-sulc_midthickness.shape.gii
  341. │ ├── tpl-fsaverage_den-164k_hemi-L_desc-vaavg_midthickness.shape.gii
  342. │ ├── tpl-fsaverage_den-164k_hemi-L_inflated.surf.gii
  343. │ ├── tpl-fsaverage_den-164k_hemi-L_pial.surf.gii
  344. │ ├── tpl-fsaverage_den-164k_hemi-L_sphere.surf.gii
  345. │ ├── tpl-fsaverage_den-164k_hemi-L_white.surf.gii
  346. │ ├── tpl-fsaverage_den-164k_hemi-R_desc-nomedialwall_dparc.label.gii
  347. │ ├── tpl-fsaverage_den-164k_hemi-R_desc-sulc_midthickness.shape.gii
  348. │ ├── tpl-fsaverage_den-164k_hemi-R_desc-vaavg_midthickness.shape.gii
  349. │ ├── tpl-fsaverage_den-164k_hemi-R_inflated.surf.gii
  350. │ ├── tpl-fsaverage_den-164k_hemi-R_pial.surf.gii
  351. │ ├── tpl-fsaverage_den-164k_hemi-R_sphere.surf.gii
  352. │ └── tpl-fsaverage_den-164k_hemi-R_white.surf.gii
  353. ├── fsaverage4
  354. │ ├── tpl-fsaverage_den-3k_hemi-L_desc-nomedialwall_dparc.label.gii
  355. │ ├── tpl-fsaverage_den-3k_hemi-L_desc-sulc_midthickness.shape.gii
  356. │ ├── tpl-fsaverage_den-3k_hemi-L_desc-vaavg_midthickness.shape.gii
  357. │ ├── tpl-fsaverage_den-3k_hemi-L_inflated.surf.gii
  358. │ ├── tpl-fsaverage_den-3k_hemi-L_pial.surf.gii
  359. │ ├── tpl-fsaverage_den-3k_hemi-L_sphere.surf.gii
  360. │ ├── tpl-fsaverage_den-3k_hemi-L_white.surf.gii
  361. │ ├── tpl-fsaverage_den-3k_hemi-R_desc-nomedialwall_dparc.label.gii
  362. │ ├── tpl-fsaverage_den-3k_hemi-R_desc-sulc_midthickness.shape.gii
  363. │ ├── tpl-fsaverage_den-3k_hemi-R_desc-vaavg_midthickness.shape.gii
  364. │ ├── tpl-fsaverage_den-3k_hemi-R_inflated.surf.gii
  365. │ ├── tpl-fsaverage_den-3k_hemi-R_pial.surf.gii
  366. │ ├── tpl-fsaverage_den-3k_hemi-R_sphere.surf.gii
  367. │ └── tpl-fsaverage_den-3k_hemi-R_white.surf.gii
  368. ├── fsaverage5
  369. │ ├── tpl-fsaverage_den-10k_hemi-L_desc-nomedialwall_dparc.label.gii
  370. │ ├── tpl-fsaverage_den-10k_hemi-L_desc-sulc_midthickness.shape.gii
  371. │ ├── tpl-fsaverage_den-10k_hemi-L_desc-vaavg_midthickness.shape.gii
  372. │ ├── tpl-fsaverage_den-10k_hemi-L_inflated.surf.gii
  373. │ ├── tpl-fsaverage_den-10k_hemi-L_pial.surf.gii
  374. │ ├── tpl-fsaverage_den-10k_hemi-L_sphere.surf.gii
  375. │ ├── tpl-fsaverage_den-10k_hemi-L_white.surf.gii
  376. │ ├── tpl-fsaverage_den-10k_hemi-R_desc-nomedialwall_dparc.label.gii
  377. │ ├── tpl-fsaverage_den-10k_hemi-R_desc-sulc_midthickness.shape.gii
  378. │ ├── tpl-fsaverage_den-10k_hemi-R_desc-vaavg_midthickness.shape.gii
  379. │ ├── tpl-fsaverage_den-10k_hemi-R_inflated.surf.gii
  380. │ ├── tpl-fsaverage_den-10k_hemi-R_pial.surf.gii
  381. │ ├── tpl-fsaverage_den-10k_hemi-R_sphere.surf.gii
  382. │ └── tpl-fsaverage_den-10k_hemi-R_white.surf.gii
  383. └── fsaverage6
  384. ├── tpl-fsaverage_den-41k_hemi-L_desc-nomedialwall_dparc.label.gii
  385. ├── tpl-fsaverage_den-41k_hemi-L_desc-sulc_midthickness.shape.gii
  386. ├── tpl-fsaverage_den-41k_hemi-L_desc-vaavg_midthickness.shape.gii
  387. ├── tpl-fsaverage_den-41k_hemi-L_inflated.surf.gii
  388. ├── tpl-fsaverage_den-41k_hemi-L_pial.surf.gii
  389. ├── tpl-fsaverage_den-41k_hemi-L_sphere.surf.gii
  390. ├── tpl-fsaverage_den-41k_hemi-L_white.surf.gii
  391. ├── tpl-fsaverage_den-41k_hemi-R_desc-nomedialwall_dparc.label.gii
  392. ├── tpl-fsaverage_den-41k_hemi-R_desc-sulc_midthickness.shape.gii
  393. ├── tpl-fsaverage_den-41k_hemi-R_desc-vaavg_midthickness.shape.gii
  394. ├── tpl-fsaverage_den-41k_hemi-R_inflated.surf.gii
  395. ├── tpl-fsaverage_den-41k_hemi-R_pial.surf.gii
  396. ├── tpl-fsaverage_den-41k_hemi-R_sphere.surf.gii
  397. └── tpl-fsaverage_den-41k_hemi-R_white.surf.gii
  398. 4 directories, 56 files
  399. References
  400. ----------
  401. .. [1] Anders M Dale, Bruce Fischl, and Martin I Sereno. Cortical
  402. surface-based analysis: i. segmentation and surface reconstruction.
  403. Neuroimage, 9(2):179\u2013194, 1999.
  404. .. [2] Bruce Fischl, Martin I Sereno, and Anders M Dale. Cortical
  405. surface-based analysis: ii: inflation, flattening, and a surface-based
  406. coordinate system. Neuroimage, 9(2):195\u2013207, 1999.
  407. .. [3] Bruce Fischl, Martin I Sereno, Roger BH Tootell, and Anders M Dale.
  408. High-resolution intersubject averaging and a coordinate system for the
  409. cortical surface. Human brain mapping, 8(4):272\u2013284, 1999.
  410. .. [4] Ross D Markello, Justine Y Hansen, Zhen-Qi Liu, Vincent Bazinet,
  411. Golia Shafiei, Laura E Su\u00e1rez, Nadia Blostein, Jakob Seidlitz,
  412. Sylvain Baillet, Theodore D Satterthwaite, and others. Neuromaps:
  413. structural and functional interpretation of brain maps. Nature Methods,
  414. 19(11):1472\u20131479, 2022.
  415. Examples
  416. --------
  417. Load the fsaverage curated template surfaces:
  418. >>> surfaces = fetch_fsaverage_curated(version='fsaverage') # doctest: +SKIP
  419. >>> surfaces.keys() # doctest: +SKIP
  420. dict_keys(['white', 'pial', 'inflated', 'sphere', 'medial', 'sulc', 'vaavg'])
  421. Access the pial surface GIFTI files:
  422. >>> surfaces.pial # doctest: +SKIP
  423. Surface(L=PosixPath('~/nnt-data/tpl-fsaverage_curated/fsaverage/tpl-fsaverage_den-164k_hemi-L_pial.surf.gii'),
  424. R=PosixPath('~/nnt-data/tpl-fsaverage_curated/fsaverage/tpl-fsaverage_den-164k_hemi-R_pial.surf.gii'))
  425. Load the left pial surface with nibabel:
  426. >>> import nibabel as nib # doctest: +SKIP
  427. >>> pial_left = nib.load(surfaces.pial.L) # doctest: +SKIP
  428. >>> vertices = pial_left.agg_data('pointset') # doctest: +SKIP
  429. >>> faces = pial_left.agg_data('triangle') # doctest: +SKIP
  430. >>> print(f"Vertices: {vertices.shape}, Faces: {faces.shape}") # doctest: +SKIP
  431. Vertices: (163842, 3), Faces: (327680, 3)
  432. Load and examine the sulcal depth data:
  433. >>> sulc_left = nib.load(surfaces.sulc.L) # doctest: +SKIP
  434. >>> sulc_data = sulc_left.agg_data() # doctest: +SKIP
  435. >>> sulc_min, sulc_max = sulc_data.min(), sulc_data.max() # doctest: +SKIP
  436. >>> print(f"Sulcal depth range: {sulc_min:.2f} to {sulc_max:.2f}") # doctest: +SKIP
  437. Sulcal depth range: -1.78 to 1.88
  438. """
  439. versions = ["fsaverage", "fsaverage6", "fsaverage5", "fsaverage4"]
  440. if version not in versions:
  441. raise ValueError(
  442. f"The version of fsaverage requested {version} does not "
  443. f"exist. Must be one of {versions}"
  444. )
  445. dataset_name = "tpl-fsaverage_curated"
  446. _get_reference_info("tpl-fsaverage_curated", verbose=verbose)
  447. keys = ["white", "pial", "inflated", "sphere", "medial", "sulc", "vaavg"]
  448. keys_suffix = {
  449. "white": "white.surf",
  450. "pial": "pial.surf",
  451. "inflated": "inflated.surf",
  452. "sphere": "sphere.surf",
  453. "medial": "desc-nomedialwall_dparc.label",
  454. "sulc": "desc-sulc_midthickness.shape",
  455. "vaavg": "desc-vaavg_midthickness.shape",
  456. }
  457. version_density = {
  458. "fsaverage": "164k",
  459. "fsaverage6": "41k",
  460. "fsaverage5": "10k",
  461. "fsaverage4": "3k",
  462. }
  463. density = version_density[version]
  464. fetched = fetch_file(
  465. dataset_name, keys=version, force=force, data_dir=data_dir, verbose=verbose
  466. )
  467. # deal with default neuromaps directory structure in the archive
  468. if not fetched.exists():
  469. import shutil
  470. shutil.move(fetched.parent / "atlases/fsaverage", fetched)
  471. shutil.rmtree(fetched.parent / "atlases")
  472. data = {
  473. k: SURFACE(
  474. fetched / f"tpl-fsaverage_den-{density}_hemi-L_{keys_suffix[k]}.gii",
  475. fetched / f"tpl-fsaverage_den-{density}_hemi-R_{keys_suffix[k]}.gii",
  476. )
  477. for k in keys
  478. }
  479. return Bunch(**data)
  480. def fetch_hcp_standards(force=False, data_dir=None, verbose=1):
  481. """
  482. Fetch HCP standard mesh atlases for converting between FreeSurfer and HCP.
  483. This dataset contains standard mesh atlases used by Connectome Workbench
  484. to convert and register data between FreeSurfer fsaverage space and HCP
  485. fsLR space. It includes spherical templates for fsaverage and fsLR at
  486. multiple vertex densities (e.g., 164k, 59k, 32k), mapping spheres between
  487. fs (hemisphere-specific) and fsLR, and midthickness vertex area averages
  488. (``va_avg``) for resampling and area-preserving operations.
  489. The original file was from 3_, but is no longer available. The archived
  490. file is available from 4_.
  491. If you used this data, please cite 1_, 2_.
  492. Returns
  493. -------
  494. standards : str
  495. Filepath to standard_mesh_atlases directory
  496. Other Parameters
  497. ----------------
  498. force : bool, optional
  499. If True, will overwrite existing dataset. Default: False
  500. data_dir : str, optional
  501. Path to use as data directory. If not specified, will check for
  502. environmental variable 'NNT_DATA'; if that is not set, will use
  503. `~/nnt-data` instead. Default: None
  504. verbose : int, optional
  505. Modifies verbosity of download, where higher numbers mean more updates.
  506. Default: 1
  507. Notes
  508. -----
  509. Returns the path to the `standard_mesh_atlases` directory containing
  510. curated GIFTI files used for conversions between FreeSurfer fsaverage and
  511. HCP fsLR spaces, including spherical templates and midthickness vertex-area
  512. maps at multiple densities.
  513. Example directory tree:
  514. ::
  515. ~/nnt-data/tpl-hcp_standards/standard_mesh_atlases
  516. ├── fsaverage.L_LR.spherical_std.164k_fs_LR.surf.gii
  517. ├── fsaverage.R_LR.spherical_std.164k_fs_LR.surf.gii
  518. ├── fs_L
  519. │ ├── fsaverage.L.sphere.164k_fs_L.surf.gii
  520. │ └── fs_L-to-fs_LR_fsaverage.L_LR.spherical_std.164k_fs_L.surf.gii
  521. ├── fs_R
  522. │ ├── fsaverage.R.sphere.164k_fs_R.surf.gii
  523. │ └── fs_R-to-fs_LR_fsaverage.R_LR.spherical_std.164k_fs_R.surf.gii
  524. ├── L.sphere.32k_fs_LR.surf.gii
  525. ├── L.sphere.59k_fs_LR.surf.gii
  526. ├── resample_fsaverage
  527. │ ├── fsaverage4.L.midthickness_va_avg.3k_fsavg_L.shape.gii
  528. │ ├── fsaverage4.R.midthickness_va_avg.3k_fsavg_R.shape.gii
  529. │ ├── fsaverage4_std_sphere.L.3k_fsavg_L.surf.gii
  530. │ ├── fsaverage4_std_sphere.R.3k_fsavg_R.surf.gii
  531. │ ├── fsaverage5.L.midthickness_va_avg.10k_fsavg_L.shape.gii
  532. │ ├── fsaverage5.R.midthickness_va_avg.10k_fsavg_R.shape.gii
  533. │ ├── fsaverage5_std_sphere.L.10k_fsavg_L.surf.gii
  534. │ ├── fsaverage5_std_sphere.R.10k_fsavg_R.surf.gii
  535. │ ├── fsaverage6.L.midthickness_va_avg.41k_fsavg_L.shape.gii
  536. │ ├── fsaverage6.R.midthickness_va_avg.41k_fsavg_R.shape.gii
  537. │ ├── fsaverage6_std_sphere.L.41k_fsavg_L.surf.gii
  538. │ ├── fsaverage6_std_sphere.R.41k_fsavg_R.surf.gii
  539. │ ├── fsaverage.L.midthickness_va_avg.164k_fsavg_L.shape.gii
  540. │ ├── fsaverage.R.midthickness_va_avg.164k_fsavg_R.shape.gii
  541. │ ├── fsaverage_std_sphere.L.164k_fsavg_L.surf.gii
  542. │ ├── fsaverage_std_sphere.R.164k_fsavg_R.surf.gii
  543. │ ├── fs_LR-deformed_to-fsaverage.L.sphere.164k_fs_LR.surf.gii
  544. │ ├── fs_LR-deformed_to-fsaverage.L.sphere.32k_fs_LR.surf.gii
  545. │ ├── fs_LR-deformed_to-fsaverage.L.sphere.59k_fs_LR.surf.gii
  546. │ ├── fs_LR-deformed_to-fsaverage.R.sphere.164k_fs_LR.surf.gii
  547. │ ├── fs_LR-deformed_to-fsaverage.R.sphere.32k_fs_LR.surf.gii
  548. │ ├── fs_LR-deformed_to-fsaverage.R.sphere.59k_fs_LR.surf.gii
  549. │ ├── fs_LR.L.midthickness_va_avg.164k_fs_LR.shape.gii
  550. │ ├── fs_LR.L.midthickness_va_avg.32k_fs_LR.shape.gii
  551. │ ├── fs_LR.L.midthickness_va_avg.59k_fs_LR.shape.gii
  552. │ ├── fs_LR.R.midthickness_va_avg.164k_fs_LR.shape.gii
  553. │ ├── fs_LR.R.midthickness_va_avg.32k_fs_LR.shape.gii
  554. │ └── fs_LR.R.midthickness_va_avg.59k_fs_LR.shape.gii
  555. ├── R.sphere.32k_fs_LR.surf.gii
  556. └── R.sphere.59k_fs_LR.surf.gii
  557. 3 directories, 38 files
  558. References
  559. ----------
  560. .. [1] David C Van Essen, Kamil Ugurbil, Edward Auerbach, Deanna
  561. Barch,Timothy EJ Behrens, Richard Bucholz, Acer Chang, Liyong Chen,
  562. Maurizio Corbetta, Sandra W Curtiss, and others. The human connectome
  563. project: a data acquisition perspective. Neuroimage,
  564. 62(4):2222\u20132231, 2012.
  565. .. [2] Matthew F Glasser, Stamatios N Sotiropoulos, J Anthony Wilson,
  566. Timothy S Coalson, Bruce Fischl, Jesper L Andersson, Junqian Xu, Saad
  567. Jbabdi, Matthew Webster, Jonathan R Polimeni, and others. The minimal
  568. preprocessing pipelines for the human connectome project. Neuroimage,
  569. 80:105\u2013124, 2013.
  570. .. [3] http://brainvis.wustl.edu/workbench/standard_mesh_atlases.zip
  571. .. [4] https://web.archive.org/web/20220121035833/http://brainvis.wustl.edu/workbench/standard_mesh_atlases.zip
  572. Examples
  573. --------
  574. Load the standards directory and inspect contents:
  575. >>> standards = fetch_hcp_standards() # doctest: +SKIP
  576. >>> print(standards) # doctest: +SKIP
  577. PosixPath('~/nnt-data/tpl-hcp_standards/standard_mesh_atlases')
  578. List the fsLR 32k spherical templates:
  579. >>> import pathlib # doctest: +SKIP
  580. >>> list((standards).glob('L.sphere.32k_fs_LR.surf.gii')) # doctest: +SKIP
  581. [PosixPath('~/nnt-data/tpl-hcp_standards/standard_mesh_atlases/L.sphere.32k_fs_LR.surf.gii')]
  582. Load a sphere surface with nibabel and examine geometry:
  583. >>> import nibabel as nib # doctest: +SKIP
  584. >>> gii = nib.load(standards / 'L.sphere.32k_fs_LR.surf.gii') # doctest: +SKIP
  585. >>> vertices = gii.agg_data('pointset') # doctest: +SKIP
  586. >>> faces = gii.agg_data('triangle') # doctest: +SKIP
  587. >>> vertices.shape, faces.shape # doctest: +SKIP
  588. ((32492, 3), (64980, 3))
  589. """
  590. dataset_name = "tpl-hcp_standards"
  591. _get_reference_info(dataset_name, verbose=verbose)
  592. fetched = fetch_file(
  593. dataset_name,
  594. keys="standard_mesh_atlases",
  595. force=force,
  596. data_dir=data_dir,
  597. verbose=verbose,
  598. )
  599. return fetched
  600. def fetch_fslr_curated(version="fslr32k", force=False, data_dir=None, verbose=1):
  601. """
  602. Download files for HCP fsLR template.
  603. This dataset contains surface geometry files (midthickness, inflated,
  604. veryinflated [where available], sphere), medial wall labels, and surface
  605. shape files (sulcal depth and vertex area) in GIFTI format for the HCP fsLR
  606. template at various densities.
  607. If you used this data, please cite 1_, 2_, 3_.
  608. Parameters
  609. ----------
  610. version : str, optional
  611. One of {"fslr4k", "fslr8k", "fslr32k", "fslr164k"}. Default: 'fslr32k'
  612. Returns
  613. -------
  614. filenames : :class:`sklearn.utils.Bunch`
  615. Dictionary-like object with keys ['midthickness', 'inflated',
  616. 'veryinflated' (except for 'fslr4k'/'fslr8k'), 'sphere', 'medial',
  617. 'sulc', 'vaavg'], where corresponding values are Surface namedtuples
  618. containing filepaths for the left (L) and right (R) hemisphere files
  619. in GIFTI format.
  620. Other Parameters
  621. ----------------
  622. force : bool, optional
  623. If True, will overwrite existing dataset. Default: False
  624. data_dir : str, optional
  625. Path to use as data directory. If not specified, will check for
  626. environmental variable 'NNT_DATA'; if that is not set, will use
  627. `~/nnt-data` instead. Default: None
  628. verbose : int, optional
  629. Modifies verbosity of download, where higher numbers mean more updates.
  630. Default: 1
  631. Notes
  632. -----
  633. This function fetches curated fsLR surfaces from the neuromaps
  634. package (see `neuromaps.datasets.fetch_fslr <https://netneurolab.github.io/neuromaps/generated/neuromaps.datasets.fetch_fslr.html>`_).
  635. All files are provided in GIFTI format (.gii). The fsLR template is the
  636. HCP standard mesh used for group analyses and cross-subject alignment.
  637. The returned files include:
  638. - **midthickness**: Midthickness surface geometry (.surf.gii), halfway
  639. between white and pial surfaces; often preferred for data mapping.
  640. - **inflated**: Inflated surface geometry (.surf.gii) for improved
  641. visualization of sulci and gyri.
  642. - **veryinflated**: Very inflated surface geometry (.surf.gii) providing
  643. additional smoothing; not available for 'fslr4k'/'fslr8k'.
  644. - **sphere**: Spherical surface geometry (.surf.gii) used for surface-based
  645. registration and applying parcellations.
  646. - **medial**: Medial wall mask (.label.gii) indicating vertices to exclude
  647. from analyses (vertices with no cortex).
  648. - **sulc**: Sulcal depth map (.shape.gii) providing sulcal/gyral patterns
  649. on the midthickness surface.
  650. - **vaavg**: Vertex area map (.shape.gii) representing the average vertex
  651. area on the midthickness surface.
  652. The vertex density varies by version: fslr4k (≈4k vertices), fslr8k (≈8k),
  653. fslr32k (≈32k), and fslr164k (≈164k) per hemisphere.
  654. Example directory tree:
  655. ::
  656. ~/nnt-data/tpl-fslr_curated
  657. ├── fslr164k
  658. │ ├── README.md
  659. │ ├── tpl-fsLR_den-164k_hemi-L_desc-nomedialwall_dparc.label.gii
  660. │ ├── tpl-fsLR_den-164k_hemi-L_desc-sulc_midthickness.shape.gii
  661. │ ├── tpl-fsLR_den-164k_hemi-L_desc-vaavg_midthickness.shape.gii
  662. │ ├── tpl-fsLR_den-164k_hemi-L_inflated.surf.gii
  663. │ ├── tpl-fsLR_den-164k_hemi-L_midthickness.surf.gii
  664. │ ├── tpl-fsLR_den-164k_hemi-L_sphere.surf.gii
  665. │ ├── tpl-fsLR_den-164k_hemi-L_veryinflated.surf.gii
  666. │ ├── tpl-fsLR_den-164k_hemi-R_desc-nomedialwall_dparc.label.gii
  667. │ ├── tpl-fsLR_den-164k_hemi-R_desc-sulc_midthickness.shape.gii
  668. │ ├── tpl-fsLR_den-164k_hemi-R_desc-vaavg_midthickness.shape.gii
  669. │ ├── tpl-fsLR_den-164k_hemi-R_inflated.surf.gii
  670. │ ├── tpl-fsLR_den-164k_hemi-R_midthickness.surf.gii
  671. │ ├── tpl-fsLR_den-164k_hemi-R_sphere.surf.gii
  672. │ ├── tpl-fsLR_den-164k_hemi-R_veryinflated.surf.gii
  673. │ ├── tpl-fsLR_space-fsaverage_den-164k_hemi-L_sphere.surf.gii
  674. │ └── tpl-fsLR_space-fsaverage_den-164k_hemi-R_sphere.surf.gii
  675. ├── fslr32k
  676. │ ├── README.md
  677. │ ├── tpl-fsLR_den-32k_hemi-L_desc-nomedialwall_dparc.label.gii
  678. │ ├── tpl-fsLR_den-32k_hemi-L_desc-sulc_midthickness.shape.gii
  679. │ ├── tpl-fsLR_den-32k_hemi-L_desc-vaavg_midthickness.shape.gii
  680. │ ├── tpl-fsLR_den-32k_hemi-L_inflated.surf.gii
  681. │ ├── tpl-fsLR_den-32k_hemi-L_midthickness.surf.gii
  682. │ ├── tpl-fsLR_den-32k_hemi-L_sphere.surf.gii
  683. │ ├── tpl-fsLR_den-32k_hemi-L_veryinflated.surf.gii
  684. │ ├── tpl-fsLR_den-32k_hemi-R_desc-nomedialwall_dparc.label.gii
  685. │ ├── tpl-fsLR_den-32k_hemi-R_desc-sulc_midthickness.shape.gii
  686. │ ├── tpl-fsLR_den-32k_hemi-R_desc-vaavg_midthickness.shape.gii
  687. │ ├── tpl-fsLR_den-32k_hemi-R_inflated.surf.gii
  688. │ ├── tpl-fsLR_den-32k_hemi-R_midthickness.surf.gii
  689. │ ├── tpl-fsLR_den-32k_hemi-R_sphere.surf.gii
  690. │ ├── tpl-fsLR_den-32k_hemi-R_veryinflated.surf.gii
  691. │ ├── tpl-fsLR_space-fsaverage_den-32k_hemi-L_sphere.surf.gii
  692. │ └── tpl-fsLR_space-fsaverage_den-32k_hemi-R_sphere.surf.gii
  693. ├── fslr4k
  694. │ ├── tpl-fsLR_den-4k_hemi-L_desc-nomedialwall_dparc.label.gii
  695. │ ├── tpl-fsLR_den-4k_hemi-L_desc-sulc_midthickness.shape.gii
  696. │ ├── tpl-fsLR_den-4k_hemi-L_desc-vaavg_midthickness.shape.gii
  697. │ ├── tpl-fsLR_den-4k_hemi-L_inflated.surf.gii
  698. │ ├── tpl-fsLR_den-4k_hemi-L_midthickness.surf.gii
  699. │ ├── tpl-fsLR_den-4k_hemi-L_sphere.surf.gii
  700. │ ├── tpl-fsLR_den-4k_hemi-R_desc-nomedialwall_dparc.label.gii
  701. │ ├── tpl-fsLR_den-4k_hemi-R_desc-sulc_midthickness.shape.gii
  702. │ ├── tpl-fsLR_den-4k_hemi-R_desc-vaavg_midthickness.shape.gii
  703. │ ├── tpl-fsLR_den-4k_hemi-R_inflated.surf.gii
  704. │ ├── tpl-fsLR_den-4k_hemi-R_midthickness.surf.gii
  705. │ ├── tpl-fsLR_den-4k_hemi-R_sphere.surf.gii
  706. │ ├── tpl-fsLR_space-fsaverage_den-4k_hemi-L_sphere.surf.gii
  707. │ └── tpl-fsLR_space-fsaverage_den-4k_hemi-R_sphere.surf.gii
  708. └── fslr8k
  709. ├── tpl-fsLR_den-8k_hemi-L_desc-nomedialwall_dparc.label.gii
  710. ├── tpl-fsLR_den-8k_hemi-L_desc-sulc_midthickness.shape.gii
  711. ├── tpl-fsLR_den-8k_hemi-L_desc-vaavg_midthickness.shape.gii
  712. ├── tpl-fsLR_den-8k_hemi-L_inflated.surf.gii
  713. ├── tpl-fsLR_den-8k_hemi-L_midthickness.surf.gii
  714. ├── tpl-fsLR_den-8k_hemi-L_sphere.surf.gii
  715. ├── tpl-fsLR_den-8k_hemi-R_desc-nomedialwall_dparc.label.gii
  716. ├── tpl-fsLR_den-8k_hemi-R_desc-sulc_midthickness.shape.gii
  717. ├── tpl-fsLR_den-8k_hemi-R_desc-vaavg_midthickness.shape.gii
  718. ├── tpl-fsLR_den-8k_hemi-R_inflated.surf.gii
  719. ├── tpl-fsLR_den-8k_hemi-R_midthickness.surf.gii
  720. ├── tpl-fsLR_den-8k_hemi-R_sphere.surf.gii
  721. ├── tpl-fsLR_space-fsaverage_den-8k_hemi-L_sphere.surf.gii
  722. └── tpl-fsLR_space-fsaverage_den-8k_hemi-R_sphere.surf.gii
  723. 4 directories, 62 files
  724. References
  725. ----------
  726. .. [1] David C Van Essen, Kamil Ugurbil, Edward Auerbach, Deanna
  727. Barch,Timothy EJ Behrens, Richard Bucholz, Acer Chang, Liyong Chen,
  728. Maurizio Corbetta, Sandra W Curtiss, and others. The human connectome
  729. project: a data acquisition perspective. Neuroimage,
  730. 62(4):2222\u20132231, 2012.
  731. .. [2] Matthew F Glasser, Stamatios N Sotiropoulos, J Anthony Wilson,
  732. Timothy S Coalson, Bruce Fischl, Jesper L Andersson, Junqian Xu, Saad
  733. Jbabdi, Matthew Webster, Jonathan R Polimeni, and others. The minimal
  734. preprocessing pipelines for the human connectome project. Neuroimage,
  735. 80:105\u2013124, 2013.
  736. .. [3] Ross D Markello, Justine Y Hansen, Zhen-Qi Liu, Vincent Bazinet,
  737. Golia Shafiei, Laura E Su\u00e1rez, Nadia Blostein, Jakob Seidlitz,
  738. Sylvain Baillet, Theodore D Satterthwaite, and others. Neuromaps:
  739. structural and functional interpretation of brain maps. Nature Methods,
  740. 19(11):1472\u20131479, 2022.
  741. Examples
  742. --------
  743. Load the fsLR curated template surfaces:
  744. >>> surfaces = fetch_fslr_curated(version='fslr32k') # doctest: +SKIP
  745. >>> surfaces.keys() # doctest: +SKIP
  746. dict_keys(['midthickness', 'inflated', 'veryinflated', 'sphere', 'medial',
  747. 'sulc', 'vaavg'])
  748. Access the midthickness surface GIFTI files:
  749. >>> surfaces.midthickness # doctest: +SKIP
  750. Surface(L=PosixPath('~/nnt-data/tpl-fslr_curated/fslr32k/tpl-fsLR_den-32k_hemi-L_midthickness.surf.gii'),
  751. R=PosixPath('~/nnt-data/tpl-fslr_curated/fslr32k/tpl-fsLR_den-32k_hemi-R_midthickness.surf.gii'))
  752. Load the left midthickness surface with nibabel:
  753. >>> import nibabel as nib # doctest: +SKIP
  754. >>> gii = nib.load(surfaces.midthickness.L) # doctest: +SKIP
  755. >>> vertices = gii.agg_data('pointset') # doctest: +SKIP
  756. >>> faces = gii.agg_data('triangle') # doctest: +SKIP
  757. >>> print(vertices.shape, faces.shape) # doctest: +SKIP
  758. (32492, 3) (64980, 3)
  759. Load and examine the sulcal depth data:
  760. >>> sulc_left = nib.load(surfaces.sulc.L) # doctest: +SKIP
  761. >>> sulc_data = sulc_left.agg_data() # doctest: +SKIP
  762. >>> float(sulc_data.min()), float(sulc_data.max()) # doctest: +SKIP
  763. (-1.6234848499298096, 1.1611071825027466)
  764. """
  765. versions = ["fslr4k", "fslr8k", "fslr32k", "fslr164k"]
  766. if version not in versions:
  767. raise ValueError(
  768. f"The version of fsaverage requested {version} does not "
  769. f"exist. Must be one of {versions}"
  770. )
  771. dataset_name = "tpl-fslr_curated"
  772. _get_reference_info("tpl-fslr_curated", verbose=verbose)
  773. keys = [
  774. "midthickness",
  775. "inflated",
  776. "veryinflated",
  777. "sphere",
  778. "medial",
  779. "sulc",
  780. "vaavg",
  781. ]
  782. if version in ["fslr4k", "fslr8k"]:
  783. keys.remove("veryinflated")
  784. keys_suffix = {
  785. "midthickness": "midthickness.surf",
  786. "inflated": "inflated.surf",
  787. "veryinflated": "veryinflated.surf",
  788. "sphere": "sphere.surf",
  789. "medial": "desc-nomedialwall_dparc.label",
  790. "sulc": "desc-sulc_midthickness.shape",
  791. "vaavg": "desc-vaavg_midthickness.shape",
  792. }
  793. version_density = {
  794. "fslr4k": "4k",
  795. "fslr8k": "8k",
  796. "fslr32k": "32k",
  797. "fslr164k": "164k",
  798. }
  799. density = version_density[version]
  800. fetched = fetch_file(
  801. dataset_name, keys=version, force=force, data_dir=data_dir, verbose=verbose
  802. )
  803. # deal with default neuromaps directory structure in the archive
  804. if not fetched.exists():
  805. import shutil
  806. shutil.move(fetched.parent / "atlases/fsLR", fetched)
  807. shutil.rmtree(fetched.parent / "atlases")
  808. data = {
  809. k: SURFACE(
  810. fetched / f"tpl-fsLR_den-{density}_hemi-L_{keys_suffix[k]}.gii",
  811. fetched / f"tpl-fsLR_den-{density}_hemi-R_{keys_suffix[k]}.gii",
  812. )
  813. for k in keys
  814. }
  815. return Bunch(**data)
  816. def fetch_civet(density="41k", version="v1", force=False, data_dir=None, verbose=1):
  817. """
  818. Fetch CIVET surface files.
  819. This dataset contains midthickness and white matter surface files for the
  820. CIVET template in OBJ format, registered to ICBM152 space. CIVET is a
  821. fully automated structural image processing pipeline developed at the
  822. Montreal Neurological Institute.
  823. If you used this data, please cite 1_, 2_, 3_.
  824. Parameters
  825. ----------
  826. density : {'41k', '164k'}, optional
  827. Which density of the CIVET-space geometry files to fetch. The
  828. high-resolution '164k' surface only exists for version 'v2'
  829. version : {'v1, 'v2'}, optional
  830. Which version of the CIVET surfaces to use. Default: 'v2'
  831. Returns
  832. -------
  833. filenames : :class:`sklearn.utils.Bunch`
  834. Dictionary-like object with keys ['mid', 'white'], where corresponding
  835. values are Surface namedtuples containing filepaths for the left (L)
  836. and right (R) hemisphere surface files in OBJ format. Note: for version
  837. 'v1', the 'mid' and 'white' files are identical.
  838. Other Parameters
  839. ----------------
  840. force : bool, optional
  841. If True, will overwrite existing dataset. Default: False
  842. data_dir : str, optional
  843. Path to use as data directory. If not specified, will check for
  844. environmental variable 'NNT_DATA'; if that is not set, will use
  845. `~/nnt-data` instead. Default: None
  846. verbose : int, optional
  847. Modifies verbosity of download, where higher numbers mean more updates.
  848. Default: 1
  849. Notes
  850. -----
  851. The CIVET template surfaces are provided in OBJ format and registered to
  852. ICBM152 stereotaxic space.
  853. The returned files include:
  854. - **mid**: Midthickness surface (.obj), representing the surface halfway
  855. between white and gray matter boundaries. For version 'v1', this is
  856. identical to the white surface.
  857. - **white**: White matter surface (.obj), representing the boundary between
  858. white matter and gray matter.
  859. The vertex density varies by option: 41k (≈41k vertices) or 164k (≈164k)
  860. per hemisphere. The high-resolution 164k surface is only available for
  861. version 'v2'.
  862. Example directory tree:
  863. ::
  864. ~/nnt-data/tpl-civet
  865. ├── v1
  866. │ └── civet41k
  867. │ ├── tpl-civet_space-ICBM152_hemi-L_den-41k_mid.obj
  868. │ ├── tpl-civet_space-ICBM152_hemi-L_den-41k_white.obj
  869. │ ├── tpl-civet_space-ICBM152_hemi-R_den-41k_mid.obj
  870. │ └── tpl-civet_space-ICBM152_hemi-R_den-41k_white.obj
  871. └── v2
  872. ├── civet164k
  873. │ ├── tpl-civet_space-ICBM152_hemi-L_den-164k_mid.obj
  874. │ ├── tpl-civet_space-ICBM152_hemi-L_den-164k_white.obj
  875. │ ├── tpl-civet_space-ICBM152_hemi-R_den-164k_mid.obj
  876. │ └── tpl-civet_space-ICBM152_hemi-R_den-164k_white.obj
  877. └── civet41k
  878. ├── tpl-civet_space-ICBM152_hemi-L_den-41k_mid.obj
  879. ├── tpl-civet_space-ICBM152_hemi-L_den-41k_white.obj
  880. ├── tpl-civet_space-ICBM152_hemi-R_den-41k_mid.obj
  881. └── tpl-civet_space-ICBM152_hemi-R_den-41k_white.obj
  882. 5 directories, 12 files
  883. License: https://github.com/aces/CIVET_Full_Project/blob/master/LICENSE
  884. References
  885. ----------
  886. .. [1] Oliver Lyttelton, Maxime Boucher, Steven Robbins, and Alan Evans. An
  887. unbiased iterative group registration template for cortical surface
  888. analysis. Neuroimage, 34(4):1535\u20131544, 2007.
  889. .. [2] Vladimir S Fonov, Alan C Evans, Robert C McKinstry, C Robert Almli,
  890. and DL Collins. Unbiased nonlinear average age-appropriate brain
  891. templates from birth to adulthood. NeuroImage, 47:S102, 2009.
  892. .. [3] Y Ad-Dab'bagh, O Lyttelton, J Muehlboeck, C Lepage, D Einarson, K
  893. Mok, O Ivanov, R Vincent, J Lerch, and E Fombonne. The civet
  894. image-processing environment: a fully automated comprehensive pipeline
  895. for anatomical neuroimaging research. proceedings of the 12th annual
  896. meeting of the organization for human brain mapping. Florence, Italy,
  897. pages 2266, 2006.
  898. Examples
  899. --------
  900. Load the CIVET template surfaces:
  901. >>> surfaces = fetch_civet(density='41k', version='v2') # doctest: +SKIP
  902. >>> surfaces.keys() # doctest: +SKIP
  903. dict_keys(['mid', 'white'])
  904. Access the midthickness surface paths:
  905. >>> surfaces.mid # doctest: +SKIP
  906. Surface(L=PosixPath('~/nnt-data/tpl-civet/v2/civet41k/tpl-civet_space-ICBM152_hemi-L_den-41k_mid.obj'),
  907. R=PosixPath('~/nnt-data/tpl-civet/v2/civet41k/tpl-civet_space-ICBM152_hemi-R_den-41k_mid.obj'))
  908. Load the left midthickness surface with nibabel:
  909. >>> import nibabel as nib # doctest: +SKIP
  910. >>> vertices, faces = nib.freesurfer.read_geometry(surfaces.mid.L) # doctest: +SKIP
  911. >>> print(f"Vertices: {vertices.shape}, Faces: {faces.shape}") # doctest: +SKIP
  912. Vertices: (40962, 3), Faces: (81920, 3)
  913. """
  914. densities = ["41k", "164k"]
  915. if density not in densities:
  916. raise ValueError(
  917. f'The density of CIVET requested "{density}" does not exist. '
  918. f"Must be one of {densities}"
  919. )
  920. versions = ["v1", "v2"]
  921. if version not in versions:
  922. raise ValueError(
  923. f'The version of CIVET requested "{version}" does not exist. '
  924. f"Must be one of {versions}"
  925. )
  926. if version == "v1" and density == "164k":
  927. raise ValueError(
  928. 'The "164k" density CIVET surface only exists for ' 'version "v2"'
  929. )
  930. dataset_name = "tpl-civet"
  931. _get_reference_info(dataset_name, verbose=verbose)
  932. keys = ["mid", "white"]
  933. fetched = fetch_file(
  934. dataset_name,
  935. keys=[version, "civet" + density],
  936. force=force,
  937. data_dir=data_dir,
  938. verbose=verbose,
  939. )
  940. data = {
  941. k: SURFACE(
  942. fetched / f"tpl-civet_space-ICBM152_hemi-L_den-{density}_{k}.obj",
  943. fetched / f"tpl-civet_space-ICBM152_hemi-R_den-{density}_{k}.obj",
  944. )
  945. for k in keys
  946. }
  947. return Bunch(**data)
  948. def fetch_civet_curated(version="civet41k", force=False, data_dir=None, verbose=1):
  949. """
  950. Download files for CIVET template.
  951. This dataset contains surface geometry files (white, midthickness, inflated,
  952. veryinflated, sphere), medial wall labels, and surface shape files (sulcal
  953. depth and vertex area) in GIFTI format for the CIVET template at multiple
  954. densities.
  955. If you used this data, please cite 1_, 2_, 3_, 4_.
  956. Parameters
  957. ----------
  958. version : {'civet41k', 'civet164k'}, optional
  959. Which density of the CIVET-space geometry files to fetch.
  960. Returns
  961. -------
  962. filenames : :class:`sklearn.utils.Bunch`
  963. Dictionary-like object with keys ['white', 'midthickness', 'inflated',
  964. 'veryinflated', 'sphere', 'medial', 'sulc', 'vaavg'], where
  965. corresponding values are Surface namedtuples containing filepaths for
  966. the left (L) and right (R) hemisphere files in GIFTI format.
  967. Other Parameters
  968. ----------------
  969. force : bool, optional
  970. If True, will overwrite existing dataset. Default: False
  971. data_dir : str, optional
  972. Path to use as data directory. If not specified, will check for
  973. environmental variable 'NNT_DATA'; if that is not set, will use
  974. `~/nnt-data` instead. Default: None
  975. verbose : int, optional
  976. Modifies verbosity of download, where higher numbers mean more updates.
  977. Default: 1
  978. Notes
  979. -----
  980. This function fetches curated CIVET surfaces from the neuromaps
  981. package (see `neuromaps.datasets.fetch_civet <https://netneurolab.github.io/neuromaps/generated/neuromaps.datasets.fetch_civet.html>`_).
  982. All files are provided in GIFTI format (.gii). The CIVET template is
  983. registered to ICBM152 stereotaxic space.
  984. The returned files include:
  985. - **white**: White matter surface geometry (.surf.gii), representing the
  986. boundary between white matter and gray matter.
  987. - **midthickness**: Midthickness surface geometry (.surf.gii), halfway
  988. between white and pial surfaces.
  989. - **inflated**: Inflated surface geometry (.surf.gii) for improved
  990. visualization of sulci and gyri.
  991. - **veryinflated**: Very inflated surface geometry (.surf.gii) providing
  992. additional smoothing for visualization.
  993. - **sphere**: Spherical surface geometry (.surf.gii) used for surface-based
  994. registration and applying parcellations.
  995. - **medial**: Medial wall mask (.label.gii) indicating vertices to exclude
  996. from analyses (vertices with no cortex).
  997. - **sulc**: Sulcal depth map (.shape.gii) providing sulcal/gyral patterns
  998. on the midthickness surface.
  999. - **vaavg**: Vertex area map (.shape.gii) representing the average vertex
  1000. area on the midthickness surface.
  1001. The vertex density varies by version: civet41k (≈41k vertices) and
  1002. civet164k (≈164k) per hemisphere.
  1003. Example directory tree:
  1004. ::
  1005. ~/nnt-data/tpl-civet_curated
  1006. └── v2
  1007. ├── civet164k
  1008. │ ├── tpl-civet_den-164k_hemi-L_desc-nomedialwall_dparc.label.gii
  1009. │ ├── tpl-civet_den-164k_hemi-L_desc-sulc_midthickness.shape.gii
  1010. │ ├── tpl-civet_den-164k_hemi-L_desc-vaavg_midthickness.shape.gii
  1011. │ ├── tpl-civet_den-164k_hemi-L_inflated.surf.gii
  1012. │ ├── tpl-civet_den-164k_hemi-L_midthickness.surf.gii
  1013. │ ├── tpl-civet_den-164k_hemi-L_sphere.surf.gii
  1014. │ ├── tpl-civet_den-164k_hemi-L_veryinflated.surf.gii
  1015. │ ├── tpl-civet_den-164k_hemi-L_white.surf.gii
  1016. │ ├── tpl-civet_den-164k_hemi-R_desc-nomedialwall_dparc.label.gii
  1017. │ ├── tpl-civet_den-164k_hemi-R_desc-sulc_midthickness.shape.gii
  1018. │ ├── tpl-civet_den-164k_hemi-R_desc-vaavg_midthickness.shape.gii
  1019. │ ├── tpl-civet_den-164k_hemi-R_inflated.surf.gii
  1020. │ ├── tpl-civet_den-164k_hemi-R_midthickness.surf.gii
  1021. │ ├── tpl-civet_den-164k_hemi-R_sphere.surf.gii
  1022. │ ├── tpl-civet_den-164k_hemi-R_veryinflated.surf.gii
  1023. │ ├── tpl-civet_den-164k_hemi-R_white.surf.gii
  1024. │ ├── tpl-civet_space-fsaverage_den-164k_hemi-L_sphere.surf.gii
  1025. │ ├── tpl-civet_space-fsaverage_den-164k_hemi-R_sphere.surf.gii
  1026. │ ├── tpl-civet_space-fsLR_den-164k_hemi-L_sphere.surf.gii
  1027. │ └── tpl-civet_space-fsLR_den-164k_hemi-R_sphere.surf.gii
  1028. └── civet41k
  1029. ├── README.md
  1030. ├── tpl-civet_den-41k_hemi-L_desc-nomedialwall_dparc.label.gii
  1031. ├── tpl-civet_den-41k_hemi-L_desc-sulc_midthickness.shape.gii
  1032. ├── tpl-civet_den-41k_hemi-L_desc-vaavg_midthickness.shape.gii
  1033. ├── tpl-civet_den-41k_hemi-L_inflated.surf.gii
  1034. ├── tpl-civet_den-41k_hemi-L_midthickness.surf.gii
  1035. ├── tpl-civet_den-41k_hemi-L_sphere.surf.gii
  1036. ├── tpl-civet_den-41k_hemi-L_veryinflated.surf.gii
  1037. ├── tpl-civet_den-41k_hemi-L_white.surf.gii
  1038. ├── tpl-civet_den-41k_hemi-R_desc-nomedialwall_dparc.label.gii
  1039. ├── tpl-civet_den-41k_hemi-R_desc-sulc_midthickness.shape.gii
  1040. ├── tpl-civet_den-41k_hemi-R_desc-vaavg_midthickness.shape.gii
  1041. ├── tpl-civet_den-41k_hemi-R_inflated.surf.gii
  1042. ├── tpl-civet_den-41k_hemi-R_midthickness.surf.gii
  1043. ├── tpl-civet_den-41k_hemi-R_sphere.surf.gii
  1044. ├── tpl-civet_den-41k_hemi-R_veryinflated.surf.gii
  1045. ├── tpl-civet_den-41k_hemi-R_white.surf.gii
  1046. ├── tpl-civet_space-fsaverage_den-41k_hemi-L_sphere.surf.gii
  1047. ├── tpl-civet_space-fsaverage_den-41k_hemi-R_sphere.surf.gii
  1048. ├── tpl-civet_space-fsLR_den-41k_hemi-L_sphere.surf.gii
  1049. └── tpl-civet_space-fsLR_den-41k_hemi-R_sphere.surf.gii
  1050. 3 directories, 41 files
  1051. License: https://github.com/aces/CIVET_Full_Project/blob/master/LICENSE
  1052. References
  1053. ----------
  1054. .. [1] Oliver Lyttelton, Maxime Boucher, Steven Robbins, and Alan Evans. An
  1055. unbiased iterative group registration template for cortical surface
  1056. analysis. Neuroimage, 34(4):1535\u20131544, 2007.
  1057. .. [2] Vladimir S Fonov, Alan C Evans, Robert C McKinstry, C Robert Almli,
  1058. and DL Collins. Unbiased nonlinear average age-appropriate brain
  1059. templates from birth to adulthood. NeuroImage, 47:S102, 2009.
  1060. .. [3] Y Ad-Dab'bagh, O Lyttelton, J Muehlboeck, C Lepage, D Einarson, K
  1061. Mok, O Ivanov, R Vincent, J Lerch, and E Fombonne. The civet
  1062. image-processing environment: a fully automated comprehensive pipeline
  1063. for anatomical neuroimaging research. proceedings of the 12th annual
  1064. meeting of the organization for human brain mapping. Florence, Italy,
  1065. pages 2266, 2006.
  1066. .. [4] Ross D Markello, Justine Y Hansen, Zhen-Qi Liu, Vincent Bazinet,
  1067. Golia Shafiei, Laura E Su\u00e1rez, Nadia Blostein, Jakob Seidlitz,
  1068. Sylvain Baillet, Theodore D Satterthwaite, and others. Neuromaps:
  1069. structural and functional interpretation of brain maps. Nature Methods,
  1070. 19(11):1472\u20131479, 2022.
  1071. Examples
  1072. --------
  1073. Load the CIVET curated template surfaces:
  1074. >>> surfaces = fetch_civet_curated(version='civet41k') # doctest: +SKIP
  1075. >>> surfaces.keys() # doctest: +SKIP
  1076. dict_keys([
  1077. 'white', 'midthickness', 'inflated', 'veryinflated',
  1078. 'sphere', 'medial', 'sulc', 'vaavg'
  1079. ])
  1080. Access the midthickness surface GIFTI files:
  1081. >>> surfaces.midthickness # doctest: +SKIP
  1082. Surface(L=PosixPath('~/nnt-data/tpl-civet_curated/v2/civet41k/tpl-civet_den-41k_hemi-L_midthickness.surf.gii'),
  1083. R=PosixPath('~/nnt-data/tpl-civet_curated/v2/civet41k/tpl-civet_den-41k_hemi-R_midthickness.surf.gii'))
  1084. Load the left midthickness surface with nibabel:
  1085. >>> import nibabel as nib # doctest: +SKIP
  1086. >>> gii = nib.load(surfaces.midthickness.L) # doctest: +SKIP
  1087. >>> vertices = gii.agg_data('pointset') # doctest: +SKIP
  1088. >>> faces = gii.agg_data('triangle') # doctest: +SKIP
  1089. >>> print(f"Vertices: {vertices.shape}, Faces: {faces.shape}") # doctest: +SKIP
  1090. Vertices: (40962, 3), Faces: (81920, 3)
  1091. Load and examine the sulcal depth data:
  1092. >>> sulc_left = nib.load(surfaces.sulc.L) # doctest: +SKIP
  1093. >>> sulc_data = sulc_left.agg_data() # doctest: +SKIP
  1094. >>> float(sulc_data.min()), float(sulc_data.max()) # doctest: +SKIP
  1095. (-27.601072311401367, 20.54990005493164)
  1096. """
  1097. versions = ["civet41k", "civet164k"]
  1098. if version not in versions:
  1099. raise ValueError(
  1100. f"The version of fsaverage requested {version} does not "
  1101. f"exist. Must be one of {versions}"
  1102. )
  1103. dataset_name = "tpl-civet_curated"
  1104. _get_reference_info("tpl-civet_curated", verbose=verbose)
  1105. keys = [
  1106. "white",
  1107. "midthickness",
  1108. "inflated",
  1109. "veryinflated",
  1110. "sphere",
  1111. "medial",
  1112. "sulc",
  1113. "vaavg",
  1114. ]
  1115. keys_suffix = {
  1116. "white": "white.surf",
  1117. "midthickness": "midthickness.surf",
  1118. "inflated": "inflated.surf",
  1119. "veryinflated": "veryinflated.surf",
  1120. "sphere": "sphere.surf",
  1121. "medial": "desc-nomedialwall_dparc.label",
  1122. "sulc": "desc-sulc_midthickness.shape",
  1123. "vaavg": "desc-vaavg_midthickness.shape",
  1124. }
  1125. version_density = {
  1126. "civet41k": "41k",
  1127. "civet164k": "164k",
  1128. }
  1129. density = version_density[version]
  1130. fetched = fetch_file(
  1131. dataset_name,
  1132. keys=["v2", version],
  1133. force=force,
  1134. data_dir=data_dir,
  1135. verbose=verbose,
  1136. )
  1137. # deal with default neuromaps directory structure in the archive
  1138. if not fetched.exists():
  1139. import shutil
  1140. shutil.move(fetched.parent / "atlases/civet", fetched)
  1141. shutil.rmtree(fetched.parent / "atlases")
  1142. data = {
  1143. k: SURFACE(
  1144. fetched / f"tpl-civet_den-{density}_hemi-L_{keys_suffix[k]}.gii",
  1145. fetched / f"tpl-civet_den-{density}_hemi-R_{keys_suffix[k]}.gii",
  1146. )
  1147. for k in keys
  1148. }
  1149. return Bunch(**data)
  1150. def fetch_conte69(force=False, data_dir=None, verbose=1):
  1151. """
  1152. Download files for Van Essen et al., 2012 Conte69 template.
  1153. This dataset contains midthickness, inflated, and very inflated surface
  1154. files in GIFTI format for the Conte69 atlas, a population-average surface
  1155. template in fsLR32k space registered to MNI305 volumetric space.
  1156. If you used this data, please cite 1_, 2_.
  1157. Returns
  1158. -------
  1159. filenames : :class:`sklearn.utils.Bunch`
  1160. Dictionary-like object with keys ['midthickness', 'inflated',
  1161. 'vinflated', 'info'], where 'midthickness', 'inflated', and
  1162. 'vinflated' are Surface namedtuples containing filepaths for the left
  1163. (L) and right (R) hemisphere GIFTI files, and 'info' is a dictionary
  1164. containing template metadata from template_description.json.
  1165. Other Parameters
  1166. ----------------
  1167. force : bool, optional
  1168. If True, will overwrite existing dataset. Default: False
  1169. data_dir : str, optional
  1170. Path to use as data directory. If not specified, will check for
  1171. environmental variable 'NNT_DATA'; if that is not set, will use
  1172. `~/nnt-data` instead. Default: None
  1173. verbose : int, optional
  1174. Modifies verbosity of download, where higher numbers mean more updates.
  1175. Default: 1
  1176. Notes
  1177. -----
  1178. The Conte69 template is a population-average surface atlas registered to
  1179. MNI305 volumetric space using the fsLR32k mesh (approximately 32k vertices
  1180. per hemisphere).
  1181. The returned files include:
  1182. - **midthickness**: Midthickness surface geometry (.surf.gii), halfway
  1183. between white and pial surfaces.
  1184. - **inflated**: Inflated surface geometry (.surf.gii) for improved
  1185. visualization of sulci and gyri.
  1186. - **vinflated**: Very inflated surface geometry (.surf.gii) providing
  1187. additional smoothing for visualization.
  1188. - **info**: Metadata dictionary containing template name, BIDS version,
  1189. and references.
  1190. Example directory tree:
  1191. ::
  1192. ~/nnt-data/tpl-conte69
  1193. ├── CHANGES
  1194. ├── template_description.json
  1195. ├── tpl-conte69_space-MNI305_variant-fsLR32k_inflated.L.surf.gii
  1196. ├── tpl-conte69_space-MNI305_variant-fsLR32k_inflated.R.surf.gii
  1197. ├── tpl-conte69_space-MNI305_variant-fsLR32k_midthickness.L.surf.gii
  1198. ├── tpl-conte69_space-MNI305_variant-fsLR32k_midthickness.R.surf.gii
  1199. ├── tpl-conte69_space-MNI305_variant-fsLR32k_vinflated.L.surf.gii
  1200. └── tpl-conte69_space-MNI305_variant-fsLR32k_vinflated.R.surf.gii
  1201. 0 directories, 8 files
  1202. References
  1203. ----------
  1204. .. [1] David C Van Essen, Kamil Ugurbil, Edward Auerbach, Deanna Barch,
  1205. Timothy EJ Behrens, Richard Bucholz, Acer Chang, Liyong Chen, Maurizio
  1206. Corbetta, Sandra W Curtiss, and others. The human connectome project: a
  1207. data acquisition perspective. Neuroimage, 62(4):2222\u20132231, 2012.
  1208. .. [2] David C Van Essen, Matthew F Glasser, Donna L Dierker, John Harwell,
  1209. and Timothy Coalson. Parcellations and hemispheric asymmetries of human
  1210. cerebral cortex analyzed on surface-based atlases. Cerebral cortex,
  1211. 22(10):2241\u20132262, 2012.
  1212. .. [3] http://brainvis.wustl.edu/wiki/index.php//Caret:Atlases/Conte69_Atlas
  1213. Examples
  1214. --------
  1215. Load the Conte69 template surfaces:
  1216. >>> surfaces = fetch_conte69() # doctest: +SKIP
  1217. >>> surfaces.keys() # doctest: +SKIP
  1218. dict_keys(['midthickness', 'inflated', 'vinflated', 'info'])
  1219. Access the midthickness surface GIFTI files:
  1220. >>> surfaces.midthickness # doctest: +SKIP
  1221. Surface(L=PosixPath('~/nnt-data/tpl-conte69/tpl-conte69_space-MNI305_variant-fsLR32k_midthickness.L.surf.gii'),
  1222. R=PosixPath('~/nnt-data/tpl-conte69/tpl-conte69_space-MNI305_variant-fsLR32k_midthickness.R.surf.gii'))
  1223. Load the left midthickness surface with nibabel:
  1224. >>> import nibabel as nib # doctest: +SKIP
  1225. >>> gii = nib.load(surfaces.midthickness.L) # doctest: +SKIP
  1226. >>> vertices = gii.agg_data('pointset') # doctest: +SKIP
  1227. >>> faces = gii.agg_data('triangle') # doctest: +SKIP
  1228. >>> print(f"Vertices: {vertices.shape}, Faces: {faces.shape}") # doctest: +SKIP
  1229. Vertices: (32492, 3), Faces: (64980, 3)
  1230. Examine template metadata:
  1231. >>> surfaces.info['Name'] # doctest: +SKIP
  1232. "The 'Conte-69' template"
  1233. """
  1234. dataset_name = "tpl-conte69"
  1235. _get_reference_info(dataset_name, verbose=verbose)
  1236. keys = ["midthickness", "inflated", "vinflated"]
  1237. fetched = fetch_file(dataset_name, force=force, data_dir=data_dir, verbose=verbose)
  1238. data = {
  1239. k: SURFACE(
  1240. fetched / f"tpl-conte69_space-MNI305_variant-fsLR32k_{k}.L.surf.gii",
  1241. fetched / f"tpl-conte69_space-MNI305_variant-fsLR32k_{k}.R.surf.gii",
  1242. )
  1243. for k in keys
  1244. }
  1245. data["info"] = json.load(open(fetched / "template_description.json", "r"))
  1246. return Bunch(**data)
  1247. def fetch_yerkes19(force=False, data_dir=None, verbose=1):
  1248. """
  1249. Download files for Donahue et al., 2016 Yerkes19 template.
  1250. This dataset contains midthickness, inflated, and very inflated surface
  1251. files in GIFTI format for the Yerkes19 macaque template in fsLR32k space.
  1252. The Yerkes19 atlas is a population-average surface template for macaque
  1253. monkeys derived from high-resolution anatomical scans.
  1254. If you used this data, please cite 1_.
  1255. Returns
  1256. -------
  1257. filenames : :class:`sklearn.utils.Bunch`
  1258. Dictionary-like object with keys ['midthickness', 'inflated',
  1259. 'vinflated'], where corresponding values are Surface namedtuples
  1260. containing filepaths for the left (L) and right (R) hemisphere GIFTI
  1261. surface files.
  1262. Other Parameters
  1263. ----------------
  1264. force : bool, optional
  1265. If True, will overwrite existing dataset. Default: False
  1266. data_dir : str, optional
  1267. Path to use as data directory. If not specified, will check for
  1268. environmental variable 'NNT_DATA'; if that is not set, will use
  1269. `~/nnt-data` instead. Default: None
  1270. verbose : int, optional
  1271. Modifies verbosity of download, where higher numbers mean more updates.
  1272. Default: 1
  1273. Notes
  1274. -----
  1275. The Yerkes19 template is a macaque cortical surface atlas using the fsLR32k
  1276. mesh (approximately 32k vertices per hemisphere). It was developed to
  1277. facilitate comparative neuroanatomy studies between human and non-human
  1278. primates.
  1279. The returned files include:
  1280. - **midthickness**: Midthickness surface geometry (.surf.gii), halfway
  1281. between white and pial surfaces.
  1282. - **inflated**: Inflated surface geometry (.surf.gii) for improved
  1283. visualization of sulci and gyri.
  1284. - **vinflated**: Very inflated surface geometry (.surf.gii) providing
  1285. additional smoothing for visualization.
  1286. Example directory tree:
  1287. ::
  1288. ~/nnt-data/tpl-yerkes19
  1289. ├── tpl-yerkes19_space-fsLR32k_inflated.L.surf.gii
  1290. ├── tpl-yerkes19_space-fsLR32k_inflated.R.surf.gii
  1291. ├── tpl-yerkes19_space-fsLR32k_midthickness.L.surf.gii
  1292. ├── tpl-yerkes19_space-fsLR32k_midthickness.R.surf.gii
  1293. ├── tpl-yerkes19_space-fsLR32k_vinflated.L.surf.gii
  1294. └── tpl-yerkes19_space-fsLR32k_vinflated.R.surf.gii
  1295. 0 directories, 6 files
  1296. References
  1297. ----------
  1298. .. [1] Chad J Donahue, Stamatios N Sotiropoulos, Saad Jbabdi, Moises
  1299. Hernandez-Fernandez, Timothy E Behrens, Tim B Dyrby, Timothy Coalson,
  1300. Henry Kennedy, Kenneth Knoblauch, David C Van Essen, and others. Using
  1301. diffusion tractography to predict cortical connection strength and
  1302. distance: a quantitative comparison with tracers in the monkey. Journal
  1303. of Neuroscience, 36(25):6758\u20136770, 2016.
  1304. .. [2] https://balsa.wustl.edu/reference/show/976nz
  1305. Examples
  1306. --------
  1307. Load the Yerkes19 template surfaces:
  1308. >>> surfaces = fetch_yerkes19() # doctest: +SKIP
  1309. >>> surfaces.keys() # doctest: +SKIP
  1310. dict_keys(['midthickness', 'inflated', 'vinflated'])
  1311. Access the midthickness surface GIFTI files:
  1312. >>> surfaces.midthickness # doctest: +SKIP
  1313. Surface(L=PosixPath('~/nnt-data/tpl-yerkes19/tpl-yerkes19_space-fsLR32k_midthickness.L.surf.gii'),
  1314. R=PosixPath('~/nnt-data/tpl-yerkes19/tpl-yerkes19_space-fsLR32k_midthickness.R.surf.gii'))
  1315. Load the left midthickness surface with nibabel:
  1316. >>> import nibabel as nib # doctest: +SKIP
  1317. >>> gii = nib.load(surfaces.midthickness.L) # doctest: +SKIP
  1318. >>> vertices = gii.agg_data('pointset') # doctest: +SKIP
  1319. >>> faces = gii.agg_data('triangle') # doctest: +SKIP
  1320. >>> print(f"Vertices: {vertices.shape}, Faces: {faces.shape}") # doctest: +SKIP
  1321. Vertices: (32492, 3), Faces: (64980, 3)
  1322. """
  1323. dataset_name = "tpl-yerkes19"
  1324. _get_reference_info(dataset_name, verbose=verbose)
  1325. keys = ["midthickness", "inflated", "vinflated"]
  1326. fetched = fetch_file(dataset_name, force=force, data_dir=data_dir, verbose=verbose)
  1327. data = {
  1328. k: SURFACE(
  1329. fetched / f"tpl-yerkes19_space-fsLR32k_{k}.L.surf.gii",
  1330. fetched / f"tpl-yerkes19_space-fsLR32k_{k}.R.surf.gii",
  1331. )
  1332. for k in keys
  1333. }
  1334. return Bunch(**data)
  1335. def _fetch_subcortex_surface(
  1336. force=False, data_dir=None, verbose=1
  1337. ):
  1338. dataset_name = "tpl-subcortex_surface"
  1339. _get_reference_info(dataset_name, verbose=verbose)
  1340. fetched = fetch_file(
  1341. dataset_name,
  1342. force=force,
  1343. data_dir=data_dir,
  1344. verbose=verbose,
  1345. )
  1346. data = {
  1347. k: fetched / f"{k}_surfaces.vtm"
  1348. for k in [
  1349. "aseg", "tianS1", "tianS2", "tianS3", "tianS4"
  1350. ]
  1351. }
  1352. return data

fetch_template.py at commit 49f83c0, under BSD-3-Clause · at the source

Overview

Authors: Christopher Leslie Adamson1, Mehul Gajwani1, Matthias Klapperstueck2, James Manley2, Tim Dwyer2, Alex Fornito1
  1. Turner Institute for Brain and Mental Health, School of Psychological Sciences, and Monash Biomedical Imaging, Monash University, Melbourne, Australia
  2. Faculty of Information Technology, Monash University, Melbourne, Australia
Institutions: Monash University (Australia)
Journal: Network neuroscience (Cambridge, Mass.), volume 10, issue 3, pages 683-705
Dates: received 23 June 2025; accepted 17 March 2026; published online 20 July 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1162/netn.a.569 · PMID 42529553 · PMCID PMC13418255 · OpenAlex W7155199086
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: methods / tools (subfield)
Methods: Smoothing, state filtering, decompositions, Graphs, Statistics, fMRI & imaging
Keywords: connectome, visualization, web, software
Topic: Functional Brain Connectivity Studies (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Citations: not cited yet (Europe PMC); 51 references in the paper

Abstract

Brain connectivity data are high-dimensional and are often modeled as graphs comprising in the order of ∼102–104 nodes connected by around 103–106 edges. Generating useful visualizations is essential for reducing and understanding such complexity. Indeed, this complexity offers a particular challenge for transparent science, since investigators must often choose a specific snapshot of a visualization for publication that often overlooks much of the rich detail present in the data. A further challenge for neuroscience is that brains are physical systems, and it is often important to consider how topological properties of the connectome, which can be visualized within arbitrarily abstract spaces, relate to their physical embedding. Most available tools offer visualizations for physically or topologically embedded representations without a clear mapping between the two. Here, we introduce NeuroMArVL, a novel, open-source, web-based brain connectome visualization tool that offers numerous features for moving seamlessly between, and interacting with, different physical and topological representations of connectome data. Critically, visualization data and parameters can be saved locally or on the web server as shareable links, facilitating reuse, collaboration, and open, transparent reporting of results in publications. The software can be freely accessed at https://immersive.erc.monash.edu/neuromarvl/.

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

Repositories

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

sidchop/brainconn

License: other
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: c1b7569fa8dc2db24327d06317ddf61040489ef6, 18 September 2025
Languages: JavaScript (12), R (10)
Size: 130 files, 22 scripts
Software Heritage: not archived
Found in: the text, “INTRODUCTION”
Holds: README, license file, environment (DESCRIPTION), tests, continuous integration, documentation, 2 notebooks
Not found: CITATION.cff
Tools: cowplot (1 file), ggplot2 (1 file), igraph (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
24 files

immersive.erc.monash.edu/neuromarvl

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: the link answers
Software Heritage: not checked
Found in: the text, “USAGE DETAILS”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
  • 27 September 2026: the link answers (HTTP 200)

NSBLab/neuromarvl

License: GPL-3.0
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: 7294c83db866d7fea5dee05218ba4d7c156d2812, 2 July 2026
Languages: JavaScript (310), TypeScript (126), MATLAB (14), Python (1)
Size: 4,042 files, 451 scripts
Software Heritage: not archived
Found in: “CODE/DATA AVAILABILITY AND CONTRIBUTIONS”
Holds: README, license file
Not found: CITATION.cff, environment file, tests, continuous integration, documentation
Tools: GIfTI library for MATLAB (3 files), cifti-matlab (2 files), Image Processing Toolbox (2 files)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
453 files

netneurolab/netneurotools

License: BSD-3-Clause
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: 49f83c023022ab606581cb10aec6a6282a306c48, 31 July 2026
Languages: Python (83), Shell (3)
Size: 118 files, 86 scripts
Software Heritage: archived
Found in: the resources table
Holds: README, license file, environment (Dockerfile, pyproject.toml, requirements.txt, setup.py, docs/requirements.txt), tests, continuous integration, documentation
Not found: CITATION.cff
Tools: NumPy (41 files), netneurotools (26 files), scikit-learn (11 files), SciPy (10 files), Matplotlib (9 files), NiBabel (8 files), Numba (8 files), Brain Connectivity Toolbox (3 files), neuromaps (1 file), Nilearn (1 file), pandas (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
88 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:

  • 4 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 559 scripts, each with its path and the digest of its content;
  • 4 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.

Reproducibility and Data Sharing

NeuroMArVL supports various features, accessible through the data tab, that facilitate the generation of reproducible visualizations by both an individual user and multiple users working collaboratively. This is done by saving and sharing visualization settings, which refer to the appearance of the brain surface, the nodes and edges in the primary view, and the appearance of the secondary view. If a surface model was uploaded, this will also be saved.

The “Save settings to file” function downloads the current settings to a local JSON file. This file can be manually edited if desired. It can later be uploaded using the “Load settings from file” function, which applies these saved settings to the current visualization. This functionality does not save any data to remote servers and the files remain entirely in the control of the user. The JSON file can act as a settings template that can produce reproducible visualizations across multiple datasets: These datasets can use different attributes and adjacency matrices, but must have the same dimensions (vertices and edges) and node labels. This functionality is all maintained when NeuroMArVL is built and deployed locally.

The “Save settings on webserver and share link” function saves the settings and the coordinates, matrix, attributes and labels on the webserver permanently (see Saved Data). Each data file is saved as is on the web server using randomly generated file names, and a link that allows users to share their visualizations with other researchers is generated. Any uploaded data may be deleted on request.

NeuroMArVL also provides functionality to visualize and export images for multiple adjacency matrix/attribute pairs automatically using the “Batch mode” function (Figure 2A, second panel). Firstly, the user sets up a visualization in one dataset by choosing a brain surface model, node locations/labels, and any desired 2D projection, placing and orienting the elements in their appropriate location. Then, in the batch mode tab, the user selects pairs of adjacency/weight matrix and attribute files for which visualization is required. These new adjacency and attribute files must have the same dimensions and format as the originals. After selecting the format and size of the output image files, NeuroMArVL iterates through all the selected adjacency/weight matrix and attribute file pairs and generates images with the same visualization parameters as the original, which can be saved to the local hard drive. As a use case, Figure 5 depicts the images generated from batch mode showing differing edge and node strengths across preprocessing methods for diffusion-based connectomes for a common parcellation scheme.

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

Code/data availability and contributions

All code is available via the repository at https://github.com/NSBLab/neuromarvl. NeuroMArVL can be downloaded, built, and used offline if desired. Contributions can be made and reviewed using GitHub’s forking and pull requests features.

The data included in the viewer are available via the website (https://immersive.erc.monash.edu/neuromarvl/brain-app/data/example.zip) and via the repository. Users can also contribute data by contacting the authors. Surface models must be in MNI space and would be made available in the selectable list. Parcellation schemes, comprising of node locations and labels, would be made available for download via GitHub; these could then be uploaded via the data tab in the NeuroMARvL interface

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

Recorded: type, language, journal, volume, issue, pages, dates, 6 authors, 4 keywords, 3 funders, 51 references.

Cite

This paper

Adamson, C. L., Gajwani, M., Klapperstueck, M., Manley, J., Dwyer, T., & Fornito, A. (2026). NeuroMArVL: An interactive and collaborative web-based tool for visualizing brain networks. Network neuroscience (Cambridge, Mass.), 10(3), 683-705. https://doi.org/10.1162/netn.a.569

BibTeX

@article{adamson2026neuromarvl,
author = {Adamson, Christopher Leslie and Gajwani, Mehul and Klapperstueck, Matthias and Manley, James and Dwyer, Tim and Fornito, Alex},
title = {{NeuroMArVL: An interactive and collaborative web-based tool for visualizing brain networks}},
journal = {Network neuroscience (Cambridge, Mass.)},
year = {2026},
month = jul,
volume = {10},
number = {3},
pages = {683--705},
publisher = {MIT Press},
issn = {2472-1751},
doi = {10.1162/netn.a.569},
url = {https://doi.org/10.1162/netn.a.569},
pmid = {42529553},
pmcid = {PMC13418255}
}

RIS

TY - JOUR
AU - Adamson, Christopher Leslie
AU - Gajwani, Mehul
AU - Klapperstueck, Matthias
AU - Manley, James
AU - Dwyer, Tim
AU - Fornito, Alex
TI - NeuroMArVL: An interactive and collaborative web-based tool for visualizing brain networks
T2 - Network neuroscience (Cambridge, Mass.)
J2 - Netw Neurosci
PY - 2026
DA - 2026/07/20
VL - 10
IS - 3
SP - 683
EP - 705
SN - 2472-1751
PB - MIT Press
DO - 10.1162/netn.a.569
UR - https://doi.org/10.1162/netn.a.569
LA - en
ER -

CSL-JSON

{
"id": "10.1162/netn.a.569",
"type": "article-journal",
"title": "NeuroMArVL: An interactive and collaborative web-based tool for visualizing brain networks",
"container-title": "Network neuroscience (Cambridge, Mass.)",
"author": [
{
"family": "Adamson",
"given": "Christopher Leslie"
},
{
"family": "Gajwani",
"given": "Mehul"
},
{
"family": "Klapperstueck",
"given": "Matthias"
},
{
"family": "Manley",
"given": "James"
},
{
"family": "Dwyer",
"given": "Tim"
},
{
"family": "Fornito",
"given": "Alex"
}
],
"container-title-short": "Netw Neurosci",
"volume": "10",
"issue": "3",
"page": "683-705",
"DOI": "10.1162/netn.a.569",
"PMID": "42529553",
"PMCID": "PMC13418255",
"ISSN": "2472-1751",
"publisher": "MIT Press",
"URL": "https://doi.org/10.1162/netn.a.569",
"language": "en",
"issued": {
"date-parts": [
[
2026,
7,
20
]
]
}
}

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.7554/elife.103097 [code]
Canonical neurodevelopmental trajectories of structural and functional manifolds.
Journal: eLife
In common: netneurotools, neuromaps, Brain Connectivity Toolbox, 8 other tools, 4 references
[2] doi:10.1371/journal.pbio.3003856 [code]
Aging and metabolism contribute separately to brain-body health.
Journal: PLoS biology
In common: netneurotools, neuromaps, GIfTI library for MATLAB, 8 other tools, 3 references
[3] doi:10.1038/s42003-025-09444-3 [code]
Decoupling of neurophysiological activity from structure mirrors global microarchitectural and neuromodulatory trends.
Journal: Communications biology
In common: netneurotools, neuromaps, Brain Connectivity Toolbox, 8 other tools, 3 references
[4] doi:10.1038/s41398-026-04025-2 [code]
Brain energetic landscapes shape state dysregulation in major depressive disorder: a morphological network controllability perspective.
Journal: Translational psychiatry
In common: neuromaps, Brain Connectivity Toolbox, GIfTI library for MATLAB, 9 other tools, 3 references
[5] doi:10.1038/s41586-026-10631-3 [code]
A prognostic human brain network for diffuse midline glioma.
Journal: Nature
In common: cifti-matlab, neuromaps, GIfTI library for MATLAB, 8 other tools, 3 references
[6] doi:10.1002/hbm.70605 [code]
BrainEnrich: Revealing Biological Insights for Imaging-Derived Phenotypes Through Transcriptomic Enrichment.
Journal: Human brain mapping
In common: netneurotools, cifti-matlab, GIfTI library for MATLAB, 9 other tools, 2 references
[7] doi:10.1038/s41467-026-71151-2 [code]
Common and distinct neural correlates of social interaction processing and theory of mind in narratives.
Journal: Nature communications
In common: cifti-matlab, Brain Connectivity Toolbox, GIfTI library for MATLAB, 9 other tools, 2 references
[8] doi:10.1038/s41467-026-74466-2 [code]
Neuromorphic hierarchical modular reservoirs.
Journal: Nature communications
In common: netneurotools, neuromaps, Brain Connectivity Toolbox, 8 other tools, 2 references
[9] doi:10.21203/rs.3.rs-9326213/v1 [code]
Multi-task fMRI outperforms resting-state fMRI for revealing task-invariant organization of the human brain
Journal: Research Square (preprint)
In common: neuromaps, GIfTI library for MATLAB, Numba, 8 other tools, 3 references
[10] doi:10.64898/2026.03.09.710558 [code]
Multi-task fMRI outperforms resting-state fMRI for revealing task-invariant organization of the human brain
Journal: bioRxiv (preprint)
In common: neuromaps, GIfTI library for MATLAB, Numba, 8 other tools, 3 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.

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: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

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