junifer 0.0.7.dev332__py3-none-any.whl → 0.0.8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (293) hide show
  1. junifer/_version.py +9 -19
  2. junifer/api/__init__.pyi +17 -2
  3. junifer/api/functions.py +222 -39
  4. junifer/api/queue_context/__init__.pyi +11 -3
  5. junifer/api/queue_context/gnu_parallel_local_adapter.py +81 -120
  6. junifer/api/queue_context/htcondor_adapter.py +118 -181
  7. junifer/api/queue_context/queue_context_adapter.py +51 -7
  8. junifer/api/queue_context/tests/test_gnu_parallel_local_adapter.py +10 -35
  9. junifer/api/queue_context/tests/test_htcondor_adapter.py +13 -50
  10. junifer/api/res/fsl/run_fsl_docker.sh +4 -0
  11. junifer/api/tests/test_functions.py +863 -36
  12. junifer/cli/__init__.py +1 -7
  13. junifer/cli/cli.py +41 -22
  14. junifer/cli/parser.py +23 -147
  15. junifer/cli/tests/data/gmd_mean.yaml +6 -6
  16. junifer/cli/tests/data/gmd_mean_htcondor.yaml +6 -5
  17. junifer/cli/tests/data/partly_cloudy_agg_mean_tian.yml +1 -0
  18. junifer/cli/tests/test_cli.py +120 -4
  19. junifer/cli/tests/test_cli_utils.py +23 -6
  20. junifer/cli/utils.py +14 -9
  21. junifer/configs/__init__.py +5 -0
  22. junifer/configs/__init__.pyi +0 -0
  23. junifer/configs/juseless/datagrabbers/__init__.pyi +4 -2
  24. junifer/configs/juseless/datagrabbers/aomic_id1000_vbm.py +18 -24
  25. junifer/configs/juseless/datagrabbers/camcan_vbm.py +20 -27
  26. junifer/configs/juseless/datagrabbers/ixi_vbm.py +44 -52
  27. junifer/configs/juseless/datagrabbers/tests/test_ixi_vbm.py +0 -7
  28. junifer/configs/juseless/datagrabbers/tests/test_ucla.py +2 -19
  29. junifer/configs/juseless/datagrabbers/ucla.py +111 -104
  30. junifer/configs/juseless/datagrabbers/ukb_vbm.py +19 -25
  31. junifer/configs/py.typed +0 -0
  32. junifer/conftest.py +63 -24
  33. junifer/data/_dispatch.py +9 -19
  34. junifer/data/coordinates/_ants_coordinates_warper.py +4 -1
  35. junifer/data/coordinates/_coordinates.py +51 -6
  36. junifer/data/coordinates/_fsl_coordinates_warper.py +4 -1
  37. junifer/data/coordinates/tests/test_coordinates.py +15 -3
  38. junifer/data/coordinates/tests/test_coordinates_names.py +37 -0
  39. junifer/data/maps/_ants_maps_warper.py +18 -12
  40. junifer/data/maps/_fsl_maps_warper.py +7 -3
  41. junifer/data/maps/_maps.py +12 -8
  42. junifer/data/maps/tests/test_maps.py +13 -21
  43. junifer/data/masks/_ants_mask_warper.py +18 -12
  44. junifer/data/masks/_fsl_mask_warper.py +7 -3
  45. junifer/data/masks/_masks.py +15 -12
  46. junifer/data/masks/tests/test_masks.py +20 -17
  47. junifer/data/parcellations/_ants_parcellation_warper.py +18 -12
  48. junifer/data/parcellations/_fsl_parcellation_warper.py +7 -5
  49. junifer/data/parcellations/_parcellations.py +125 -91
  50. junifer/data/parcellations/tests/test_parcellations.py +122 -1
  51. junifer/data/template_spaces.py +117 -50
  52. junifer/data/tests/test_template_spaces.py +10 -7
  53. junifer/data/utils.py +10 -8
  54. junifer/datagrabber/__init__.pyi +38 -5
  55. junifer/datagrabber/aomic/__init__.pyi +8 -1
  56. junifer/datagrabber/aomic/_types.py +22 -0
  57. junifer/datagrabber/aomic/id1000.py +193 -183
  58. junifer/datagrabber/aomic/piop1.py +215 -259
  59. junifer/datagrabber/aomic/piop2.py +211 -244
  60. junifer/datagrabber/aomic/tests/test_id1000.py +70 -53
  61. junifer/datagrabber/aomic/tests/test_piop1.py +98 -102
  62. junifer/datagrabber/aomic/tests/test_piop2.py +88 -85
  63. junifer/datagrabber/base.py +253 -79
  64. junifer/datagrabber/datalad_base.py +127 -76
  65. junifer/datagrabber/dmcc13_benchmark.py +204 -289
  66. junifer/datagrabber/hcp1200/__init__.pyi +7 -2
  67. junifer/datagrabber/hcp1200/datalad_hcp1200.py +61 -40
  68. junifer/datagrabber/hcp1200/hcp1200.py +151 -164
  69. junifer/datagrabber/hcp1200/tests/test_hcp1200.py +116 -128
  70. junifer/datagrabber/multiple.py +183 -63
  71. junifer/datagrabber/pattern.py +358 -227
  72. junifer/datagrabber/pattern_datalad.py +84 -124
  73. junifer/datagrabber/pattern_validation_mixin.py +22 -50
  74. junifer/datagrabber/tests/test_base.py +17 -4
  75. junifer/datagrabber/tests/test_datalad_base.py +20 -27
  76. junifer/datagrabber/tests/test_dmcc13_benchmark.py +110 -122
  77. junifer/datagrabber/tests/test_multiple.py +293 -31
  78. junifer/datagrabber/tests/test_pattern.py +577 -18
  79. junifer/datagrabber/tests/test_pattern_datalad.py +177 -107
  80. junifer/datagrabber/tests/test_pattern_validation_mixin.py +9 -51
  81. junifer/datareader/default.py +8 -5
  82. junifer/datareader/tests/test_default_reader.py +1 -1
  83. junifer/external/BrainPrint/.codecov.yml +2 -0
  84. junifer/external/BrainPrint/.codespellignore +2 -0
  85. junifer/external/BrainPrint/.github/ISSUE_TEMPLATE/bug-report.md +45 -0
  86. junifer/external/BrainPrint/.github/ISSUE_TEMPLATE/documentation.md +12 -0
  87. junifer/external/BrainPrint/.github/ISSUE_TEMPLATE/feature-request.md +24 -0
  88. junifer/external/BrainPrint/.github/ISSUE_TEMPLATE/questions-help-support.md +28 -0
  89. junifer/external/BrainPrint/.github/dependabot.yml +6 -0
  90. junifer/external/BrainPrint/.github/workflows/build.yml +53 -0
  91. junifer/external/BrainPrint/.github/workflows/code-style.yml +44 -0
  92. junifer/external/BrainPrint/.github/workflows/doc.yml +65 -0
  93. junifer/external/BrainPrint/.github/workflows/publish.yml +31 -0
  94. junifer/external/BrainPrint/.github/workflows/pytest.yml +54 -0
  95. junifer/external/BrainPrint/.gitignore +123 -0
  96. junifer/external/BrainPrint/LICENSE +21 -0
  97. junifer/external/BrainPrint/README.md +108 -0
  98. junifer/external/BrainPrint/brainprint/cli/__init__.py +11 -0
  99. junifer/external/BrainPrint/brainprint/cli/help_text.py +169 -0
  100. junifer/external/BrainPrint/brainprint/cli/parser.py +150 -0
  101. junifer/external/BrainPrint/brainprint/cli/utils.py +14 -0
  102. junifer/external/BrainPrint/brainprint/commands/__init__.py +0 -0
  103. junifer/external/BrainPrint/brainprint/commands/sys_info.py +18 -0
  104. junifer/external/BrainPrint/brainprint/utils/tests/__init__.py +0 -0
  105. junifer/external/BrainPrint/brainprint/utils/tests/test_config.py +33 -0
  106. junifer/external/BrainPrint/doc/Makefile +20 -0
  107. junifer/external/BrainPrint/doc/_static/.gitkeep +0 -0
  108. junifer/external/BrainPrint/doc/_templates/autosummary/class.rst +10 -0
  109. junifer/external/BrainPrint/doc/_templates/autosummary/function.rst +8 -0
  110. junifer/external/BrainPrint/doc/_templates/autosummary/module.rst +6 -0
  111. junifer/external/BrainPrint/doc/api/index.rst +11 -0
  112. junifer/external/BrainPrint/doc/conf.py +272 -0
  113. junifer/external/BrainPrint/doc/index.rst +140 -0
  114. junifer/external/BrainPrint/doc/links.inc +36 -0
  115. junifer/external/BrainPrint/doc/make.bat +35 -0
  116. junifer/external/BrainPrint/doc/references.bib +23 -0
  117. junifer/external/BrainPrint/pyproject.toml +170 -0
  118. junifer/external/BrainPrint/setup.py +3 -0
  119. junifer/external/__init__.py +5 -0
  120. junifer/external/__init__.pyi +0 -0
  121. junifer/external/nilearn/junifer_connectivity_measure.py +95 -39
  122. junifer/external/nilearn/junifer_nifti_spheres_masker.py +226 -67
  123. junifer/external/nilearn/tests/test_junifer_connectivity_measure.py +39 -27
  124. junifer/external/nilearn/tests/test_junifer_nifti_spheres_masker.py +231 -21
  125. junifer/external/py.typed +0 -0
  126. junifer/markers/__init__.pyi +6 -3
  127. junifer/markers/base.py +126 -76
  128. junifer/markers/brainprint.py +30 -39
  129. junifer/markers/complexity/__init__.py +20 -3
  130. junifer/markers/complexity/complexity_base.py +40 -41
  131. junifer/markers/complexity/hurst_exponent.py +22 -35
  132. junifer/markers/complexity/multiscale_entropy_auc.py +53 -41
  133. junifer/markers/complexity/perm_entropy.py +22 -36
  134. junifer/markers/complexity/range_entropy.py +22 -35
  135. junifer/markers/complexity/range_entropy_auc.py +27 -36
  136. junifer/markers/complexity/sample_entropy.py +22 -36
  137. junifer/markers/complexity/tests/test_complexity_registry.py +48 -0
  138. junifer/markers/complexity/tests/test_hurst_exponent.py +47 -36
  139. junifer/markers/complexity/tests/test_multiscale_entropy_auc.py +50 -36
  140. junifer/markers/complexity/tests/test_perm_entropy.py +48 -36
  141. junifer/markers/complexity/tests/test_range_entropy.py +47 -36
  142. junifer/markers/complexity/tests/test_range_entropy_auc.py +47 -36
  143. junifer/markers/complexity/tests/test_sample_entropy.py +48 -36
  144. junifer/markers/complexity/tests/test_weighted_perm_entropy.py +50 -36
  145. junifer/markers/complexity/weighted_perm_entropy.py +22 -36
  146. junifer/markers/ets_rss.py +35 -31
  147. junifer/markers/falff/__init__.pyi +7 -1
  148. junifer/markers/falff/_afni_falff.py +22 -9
  149. junifer/markers/falff/_junifer_falff.py +47 -31
  150. junifer/markers/falff/falff_base.py +80 -60
  151. junifer/markers/falff/falff_maps.py +17 -41
  152. junifer/markers/falff/falff_parcels.py +26 -51
  153. junifer/markers/falff/falff_spheres.py +34 -61
  154. junifer/markers/falff/tests/test_falff_maps.py +20 -23
  155. junifer/markers/falff/tests/test_falff_mask.py +99 -0
  156. junifer/markers/falff/tests/test_falff_parcels.py +14 -10
  157. junifer/markers/falff/tests/test_falff_spheres.py +14 -10
  158. junifer/markers/functional_connectivity/crossparcellation_functional_connectivity.py +32 -34
  159. junifer/markers/functional_connectivity/edge_functional_connectivity_maps.py +12 -25
  160. junifer/markers/functional_connectivity/edge_functional_connectivity_parcels.py +19 -34
  161. junifer/markers/functional_connectivity/edge_functional_connectivity_spheres.py +24 -44
  162. junifer/markers/functional_connectivity/functional_connectivity_base.py +50 -40
  163. junifer/markers/functional_connectivity/functional_connectivity_maps.py +12 -25
  164. junifer/markers/functional_connectivity/functional_connectivity_parcels.py +19 -34
  165. junifer/markers/functional_connectivity/functional_connectivity_spheres.py +24 -45
  166. junifer/markers/functional_connectivity/tests/test_crossparcellation_functional_connectivity.py +21 -22
  167. junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_maps.py +8 -7
  168. junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_parcels.py +8 -4
  169. junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_spheres.py +8 -4
  170. junifer/markers/functional_connectivity/tests/test_functional_connectivity_maps.py +8 -7
  171. junifer/markers/functional_connectivity/tests/test_functional_connectivity_parcels.py +9 -5
  172. junifer/markers/functional_connectivity/tests/test_functional_connectivity_spheres.py +8 -12
  173. junifer/markers/maps_aggregation.py +77 -55
  174. junifer/markers/parcel_aggregation.py +91 -70
  175. junifer/markers/reho/__init__.pyi +7 -1
  176. junifer/markers/reho/_afni_reho.py +23 -14
  177. junifer/markers/reho/_junifer_reho.py +112 -123
  178. junifer/markers/reho/reho_base.py +115 -37
  179. junifer/markers/reho/reho_maps.py +18 -32
  180. junifer/markers/reho/reho_parcels.py +26 -41
  181. junifer/markers/reho/reho_spheres.py +33 -54
  182. junifer/markers/reho/tests/test_junifer_reho.py +178 -0
  183. junifer/markers/reho/tests/test_reho_maps.py +27 -25
  184. junifer/markers/reho/tests/test_reho_parcels.py +28 -22
  185. junifer/markers/reho/tests/test_reho_spheres.py +16 -12
  186. junifer/markers/sphere_aggregation.py +88 -72
  187. junifer/markers/temporal_snr/temporal_snr_base.py +32 -30
  188. junifer/markers/temporal_snr/temporal_snr_maps.py +9 -18
  189. junifer/markers/temporal_snr/temporal_snr_parcels.py +19 -27
  190. junifer/markers/temporal_snr/temporal_snr_spheres.py +27 -41
  191. junifer/markers/temporal_snr/tests/test_temporal_snr_base.py +2 -2
  192. junifer/markers/temporal_snr/tests/test_temporal_snr_maps.py +17 -22
  193. junifer/markers/temporal_snr/tests/test_temporal_snr_parcels.py +11 -3
  194. junifer/markers/temporal_snr/tests/test_temporal_snr_spheres.py +9 -9
  195. junifer/markers/tests/test_brainprint.py +10 -9
  196. junifer/markers/tests/test_ets_rss.py +7 -3
  197. junifer/markers/tests/test_lost_regions.py +279 -0
  198. junifer/markers/tests/test_maps_aggregation.py +67 -114
  199. junifer/markers/tests/test_marker_utils.py +40 -1
  200. junifer/markers/tests/test_markers_base.py +275 -6
  201. junifer/markers/tests/test_parcel_aggregation.py +91 -53
  202. junifer/markers/tests/test_sphere_aggregation.py +53 -47
  203. junifer/markers/utils.py +267 -5
  204. junifer/onthefly/__init__.py +2 -3
  205. junifer/onthefly/__init__.pyi +4 -0
  206. junifer/onthefly/_brainprint.py +3 -5
  207. junifer/onthefly/py.typed +0 -0
  208. junifer/onthefly/read_transform.py +11 -9
  209. junifer/onthefly/tests/test_read_transform.py +7 -7
  210. junifer/pipeline/__init__.pyi +4 -2
  211. junifer/pipeline/marker_collection.py +14 -10
  212. junifer/pipeline/pipeline_component_registry.py +25 -6
  213. junifer/pipeline/pipeline_step_mixin.py +5 -12
  214. junifer/pipeline/tests/test_data_object_dumper.py +10 -10
  215. junifer/pipeline/tests/test_marker_collection.py +145 -168
  216. junifer/pipeline/tests/test_pipeline_component_registry.py +52 -8
  217. junifer/pipeline/tests/test_pipeline_step_mixin.py +12 -26
  218. junifer/pipeline/tests/test_update_meta_mixin.py +4 -5
  219. junifer/pipeline/tests/test_workdir_manager.py +39 -0
  220. junifer/pipeline/update_meta_mixin.py +13 -10
  221. junifer/pipeline/utils.py +22 -17
  222. junifer/pipeline/workdir_manager.py +41 -32
  223. junifer/preprocess/__init__.pyi +9 -4
  224. junifer/preprocess/_temporal_filter.py +34 -33
  225. junifer/preprocess/_temporal_slicer.py +17 -30
  226. junifer/preprocess/base.py +99 -55
  227. junifer/preprocess/confounds/__init__.pyi +10 -2
  228. junifer/preprocess/confounds/fmriprep_confound_remover.py +87 -109
  229. junifer/preprocess/confounds/tests/test_fmriprep_confound_remover.py +64 -45
  230. junifer/preprocess/smoothing/__init__.pyi +2 -2
  231. junifer/preprocess/smoothing/_afni_smoothing.py +8 -7
  232. junifer/preprocess/smoothing/_fsl_smoothing.py +6 -4
  233. junifer/preprocess/smoothing/_nilearn_smoothing.py +7 -5
  234. junifer/preprocess/smoothing/smoothing.py +59 -40
  235. junifer/preprocess/smoothing/tests/test_smoothing.py +28 -8
  236. junifer/preprocess/tests/test_preprocess_base.py +17 -9
  237. junifer/preprocess/tests/test_temporal_filter.py +37 -16
  238. junifer/preprocess/tests/test_temporal_slicer.py +12 -12
  239. junifer/preprocess/warping/__init__.pyi +2 -2
  240. junifer/preprocess/warping/_ants_warper.py +56 -40
  241. junifer/preprocess/warping/_fsl_warper.py +49 -36
  242. junifer/preprocess/warping/_utils.py +106 -0
  243. junifer/preprocess/warping/space_warper.py +99 -98
  244. junifer/preprocess/warping/tests/test_space_warper.py +46 -41
  245. junifer/preprocess/warping/tests/test_warping_utils.py +163 -0
  246. junifer/stats.py +46 -34
  247. junifer/storage/__init__.pyi +8 -4
  248. junifer/storage/base.py +129 -64
  249. junifer/storage/hdf5.py +307 -199
  250. junifer/storage/pandas_base.py +46 -24
  251. junifer/storage/sqlite.py +99 -62
  252. junifer/storage/tests/data/collected_h5io_fork.hdf5 +0 -0
  253. junifer/storage/tests/test_hdf5.py +147 -12
  254. junifer/storage/tests/test_repeated_storage.py +293 -0
  255. junifer/storage/tests/test_sqlite.py +9 -20
  256. junifer/storage/tests/test_storage_base.py +18 -21
  257. junifer/storage/tests/test_utils.py +83 -22
  258. junifer/storage/utils.py +58 -38
  259. junifer/testing/__init__.pyi +2 -2
  260. junifer/testing/datagrabbers.py +480 -44
  261. junifer/testing/registry.py +12 -0
  262. junifer/testing/tests/test_adhdtesting_datagrabber.py +24 -0
  263. junifer/testing/tests/test_oasisvmbtesting_datagrabber.py +5 -0
  264. junifer/testing/tests/test_partlycloudytesting_datagrabber.py +52 -0
  265. junifer/testing/tests/test_spmauditory_datagrabber.py +16 -0
  266. junifer/testing/tests/test_testing_registry.py +31 -0
  267. junifer/testing/tests/test_testing_utils.py +35 -0
  268. junifer/testing/tests/test_uclacnpvbmtesting_datagrabber.py +81 -0
  269. junifer/testing/utils.py +33 -1
  270. junifer/tests/test_stats.py +1 -5
  271. junifer/typing/__init__.pyi +2 -0
  272. junifer/typing/_typing.py +34 -19
  273. junifer/typing/py.typed +0 -0
  274. junifer/utils/__init__.pyi +10 -1
  275. junifer/utils/_config.py +1 -2
  276. junifer/utils/helpers.py +68 -2
  277. junifer/utils/logging.py +31 -7
  278. junifer/utils/tests/test_helpers.py +36 -1
  279. {junifer-0.0.7.dev332.dist-info → junifer-0.0.8.dist-info}/METADATA +43 -35
  280. junifer-0.0.8.dist-info/RECORD +402 -0
  281. {junifer-0.0.7.dev332.dist-info → junifer-0.0.8.dist-info}/WHEEL +1 -1
  282. junifer/cli/tests/test_parser.py +0 -280
  283. junifer/external/h5io/h5io/__init__.py +0 -15
  284. junifer/external/h5io/h5io/_h5io.py +0 -767
  285. junifer/external/h5io/h5io/_version.py +0 -1
  286. junifer/external/h5io/h5io/chunked_array.py +0 -94
  287. junifer/external/h5io/h5io/chunked_list.py +0 -65
  288. junifer/markers/complexity/__init__.pyi +0 -17
  289. junifer-0.0.7.dev332.dist-info/RECORD +0 -353
  290. {junifer-0.0.7.dev332.dist-info → junifer-0.0.8.dist-info}/entry_points.txt +0 -0
  291. {junifer-0.0.7.dev332.dist-info → junifer-0.0.8.dist-info}/licenses/AUTHORS.rst +0 -0
  292. {junifer-0.0.7.dev332.dist-info → junifer-0.0.8.dist-info}/licenses/LICENSE.md +0 -0
  293. {junifer-0.0.7.dev332.dist-info → junifer-0.0.8.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,53 @@
1
+ name: build
2
+ concurrency:
3
+ group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
4
+ cancel-in-progress: true
5
+ on:
6
+ pull_request:
7
+ push:
8
+ branches: [main]
9
+ workflow_dispatch:
10
+
11
+ jobs:
12
+ build:
13
+ timeout-minutes: 10
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ os: [ubuntu, macos, windows]
18
+ python-version: [3.8, 3.9, "3.10", "3.11"]
19
+ name: ${{ matrix.os }} - py${{ matrix.python-version }}
20
+ runs-on: ${{ matrix.os }}-latest
21
+ defaults:
22
+ run:
23
+ shell: bash
24
+ steps:
25
+ - name: Checkout repository
26
+ uses: actions/checkout@v4
27
+ - name: Setup Python ${{ matrix.python-version }}
28
+ uses: actions/setup-python@v5
29
+ with:
30
+ python-version: ${{ matrix.python-version }}
31
+ architecture: 'x64'
32
+ - name: Install dependencies
33
+ run: |
34
+ python -m pip install --progress-bar off --upgrade pip setuptools wheel
35
+ python -m pip install --progress-bar off .[build]
36
+ - name: Test package install
37
+ run: brainprint-sys_info
38
+ - name: Remove package install
39
+ run: python -m pip uninstall -yq brainprint
40
+ - name: Build package
41
+ run: python -m build
42
+ - name: Install sdist
43
+ run: pip install ./dist/*.tar.gz
44
+ - name: Test sdist install
45
+ run: brainprint-sys_info
46
+ - name: Remove sdist install
47
+ run: python -m pip uninstall -yq brainprint
48
+ - name: Install wheel
49
+ run: pip install ./dist/*.whl
50
+ - name: Test wheel install
51
+ run: brainprint-sys_info
52
+ - name: Remove wheel install
53
+ run: python -m pip uninstall -yq brainprint
@@ -0,0 +1,44 @@
1
+ name: code-style
2
+ concurrency:
3
+ group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
4
+ cancel-in-progress: true
5
+ on:
6
+ pull_request:
7
+ push:
8
+ branches: [main]
9
+ workflow_dispatch:
10
+
11
+ jobs:
12
+ style:
13
+ timeout-minutes: 10
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - name: Checkout repository
17
+ uses: actions/checkout@v4
18
+ - name: Setup Python 3.9
19
+ uses: actions/setup-python@v5
20
+ with:
21
+ python-version: '3.9'
22
+ architecture: 'x64'
23
+ - name: Install dependencies
24
+ run: |
25
+ python -m pip install --progress-bar off --upgrade pip setuptools wheel
26
+ python -m pip install --progress-bar off .[style]
27
+ - name: Run Ruff
28
+ run: ruff check .
29
+ - name: Run isort
30
+ uses: isort/isort-action@master
31
+ - name: Run black
32
+ uses: psf/black@stable
33
+ with:
34
+ options: "--check --verbose"
35
+ version: "23.10.1"
36
+ - name: Run codespell
37
+ uses: codespell-project/actions-codespell@master
38
+ with:
39
+ check_filenames: true
40
+ check_hidden: true
41
+ skip: './.git,./build,./.mypy_cache,./.pytest_cache'
42
+ ignore_words_file: ./.codespellignore
43
+ # - name: Run pydocstyle
44
+ # run: pydocstyle .
@@ -0,0 +1,65 @@
1
+ name: doc
2
+ concurrency:
3
+ group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
4
+ cancel-in-progress: true
5
+ on:
6
+ pull_request:
7
+ push:
8
+ branches: [main]
9
+ workflow_dispatch:
10
+
11
+ jobs:
12
+ build:
13
+ timeout-minutes: 10
14
+ runs-on: ubuntu-latest
15
+ defaults:
16
+ run:
17
+ shell: bash
18
+ steps:
19
+ - name: Checkout repository
20
+ uses: actions/checkout@v4
21
+ with:
22
+ path: ./main
23
+ - name: Setup Python 3.9
24
+ uses: actions/setup-python@v5
25
+ with:
26
+ python-version: 3.9
27
+ architecture: 'x64'
28
+ - name: Install package
29
+ run: |
30
+ python -m pip install --progress-bar off --upgrade pip setuptools wheel
31
+ python -m pip install --progress-bar off main/.[doc]
32
+ - name: Display system information
33
+ run: brainprint-sys_info --developer
34
+ - name: Build doc
35
+ run: sphinx-build ./main/doc ./doc-build/dev -W --keep-going
36
+ - name: Upload documentation
37
+ uses: actions/upload-artifact@v4
38
+ with:
39
+ name: doc-dev
40
+ path: ./doc-build/dev
41
+
42
+ deploy:
43
+ if: github.event_name == 'push'
44
+ needs: build
45
+ timeout-minutes: 10
46
+ runs-on: ubuntu-latest
47
+ permissions:
48
+ contents: write
49
+ defaults:
50
+ run:
51
+ shell: bash
52
+ steps:
53
+ - name: Download documentation
54
+ uses: actions/download-artifact@v4
55
+ with:
56
+ name: doc-dev
57
+ path: ./doc-dev
58
+ - name: Deploy dev documentation
59
+ uses: peaceiris/actions-gh-pages@v4
60
+ with:
61
+ github_token: ${{ secrets.GITHUB_TOKEN }}
62
+ publish_dir: ./doc-dev
63
+ destination_dir: ./dev
64
+ user_name: 'github-actions[bot]'
65
+ user_email: 'github-actions[bot]@users.noreply.github.com'
@@ -0,0 +1,31 @@
1
+ name: publish
2
+ on:
3
+ workflow_dispatch:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ pypi:
9
+ timeout-minutes: 10
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Checkout repository
13
+ uses: actions/checkout@v4
14
+ - name: Setup Python 3.9
15
+ uses: actions/setup-python@v5
16
+ with:
17
+ python-version: '3.9'
18
+ architecture: 'x64'
19
+ - name: Install dependencies
20
+ run: |
21
+ python -m pip install --progress-bar off --upgrade pip setuptools wheel
22
+ python -m pip install --progress-bar off .[build]
23
+ - name: Display system information
24
+ run: brainprint-sys_info --developer
25
+ - name: Build and publish
26
+ env:
27
+ TWINE_USERNAME: __token__
28
+ TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
29
+ run: |
30
+ python -m build
31
+ twine upload dist/*
@@ -0,0 +1,54 @@
1
+ name: pytest
2
+ concurrency:
3
+ group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
4
+ cancel-in-progress: true
5
+ on:
6
+ pull_request:
7
+ paths:
8
+ - '**.py'
9
+ push:
10
+ branches: [main]
11
+ paths:
12
+ - '**.py'
13
+ workflow_dispatch:
14
+
15
+ jobs:
16
+ pytest:
17
+ timeout-minutes: 30
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ os: [ubuntu, macos, windows]
22
+ python-version: [3.8, 3.9, "3.10", "3.11"]
23
+ name: ${{ matrix.os }} - py${{ matrix.python-version }}
24
+ runs-on: ${{ matrix.os }}-latest
25
+ defaults:
26
+ run:
27
+ shell: bash
28
+ steps:
29
+ - name: Checkout repository
30
+ uses: actions/checkout@v4
31
+ - name: Setup Python ${{ matrix.python-version }}
32
+ uses: actions/setup-python@v5
33
+ with:
34
+ python-version: ${{ matrix.python-version }}
35
+ architecture: 'x64'
36
+ - name: Install package
37
+ run: |
38
+ python -m pip install --progress-bar off --upgrade pip setuptools wheel
39
+ python -m pip install --progress-bar off .[test]
40
+ - name: Display system information
41
+ run: brainprint-sys_info --developer
42
+ - name: Run pytest
43
+ run: pytest brainprint --cov=brainprint --cov-report=xml --cov-config=pyproject.toml
44
+ - name: Upload to codecov
45
+ if: ${{ matrix.os == 'ubuntu' && matrix.python-version == 3.9 }}
46
+ uses: codecov/codecov-action@v4
47
+ with:
48
+ files: ./coverage.xml
49
+ flags: unittests # optional
50
+ name: codecov-umbrella # optional
51
+ fail_ci_if_error: true # optional (default = false)
52
+ verbose: true # optional (default = false)
53
+ token: ${{ secrets.CODECOV_TOKEN }}
54
+ slug: deep-mi/BrainPrint
@@ -0,0 +1,123 @@
1
+ # macOS
2
+ .DS_Store
3
+
4
+ # Byte-compiled / optimized / DLL files
5
+ __pycache__/
6
+ *.py[cod]
7
+ *$py.class
8
+
9
+ # C extensions
10
+ *.so
11
+
12
+ # Distribution / packaging
13
+ .Python
14
+ build/
15
+ develop-eggs/
16
+ dist/
17
+ downloads/
18
+ eggs/
19
+ .eggs/
20
+ lib/
21
+ lib64/
22
+ parts/
23
+ sdist/
24
+ var/
25
+ wheels/
26
+ *.egg-info/
27
+ .installed.cfg
28
+ *.egg
29
+ MANIFEST
30
+
31
+ # PyInstaller
32
+ # Usually these files are written by a python script from a template
33
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
34
+ *.manifest
35
+ *.spec
36
+
37
+ # Installer logs
38
+ pip-log.txt
39
+ pip-delete-this-directory.txt
40
+
41
+ # Unit test / coverage reports
42
+ htmlcov/
43
+ .tox/
44
+ .nox/
45
+ .coverage
46
+ .coverage.*
47
+ .cache
48
+ nosetests.xml
49
+ coverage.xml
50
+ *.cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ junit-results.xml
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ doc/_build/
73
+ doc/generated/
74
+ doc/api/generated/
75
+
76
+ # PyBuilder
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ .python-version
88
+
89
+ # celery beat schedule file
90
+ celerybeat-schedule
91
+
92
+ # SageMath parsed files
93
+ *.sage.py
94
+
95
+ # Environments
96
+ .env
97
+ .venv
98
+ env/
99
+ venv/
100
+ ENV/
101
+ env.bak/
102
+ venv.bak/
103
+
104
+ # Spyder project settings
105
+ .spyderproject
106
+ .spyproject
107
+
108
+ # Rope project settings
109
+ .ropeproject
110
+
111
+ # mkdocs documentation
112
+ /site
113
+
114
+ # mypy
115
+ .mypy_cache/
116
+ .dmypy.json
117
+ dmypy.json
118
+
119
+ # Pyre type checker
120
+ .pyre/
121
+
122
+ # PyCharm
123
+ **/.idea/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Image Analysis, DZNE e.V.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,108 @@
1
+ [![PyPI version](https://badge.fury.io/py/brainprint.svg)](https://pypi.org/project/brainprint/)
2
+ # BrainPrint
3
+
4
+ This is the `brainprint` python package, a derivative of the original
5
+ [BrainPrint-legacy](https://github.com/Deep-MI/BrainPrint-legacy) scripts,
6
+ with the primary goal to provide a Python-only version, to integrate the
7
+ [LaPy](https://github.com/Deep-MI/LaPy) package, and to remove dependencies
8
+ on third-party software (shapeDNA-* binaries, gmsh, meshfix). As a result,
9
+ some functionality of the original BrainPrint-legacy scripts is no longer
10
+ maintained (currently no support of tetrahedral meshes and no support of
11
+ cortical parcellations or label files).
12
+
13
+ ## Installation
14
+
15
+ Use the following code to install the latest release of LaPy into your local
16
+ Python package directory:
17
+
18
+ `python3 -m pip install brainprint`
19
+
20
+ This will also install the necessary dependencies, e.g. the [LaPy](https://github.com/Deep-MI/LaPy)
21
+ package. You may need to add your local Python package directory to your $PATH
22
+ in order to run the scripts.
23
+
24
+ ## Usage
25
+ ### Command Line Interface (CLI)
26
+
27
+ Once installed, the package provides a `brainprint` executable which can be run from the command line.
28
+
29
+ The `brainprint` CLI enables per-subject computation of the individual brainprint descriptors. Its usage and options are summarized below;
30
+ detailed info is available by calling the script without any arguments from the command line.
31
+
32
+ ```sh
33
+ brainprint --sdir <directory> --sid <SubjectID> [--num <num>] [--evec] [--skipcortex] [--norm <surface|volume|geometry|none> ] [--reweight] [--asymmetry] [--outdir <directory>] [--help] [--more-help]
34
+
35
+ Options:
36
+ --help Show this help message and exit
37
+ --more-help Show extensive help message and exit
38
+
39
+ Required options:
40
+ --sid <SubjectID>
41
+ Subject ID (FreeSurfer-processed directory inside the
42
+ subjects directory)
43
+ --sdir <directory>
44
+ FreeSurfer subjects directory
45
+
46
+ Processing directives:
47
+ --num <num> Number of eigenvalues/vectors to compute (default: 50)
48
+ --evec Switch on eigenvector computation (default: off)
49
+ --skipcortex Skip cortical surfaces (default: off)
50
+ --norm <surface|volume|geometry|none>
51
+ Switch on eigenvalue normalization; will be either surface,
52
+ volume, or determined by the geometry of the object. Use
53
+ "none" or leave out entirely to skip normalization.
54
+ --reweight Switch on eigenvalue reweighting (default: off)
55
+ --asymmetry Perform left-right asymmetry calculation (default: off)
56
+ --cholmod Switch on use of (faster) Cholesky decomposition instead
57
+ of (slower) LU decomposition (default: off). May require
58
+ manual install of scikit-sparse package.
59
+
60
+ Output parameters:
61
+ --outdir=OUTDIR Output directory (default: <sdir>/<sid>/brainprint)
62
+ --keep-temp Whether to keep the temporary files directory or not
63
+ by default False
64
+ ```
65
+
66
+ ### Python Package
67
+
68
+ `brainprint` can also be run within a pure Python environment, i.e. installed and imported as a Python package. E.g.:
69
+
70
+ ```python
71
+ >>> from brainprint import Brainprint
72
+
73
+ >>> subjects_dir = "/path/to/freesurfer/subjects_dir/"
74
+ >>> subject_id = "42"
75
+
76
+ >>> bp = Brainprint(subjects_dir=subjects_dir, asymmetry=True, keep_eigenvectors=True)
77
+ >>> results = bp.run(subject_id=subject_id)
78
+ >>> results
79
+ {"eigenvalues": PosixPath("/path/to/freesurfer/subjects_dir/subject_id/brainprint/subject_id.brainprint.csv"), "eigenvectors": PosixPath("/path/to/freesurfer/subjects_dir/subject_id/brainprint/eigenvectors"), "distances": PosixPath("/path/to/freesurfer/subjects_dir/subject_id/brainprint/subject_id.brainprint.asymmetry.csv")}
80
+ ```
81
+
82
+ ## Output
83
+
84
+ The script will create an output directory that contains a CSV table with
85
+ values (in that order) for the area, volume, and first n eigenvalues per each
86
+ FreeSurfer structure. An additional output file will be created if the
87
+ asymmetry calculation is performed and/or for the eigenvectors (CLI `--evecs` flag or `keep_eigenvectors` on class initialization).
88
+
89
+ ## Changes
90
+
91
+ There are some changes in functionality in comparison to the original [BrainPrint](https://github.com/Deep-MI/BrainPrint-legacy)
92
+ scripts:
93
+
94
+ - currently no support for tetrahedral meshes
95
+ - currently no support for analyses of cortical parcellation or label files
96
+ - no more Python 2.x compatibility
97
+
98
+ ## API Documentation
99
+
100
+ The API Documentation can be found at https://deep-mi.org/BrainPrint .
101
+
102
+ ## References
103
+
104
+ If you use this software for a publication please cite:
105
+
106
+ [1] BrainPrint: a discriminative characterization of brain morphology. Wachinger C, Golland P, Kremen W, Fischl B, Reuter M. Neuroimage. 2015;109:232-48. http://dx.doi.org/10.1016/j.neuroimage.2015.01.032 http://www.ncbi.nlm.nih.gov/pubmed/25613439
107
+
108
+ [2] Laplace-Beltrami spectra as 'Shape-DNA' of surfaces and solids. Reuter M, Wolter F-E, Peinecke N Computer-Aided Design. 2006;38:342-366. http://dx.doi.org/10.1016/j.cad.2005.10.011
@@ -0,0 +1,11 @@
1
+ """
2
+ BrainPrint analysis CLI.
3
+ """
4
+ from ..brainprint import run_brainprint
5
+ from .parser import parse_options
6
+
7
+
8
+ def main():
9
+ options = parse_options()
10
+ if options is not None:
11
+ return run_brainprint(**options)
@@ -0,0 +1,169 @@
1
+ """
2
+ Help text strings for the :mod:`brainprint.cli` module.
3
+ """
4
+ CLI_DESCRIPTION: str = (
5
+ "This program conducts a brainprint analysis of FreeSurfer output."
6
+ )
7
+
8
+
9
+ SUBJECT_ID: str = (
10
+ "Subject ID (FreeSurfer processed directory inside the subjects directory)"
11
+ )
12
+ SUBJECTS_DIR: str = "FreeSurfer subjects directory"
13
+ OUTPUT_DIRECTORY: str = "Output directory (default: <sdir>/<sid>/brainprint)"
14
+ NUM: str = "Number of eigenvalues/vectors to compute (default: 50)"
15
+ EVEC: str = "Switch on eigenvector computation (default: off)"
16
+ SKIP_CORTEX: str = "Skip cortical surfaces (default: off)"
17
+ NORM: str = "Eigenvalues normalization method (default: none)"
18
+ REWEIGHT: str = "Switch on eigenvalue reweighting (default: off)"
19
+ ASYM: str = "Switch on additional asymmetry calculation (default: off)"
20
+ ASYM_DISTANCE: str = (
21
+ "Distance measurement to use for asymmetry calculation (default: euc)"
22
+ )
23
+ CHOLMOD: str = "Use cholesky decomposition (faster) instead of LU decomposition (slower). May require manual install of scikit-sparse library. Default is LU decomposition."
24
+ KEEP_TEMP: str = (
25
+ "Whether to keep the temporary files directory or not, by default False"
26
+ )
27
+ HELP: str = "Display this help message and exit"
28
+ MORE_HELP: str = "Display extensive help message and exit"
29
+
30
+ HELPTEXT: str = """
31
+ brainprint.py
32
+ Author: Martin Reuter, 2015
33
+
34
+ =======
35
+ SUMMARY
36
+ =======
37
+
38
+ Computes the BrainPrint for a FreeSurfer subject.
39
+
40
+ The BrainPrint consists of the shape descriptors (Shape-DNA) [1]
41
+ of a selection of both cortical and subcortical structures [2].
42
+
43
+ Here is a list of structures and FreeSurfer aseg label ids:
44
+
45
+ CorpusCallosum [251, 252, 253, 254, 255]
46
+ Cerebellum [7, 8, 16, 46, 47]
47
+ Ventricles [4, 5, 14, 24, 31, 43, 44, 63]
48
+ 3rd-Ventricle [14, 24]
49
+ 4th-Ventricle 15
50
+ Brain-Stem 16
51
+ Left-Striatum [11, 12, 26]
52
+ Left-Lateral-Ventricle [4, 5, 31]
53
+ Left-Cerebellum-White-Matter 7
54
+ Left-Cerebellum-Cortex 8
55
+ Left-Thalamus-Proper 10
56
+ Left-Caudate 11
57
+ Left-Putamen 12
58
+ Left-Pallidum 13
59
+ Left-Hippocampus 17
60
+ Left-Amygdala 18
61
+ Left-Accumbens-area 26
62
+ Left-VentralDC 28
63
+ Right-Striatum [50, 51, 58]
64
+ Right-Lateral-Ventricle [43, 44, 63]
65
+ Right-Cerebellum-White-Matter 46
66
+ Right-Cerebellum-Cortex 47
67
+ Right-Thalamus-Proper 49
68
+ Right-Caudate 50
69
+ Right-Putamen 51
70
+ Right-Pallidum 52
71
+ Right-Hippocampus 53
72
+ Right-Amygdala 54
73
+ Right-Accumbens-area 58
74
+ Right-VentralDC 60
75
+
76
+ And the following cortical structures:
77
+
78
+ lh-white-2d (left white matter surface triangles)
79
+ lh-pial-2d (left pial surface triangles)
80
+ rh-white-2d (same for right hemisphere ...)
81
+ rh-pial-2d
82
+
83
+ Processing of the cortical structures can be skipped (--skipcortex).
84
+
85
+ Implicit Inputs:
86
+ The mri/aseg.mgz and mri/norm.mgz should be available.
87
+ Also surf/?h.pial and surf/?h.white need to be
88
+ available unless --skipcortex is passed. norm.mgz is not
89
+ absolutely necessary but highly recommended to fix the labels
90
+ and obtain improved meshes.
91
+
92
+ Output:
93
+ The brainprint CSV table containing column headers for the
94
+ structures, a row of areas, a row of volumes and N rows of
95
+ the first N eigenvalues for each structure. An additional
96
+ output file will be created if the asymmetry calculation is
97
+ performed.
98
+
99
+ ==================
100
+ COMMAND-LINE USAGE
101
+ ==================
102
+
103
+ python3 brainprint.py --sdir <directory> --sid <SubjectID> [--num <num>]
104
+ [--evec] [--skipcortex] [--norm <surface|volume|geometry|none> ]
105
+ [--reweight] [--asymmetry] [--cholmod] [--outdir <directory>]
106
+ [--help] [--more-help]
107
+
108
+ Options:
109
+ --help Show this help message and exit
110
+ --more-help Show extensive help message and exit
111
+
112
+ Required options:
113
+ --sid <SubjectID>
114
+ Subject ID (FreeSurfer-processed directory inside the
115
+ subjects directory)
116
+ --sdir <directory>
117
+ FreeSurfer subjects directory
118
+
119
+ Processing directives:
120
+ --num <num> Number of eigenvalues/vectors to compute (default: 50)
121
+ --evec Switch on eigenvector computation (default: off)
122
+ --skipcortex Skip cortical surfaces (default: off)
123
+ --norm <surface|volume|geometry|none>
124
+ Switch on eigenvalue normalization; will be either surface,
125
+ volume, or determined by the geometry of the object. Use
126
+ "none" or leave out entirely to skip normalization.
127
+ --reweight Switch on eigenvalue reweighting (default: off)
128
+ --asymmetry Perform left-right asymmetry calculation (default: off)
129
+ --cholmod Use cholesky decomposition (faster) instead of LU
130
+ decomposition (slower). May require manual install of the
131
+ scikit-sparse library. Default is LU decomposition.
132
+
133
+ Output parameters:
134
+ --outdir=OUTDIR Output directory (default: <sdir>/<sid>/brainprint)
135
+
136
+ ============
137
+ PYTHON USAGE
138
+ ============
139
+
140
+ As an alternative to the command-line usage described above, individual
141
+ functions can also be called within a Python environment as follows:
142
+
143
+ import lapy
144
+ from brainprint import brainprint
145
+ brainprint.run_brainprint(subjects_dir="/my/subjects/directory", subject_id="my_subject_id")
146
+
147
+ Additional options are num=<int>, evec=<bool>, skipcortex=<bool>,
148
+ norm=<"surface"|"volume"|"geometry"|"none">, reweight=<bool>, and outdir=<string>.
149
+
150
+ ==========
151
+ REFERENCES
152
+ ==========
153
+
154
+ If used for a publication, please cite both [1] for the shape
155
+ descriptor method and [2] for the application to brain MRI and
156
+ definition of the BrainPrint.
157
+
158
+ [1] M. Reuter, F.-E. Wolter and N. Peinecke.
159
+ Laplace-Beltrami spectra as "Shape-DNA" of surfaces and solids.
160
+ Computer-Aided Design 38 (4), pp.342-366, 2006.
161
+ http://dx.doi.org/10.1016/j.cad.2005.10.011
162
+
163
+ [2] C. Wachinger, P. Golland, W. Kremen, B. Fischl, M. Reuter.
164
+ BrainPrint: A discriminative characterization of brain morphology.
165
+ NeuroImage Volume 109, pp.232-248, 2015.
166
+ http://dx.doi.org/10.1016/j.neuroimage.2015.01.032
167
+ """
168
+
169
+ # flake8: noqa: E501