brainfc 0.3.0__tar.gz

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 (134) hide show
  1. brainfc-0.3.0/.gitattributes +16 -0
  2. brainfc-0.3.0/.github/ISSUE_TEMPLATE/bug.yml +22 -0
  3. brainfc-0.3.0/.github/pull_request_template.md +7 -0
  4. brainfc-0.3.0/.github/workflows/ci.yml +65 -0
  5. brainfc-0.3.0/.github/workflows/publish.yml +51 -0
  6. brainfc-0.3.0/.gitignore +23 -0
  7. brainfc-0.3.0/CHANGELOG.md +34 -0
  8. brainfc-0.3.0/CITATION.cff +16 -0
  9. brainfc-0.3.0/CONTRIBUTING.md +38 -0
  10. brainfc-0.3.0/LICENSE +201 -0
  11. brainfc-0.3.0/NOTICE +19 -0
  12. brainfc-0.3.0/PKG-INFO +97 -0
  13. brainfc-0.3.0/PYPI.md +52 -0
  14. brainfc-0.3.0/README.en.md +124 -0
  15. brainfc-0.3.0/README.md +150 -0
  16. brainfc-0.3.0/SECURITY.md +9 -0
  17. brainfc-0.3.0/docs/api-inventory.json +434 -0
  18. brainfc-0.3.0/docs/api-reference.md +1230 -0
  19. brainfc-0.3.0/docs/assets/ARCHIFY-LICENSE +22 -0
  20. brainfc-0.3.0/docs/assets/README.md +24 -0
  21. brainfc-0.3.0/docs/assets/brainfc-hero.png +0 -0
  22. brainfc-0.3.0/docs/assets/eight-views.png +0 -0
  23. brainfc-0.3.0/docs/assets/hero-prompt.txt +2 -0
  24. brainfc-0.3.0/docs/assets/matrix.png +0 -0
  25. brainfc-0.3.0/docs/assets/processing.dataflow.json +230 -0
  26. brainfc-0.3.0/docs/assets/processing.html +14850 -0
  27. brainfc-0.3.0/docs/assets/processing.png +0 -0
  28. brainfc-0.3.0/docs/assets/processing.receipt.json +56 -0
  29. brainfc-0.3.0/docs/assets/processing.svg +536 -0
  30. brainfc-0.3.0/docs/assets/viewer.png +0 -0
  31. brainfc-0.3.0/docs/cli-reference.md +161 -0
  32. brainfc-0.3.0/docs/datasets.md +31 -0
  33. brainfc-0.3.0/docs/eight-views-v02.png +0 -0
  34. brainfc-0.3.0/docs/formats.md +59 -0
  35. brainfc-0.3.0/docs/http-api.md +118 -0
  36. brainfc-0.3.0/docs/http-reference.md +2295 -0
  37. brainfc-0.3.0/docs/index.md +25 -0
  38. brainfc-0.3.0/docs/interface-preview.png +0 -0
  39. brainfc-0.3.0/docs/openapi.json +2185 -0
  40. brainfc-0.3.0/docs/outputs.md +97 -0
  41. brainfc-0.3.0/docs/presets-and-workflow.md +61 -0
  42. brainfc-0.3.0/docs/processing.md +75 -0
  43. brainfc-0.3.0/docs/python-api.md +190 -0
  44. brainfc-0.3.0/docs/quickstart.md +86 -0
  45. brainfc-0.3.0/docs/release.md +89 -0
  46. brainfc-0.3.0/docs/requirements-tested-windows-py312.txt +76 -0
  47. brainfc-0.3.0/docs/research.md +22 -0
  48. brainfc-0.3.0/docs/validation-v0.2.0.md +41 -0
  49. brainfc-0.3.0/docs/validation-v0.3.0.md +26 -0
  50. brainfc-0.3.0/docs/validation.md +65 -0
  51. brainfc-0.3.0/examples/batch_derivatives.py +50 -0
  52. brainfc-0.3.0/examples/config-preprocessed.json +10 -0
  53. brainfc-0.3.0/examples/download_adhd_sample.py +75 -0
  54. brainfc-0.3.0/examples/http_client.py +51 -0
  55. brainfc-0.3.0/examples/prepare_atlas_demo.py +50 -0
  56. brainfc-0.3.0/examples/quickstart.py +30 -0
  57. brainfc-0.3.0/examples/roi_timeseries.py +46 -0
  58. brainfc-0.3.0/examples/validate_real_adhd.py +80 -0
  59. brainfc-0.3.0/frontend/capture-demo.cjs +26 -0
  60. brainfc-0.3.0/frontend/capture-readme.cjs +53 -0
  61. brainfc-0.3.0/frontend/licenses.mjs +17 -0
  62. brainfc-0.3.0/frontend/package-lock.json +1978 -0
  63. brainfc-0.3.0/frontend/package.json +25 -0
  64. brainfc-0.3.0/frontend/src/EightViews.tsx +147 -0
  65. brainfc-0.3.0/frontend/src/Workflow.tsx +1287 -0
  66. brainfc-0.3.0/frontend/src/display.ts +35 -0
  67. brainfc-0.3.0/frontend/src/main.tsx +675 -0
  68. brainfc-0.3.0/frontend/src/style.css +1134 -0
  69. brainfc-0.3.0/frontend/src/vendor/BrainScene.tsx +1336 -0
  70. brainfc-0.3.0/frontend/src/vendor/types.ts +119 -0
  71. brainfc-0.3.0/frontend/src/vendor/viewerAppearance.ts +79 -0
  72. brainfc-0.3.0/frontend/src/vendor/viewerTypes.ts +166 -0
  73. brainfc-0.3.0/frontend/test-release.cjs +117 -0
  74. brainfc-0.3.0/frontend/test-revision.cjs +90 -0
  75. brainfc-0.3.0/frontend/test-ui.cjs +114 -0
  76. brainfc-0.3.0/frontend/test-workflow-branches.cjs +38 -0
  77. brainfc-0.3.0/frontend/tsconfig.json +14 -0
  78. brainfc-0.3.0/frontend/vite.config.ts +21 -0
  79. brainfc-0.3.0/pyproject.toml +57 -0
  80. brainfc-0.3.0/scripts/check_release.py +115 -0
  81. brainfc-0.3.0/scripts/generate_reference.py +219 -0
  82. brainfc-0.3.0/scripts/package_release.py +54 -0
  83. brainfc-0.3.0/scripts/smoke_wheel.py +104 -0
  84. brainfc-0.3.0/src/brainfc/__init__.py +20 -0
  85. brainfc-0.3.0/src/brainfc/__main__.py +3 -0
  86. brainfc-0.3.0/src/brainfc/_version.py +3 -0
  87. brainfc-0.3.0/src/brainfc/atlases.py +89 -0
  88. brainfc-0.3.0/src/brainfc/cli.py +184 -0
  89. brainfc-0.3.0/src/brainfc/demo.py +77 -0
  90. brainfc-0.3.0/src/brainfc/export.py +109 -0
  91. brainfc-0.3.0/src/brainfc/imaging.py +376 -0
  92. brainfc-0.3.0/src/brainfc/io.py +241 -0
  93. brainfc-0.3.0/src/brainfc/models.py +335 -0
  94. brainfc-0.3.0/src/brainfc/pipeline.py +383 -0
  95. brainfc-0.3.0/src/brainfc/plotting.py +173 -0
  96. brainfc-0.3.0/src/brainfc/preprocessing.py +179 -0
  97. brainfc-0.3.0/src/brainfc/presets.py +192 -0
  98. brainfc-0.3.0/src/brainfc/web/__init__.py +1 -0
  99. brainfc-0.3.0/src/brainfc/web/app.py +586 -0
  100. brainfc-0.3.0/src/brainfc/web/schemas.py +251 -0
  101. brainfc-0.3.0/src/brainfc/web/static/THIRD_PARTY_NOTICES.txt +97 -0
  102. brainfc-0.3.0/src/brainfc/web/static/app.css +1 -0
  103. brainfc-0.3.0/src/brainfc/web/static/app.js +4287 -0
  104. brainfc-0.3.0/src/brainfc/web/static/index.html +1 -0
  105. brainfc-0.3.0/src/brainfc/web/static/reference/api-inventory.json +434 -0
  106. brainfc-0.3.0/src/brainfc/web/static/reference/api-reference.html +980 -0
  107. brainfc-0.3.0/src/brainfc/web/static/reference/cli-reference.html +132 -0
  108. brainfc-0.3.0/src/brainfc/web/static/reference/datasets.html +55 -0
  109. brainfc-0.3.0/src/brainfc/web/static/reference/eight-views-v02.png +0 -0
  110. brainfc-0.3.0/src/brainfc/web/static/reference/formats.html +84 -0
  111. brainfc-0.3.0/src/brainfc/web/static/reference/http-api.html +210 -0
  112. brainfc-0.3.0/src/brainfc/web/static/reference/http-reference.html +2147 -0
  113. brainfc-0.3.0/src/brainfc/web/static/reference/index.html +60 -0
  114. brainfc-0.3.0/src/brainfc/web/static/reference/interface-preview.png +0 -0
  115. brainfc-0.3.0/src/brainfc/web/static/reference/openapi.json +2185 -0
  116. brainfc-0.3.0/src/brainfc/web/static/reference/outputs.html +219 -0
  117. brainfc-0.3.0/src/brainfc/web/static/reference/presets-and-workflow.html +133 -0
  118. brainfc-0.3.0/src/brainfc/web/static/reference/processing.html +89 -0
  119. brainfc-0.3.0/src/brainfc/web/static/reference/python-api.html +276 -0
  120. brainfc-0.3.0/src/brainfc/web/static/reference/quickstart.html +85 -0
  121. brainfc-0.3.0/src/brainfc/web/static/reference/release.html +84 -0
  122. brainfc-0.3.0/src/brainfc/web/static/reference/research.html +57 -0
  123. brainfc-0.3.0/src/brainfc/web/static/reference/validation-v0.2.0.html +33 -0
  124. brainfc-0.3.0/src/brainfc/web/static/reference/validation-v0.2.1.html +16 -0
  125. brainfc-0.3.0/src/brainfc/web/static/reference/validation-v0.3.0.html +18 -0
  126. brainfc-0.3.0/src/brainfc/web/static/reference/validation.html +42 -0
  127. brainfc-0.3.0/src/brainfc/workflow.py +240 -0
  128. brainfc-0.3.0/tests/test_formats.py +79 -0
  129. brainfc-0.3.0/tests/test_pipeline.py +193 -0
  130. brainfc-0.3.0/tests/test_release_api.py +126 -0
  131. brainfc-0.3.0/tests/test_surface.py +83 -0
  132. brainfc-0.3.0/tests/test_web.py +25 -0
  133. brainfc-0.3.0/tests/test_workflow.py +207 -0
  134. brainfc-0.3.0//345/220/257/345/212/250/347/225/214/351/235/242.cmd +8 -0
@@ -0,0 +1,16 @@
1
+ * text=auto
2
+ *.py text eol=lf
3
+ *.md text eol=lf
4
+ *.json text eol=lf
5
+ *.yml text eol=lf
6
+ *.yaml text eol=lf
7
+ *.ts text eol=lf
8
+ *.tsx text eol=lf
9
+ *.js text eol=lf
10
+ *.cjs text eol=lf
11
+ *.html text eol=lf
12
+ *.svg text eol=lf
13
+ *.txt text eol=lf
14
+ docs/assets/ARCHIFY-LICENSE text eol=lf
15
+ *.png binary
16
+ *.cmd text eol=crlf
@@ -0,0 +1,22 @@
1
+ name: Bug report
2
+ description: Report a reproducible problem without uploading participant data.
3
+ body:
4
+ - type: input
5
+ id: version
6
+ attributes:
7
+ label: Package version and Python / OS
8
+ validations:
9
+ required: true
10
+ - type: textarea
11
+ id: steps
12
+ attributes:
13
+ label: Minimal reproduction
14
+ description: Use synthetic data or a small non-sensitive example.
15
+ validations:
16
+ required: true
17
+ - type: textarea
18
+ id: behavior
19
+ attributes:
20
+ label: Expected behavior, actual behavior, and error
21
+ validations:
22
+ required: true
@@ -0,0 +1,7 @@
1
+ ## Change
2
+
3
+ Describe the problem and resulting behavior.
4
+
5
+ ## Validation
6
+
7
+ Report relevant numerical, API, documentation or browser checks. Note any changed defaults, ordering, units or provenance.
@@ -0,0 +1,65 @@
1
+ name: CI
2
+ on:
3
+ push:
4
+ pull_request:
5
+ workflow_call:
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ python:
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ os: [ubuntu-latest, windows-latest]
16
+ python: ['3.11', '3.12']
17
+ runs-on: ${{ matrix.os }}
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python }}
23
+ - run: python -m pip install ".[dev]"
24
+ - run: python -m pytest -q
25
+ - run: python -m ruff check src tests examples scripts
26
+
27
+ distribution:
28
+ runs-on: ubuntu-latest
29
+ steps:
30
+ - uses: actions/checkout@v4
31
+ - uses: actions/setup-python@v5
32
+ with:
33
+ python-version: '3.12'
34
+ - uses: actions/setup-node@v4
35
+ with:
36
+ node-version: '22'
37
+ cache: npm
38
+ cache-dependency-path: frontend/package-lock.json
39
+ - run: python -m pip install -e ".[dev]"
40
+ - run: npm ci
41
+ working-directory: frontend
42
+ - run: npm run check && npm run build
43
+ working-directory: frontend
44
+ - run: python scripts/generate_reference.py --check
45
+ - run: python scripts/check_release.py
46
+ - run: python -m build
47
+ - run: python -m twine check dist/*.whl dist/*.tar.gz
48
+ - run: python scripts/check_release.py --dist dist
49
+ - run: python scripts/smoke_wheel.py --wheel-dir dist
50
+ - run: npx playwright install --with-deps chromium
51
+ working-directory: frontend
52
+ - run: npm run test:ui
53
+ working-directory: frontend
54
+ - uses: actions/upload-artifact@v4
55
+ with:
56
+ name: python-distributions
57
+ path: |
58
+ dist/*.whl
59
+ dist/*.tar.gz
60
+ - uses: actions/upload-artifact@v4
61
+ if: failure()
62
+ with:
63
+ name: browser-evidence
64
+ path: .work/release-browser
65
+
@@ -0,0 +1,51 @@
1
+ name: Publish Python distributions
2
+ on:
3
+ workflow_dispatch:
4
+ inputs:
5
+ target:
6
+ description: Package index (run from the exact version tag)
7
+ required: true
8
+ default: testpypi
9
+ type: choice
10
+ options: [testpypi, pypi]
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ verify:
17
+ uses: ./.github/workflows/ci.yml
18
+ publish:
19
+ needs: verify
20
+ runs-on: ubuntu-latest
21
+ environment:
22
+ name: ${{ inputs.target }}
23
+ permissions:
24
+ contents: read
25
+ id-token: write
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+ - uses: actions/setup-python@v5
29
+ with:
30
+ python-version: '3.12'
31
+ - name: Require the exact version tag
32
+ env:
33
+ RELEASE_REF: ${{ github.ref }}
34
+ run: |
35
+ python - <<'PY'
36
+ import os, runpy
37
+ version = runpy.run_path('src/brainfc/_version.py')['__version__']
38
+ assert os.environ['RELEASE_REF'] == f'refs/tags/v{version}', 'Run this workflow from the exact vVERSION tag.'
39
+ PY
40
+ - uses: actions/download-artifact@v4
41
+ with:
42
+ name: python-distributions
43
+ path: dist
44
+ - name: Publish to TestPyPI
45
+ if: inputs.target == 'testpypi'
46
+ uses: pypa/gh-action-pypi-publish@release/v1
47
+ with:
48
+ repository-url: https://test.pypi.org/legacy/
49
+ - name: Publish to PyPI
50
+ if: inputs.target == 'pypi'
51
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,23 @@
1
+ .venv/
2
+ .work/
3
+ outputs/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ __pycache__/
8
+ .pytest_cache/
9
+ .ruff_cache/
10
+ frontend/node_modules/
11
+ *.log
12
+ .venv*/
13
+ .env
14
+ .env.*
15
+ .pypirc
16
+ license.txt
17
+ *.nii
18
+ *.nii.gz
19
+ *.dcm
20
+ *.npy
21
+ *.npz
22
+ *.mat
23
+ *.gii
@@ -0,0 +1,34 @@
1
+ # 更新记录
2
+
3
+ ## 0.3.0 — 2026-09-12
4
+
5
+ - 正式采用分发名 `brainfc`、Python 导入名 `brainfc`、命令行 `brainfc`。
6
+ - 默认安装包含科学计算和本地网页,无需额外选择 `[web]`。
7
+ - 原有函数、处理顺序与结果契约保持不变;完整 API 和示例同步新名称。
8
+ - 源码单独存放于新的 `brainfc` 目录,旧发行包及结果保留。
9
+ - 本地构建验证,尚未上传 PyPI。
10
+
11
+ ## 0.2.1 — 2026-09-12
12
+
13
+ 原名 fMRI Connect 的本地开源发布准备版本。
14
+
15
+ - 补全 Python 处理函数、Config 参数、Connectome 方法的源码 docstring 与自动生成参考。
16
+ - 增加中文使用指南、格式/方法/输出契约、命令行全参数、本地 HTTP 指南、离线手册和可运行示例。
17
+ - HTTP 请求增加明确的字段模型,缺失/未知字段返回 422;OpenAPI 提供实际参数定义。
18
+ - 补齐 `fisher_z.npy`、`timeseries.npy`、`manifest.json` 的直接下载入口。
19
+ - 包版本、命令行、HTTP 和结果 provenance 使用同一版本来源,修复旧版本硬编码。
20
+ - 修复预检查对 MGZ 头信息的 NIfTI 假设,并允许沿用文件名已明确的空间;未知预检查阶段会报错。
21
+ - 准备独立源码发布包、许可证/第三方说明、贡献说明、引用信息与 GitHub CI/手动 PyPI 发布流程。
22
+
23
+ 数值估计与去噪算法未作更改。现有完整输出目录保留原来的数据和来源记录。
24
+
25
+ ## 0.2.0 — 2026-09-12
26
+
27
+ - 三步引导、自动读取元数据/配套文件、来源明确的 ABIDE/ADNI/ADHD-200/MDD/PPMI 方案提示。
28
+ - 平滑脑壳、前方 ROI 悬停名称和与 3D 同步的八视图筛选。
29
+ - 44 项 Python 测试和本地浏览器交互验证;原始 fMRIPrep 全流程未实跑。
30
+
31
+ ## 0.1.0 — 2026-09-12
32
+
33
+ - 单 run 体积/CIFTI/GIFTI/表格读取、ROI 均值、混杂回归、删帧、Pearson/Spearman/偏相关与 Fisher-z。
34
+ - Python API、CLI、本地网页、矩阵/八视图/离线报告、来源指纹与外部预处理适配器。
@@ -0,0 +1,16 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use this software, cite this software version and the original methods and atlases used in your analysis."
3
+ type: software
4
+ title: "BrainFC"
5
+ repository-code: "https://github.com/hanxiangmin/brainfc"
6
+ abstract: "Local single-run fMRI to ROI time series and signed functional connectivity, with a Python API, command line, and local graphical interface."
7
+ authors:
8
+ - name: "BrainFC contributors"
9
+ version: 0.3.0
10
+ date-released: 2026-09-12
11
+ license: Apache-2.0
12
+ keywords:
13
+ - fMRI
14
+ - functional connectivity
15
+ - neuroimaging
16
+ - connectome
@@ -0,0 +1,38 @@
1
+ # 贡献与开发
2
+
3
+ 本目录可作为独立仓库根目录,不依赖父级 Hyper-Brain 源码。普通用户不需要开发工具。
4
+
5
+ ## 环境
6
+
7
+ ```shell
8
+ python -m venv .venv
9
+ # 激活虚拟环境后:
10
+ python -m pip install -e ".[dev]"
11
+ cd frontend
12
+ npm ci
13
+ cd ..
14
+ ```
15
+
16
+ ## 提交前验证
17
+
18
+ ```shell
19
+ python -m ruff check src tests examples scripts
20
+ python -m pytest -q
21
+ python scripts/generate_reference.py
22
+ python scripts/check_release.py
23
+ python scripts/generate_reference.py --check
24
+ python -m build
25
+ python -m twine check dist/*.whl dist/*.tar.gz
26
+ ```
27
+
28
+ 前端改动运行 `npm run check`、`npm run build`;构建后的 JS/CSS 与第三方许可证随包分发,需要一起更新。`npm run test:ui` 会启动临时本地服务并使用 Playwright,首次需要 `npx playwright install chromium`,也可通过 `FMRI_TEST_CHROMIUM` 指定已有浏览器。
29
+
30
+ 函数 docstring 采用 NumPy 风格;更改函数/默认值后重新生成参考和 OpenAPI。`Config` 是科学参数的唯一默认来源。版本改 `src/brainfc/_version.py`,并同步 frontend/package.json 与 package-lock.json;Vite 从该文件读显示版本。
31
+
32
+ ## 数值与数据约定
33
+
34
+ 新增方法要检查 ROI 排序、signed 权重、原始帧索引、空间/单位、混杂处理及输入不覆盖。使用合成数据构造可验证的期望值;真实数据验证写明取得范围、预处理版本和图谱来源。
35
+
36
+ 不提交原始影像、个人数据、下载缓存、许可证文件、账号令牌或结果目录。用于说明的截图必须说明是合成信号还是实际数据。已有发布结果应保留,新的实验输出到新目录。
37
+
38
+ 报告缺陷时提供版本、文件类型、脱敏后的最小示例、期望行为和实际错误。不要在公开 issue 上传受限影像或包含本地个人信息的完整 provenance。
brainfc-0.3.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
brainfc-0.3.0/NOTICE ADDED
@@ -0,0 +1,19 @@
1
+ BrainFC
2
+ Copyright 2026 BrainFC contributors
3
+
4
+ The 3D viewer in frontend/src/vendor is derived from Hyper-Brain 0.3.0
5
+ https://github.com/hanxiangmin/Hyper-Brain (Apache License 2.0).
6
+ Adapted 2026-09-12. Changes include eight camera directions, coordinate bounds,
7
+ smoothed display surfaces, translucent materials, foreground hover labels,
8
+ and synchronized edge selection and eight-view export.
9
+ Analysis is independent of Hyper-Brain.
10
+ React and Three.js are distributed under their MIT licenses. Their complete
11
+ license texts are included with the bundled frontend in THIRD_PARTY_NOTICES.txt.
12
+ Atlas and participant datasets are not included in the distribution; their
13
+ licenses and citations are determined by the original providers.
14
+
15
+ The standalone diagram viewer in docs/assets/processing.html is generated with
16
+ archify skill 2.16 (MIT), https://github.com/tt-a1i/archify.
17
+ The accompanying license is in docs/assets/ARCHIFY-LICENSE.
18
+ The README hero is AI-generated conceptual product artwork; the separately
19
+ identified application previews use synthetic signals and are actual renders.
brainfc-0.3.0/PKG-INFO ADDED
@@ -0,0 +1,97 @@
1
+ Metadata-Version: 2.5
2
+ Name: brainfc
3
+ Version: 0.3.0
4
+ Summary: Local fMRI to functional connectivity: Python API, offline GUI and eight-view brain networks
5
+ Project-URL: Homepage, https://github.com/hanxiangmin/brainfc
6
+ Project-URL: Source, https://github.com/hanxiangmin/brainfc
7
+ Project-URL: Issues, https://github.com/hanxiangmin/brainfc/issues
8
+ Project-URL: Documentation, https://github.com/hanxiangmin/brainfc/tree/main/docs
9
+ Author: BrainFC contributors
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ License-File: src/brainfc/web/static/THIRD_PARTY_NOTICES.txt
14
+ Keywords: bids,connectome,fmri,functional-connectivity,neuroimaging
15
+ Classifier: Development Status :: 3 - Alpha
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
23
+ Requires-Python: >=3.11
24
+ Requires-Dist: fastapi>=0.115
25
+ Requires-Dist: matplotlib>=3.8
26
+ Requires-Dist: nibabel>=5.2
27
+ Requires-Dist: nilearn<0.15,>=0.14
28
+ Requires-Dist: numpy>=1.26
29
+ Requires-Dist: pandas>=2.1
30
+ Requires-Dist: python-multipart>=0.0.20
31
+ Requires-Dist: scikit-image>=0.23
32
+ Requires-Dist: scikit-learn>=1.4
33
+ Requires-Dist: scipy>=1.12
34
+ Requires-Dist: uvicorn>=0.30
35
+ Provides-Extra: dev
36
+ Requires-Dist: build>=1.2; extra == 'dev'
37
+ Requires-Dist: hatchling>=1.27; extra == 'dev'
38
+ Requires-Dist: httpx>=0.27; extra == 'dev'
39
+ Requires-Dist: markdown>=3.6; extra == 'dev'
40
+ Requires-Dist: pytest>=8; extra == 'dev'
41
+ Requires-Dist: pyyaml>=6; extra == 'dev'
42
+ Requires-Dist: ruff>=0.9; extra == 'dev'
43
+ Requires-Dist: twine>=6; extra == 'dev'
44
+ Description-Content-Type: text/markdown
45
+
46
+ ![BrainFC: functional connectivity, made visible](https://raw.githubusercontent.com/hanxiangmin/brainfc/main/docs/assets/brainfc-hero.png)
47
+
48
+ # BrainFC
49
+
50
+ **fMRI → ROI time series → functional connectivity → matrix, eight-view and interactive 3D reports.**
51
+
52
+ BrainFC is a Python library with a command-line interface and a local graphical interface. Both interfaces use the same processing core. The default installation includes the GUI and an offline API manual. Python 3.11 or newer is required; ordinary users do not need Node.js.
53
+
54
+ ## Install and launch
55
+
56
+ ```shell
57
+ pip install brainfc
58
+ brainfc serve
59
+ ```
60
+
61
+ The interface opens at `http://127.0.0.1:8766`. Choose the built-in demo to generate synthetic NIfTI inputs and a complete report without downloading participant data. The offline manual is available at `/reference/` and the HTTP API schema at `/docs`.
62
+
63
+ ## Python API
64
+
65
+ ```python
66
+ from brainfc import Config, extract_connectome
67
+
68
+ # A TSV with a header: rows are time points, columns are ROI signals.
69
+ result = extract_connectome(
70
+ "signals.tsv",
71
+ config=Config(detrend=False, standardize=False),
72
+ )
73
+ matrix = result.connectivity
74
+ result.save("results/run-001")
75
+ ```
76
+
77
+ The destination must be new. For volume images, supply an integer-label atlas in the same explicitly named space and confirm that spatial preprocessing is complete. Filtering, confound regression and censoring must match the provenance of the input signals; the example above does not add temporal denoising.
78
+
79
+ ## Capabilities
80
+
81
+ - Read supported NiBabel volume containers, CIFTI time series, paired GIFTI data/labels, and CSV/TSV/TXT/1D/NPY/NPZ/MAT tables (excluding MAT v7.3).
82
+ - Extract ROI means; apply confound regression, temporal cleaning and censoring while retaining original frame indices.
83
+ - Compute Pearson, Spearman or Ledoit-Wolf partial correlations, with a separate Fisher-z matrix.
84
+ - Export arrays, tables, quality records, input fingerprints, figures and an offline interactive report.
85
+ - Synchronize selected connections and display thresholds between the 3D viewer and eight anatomical views. Display filtering does not modify the complete signed matrix.
86
+
87
+ Raw DICOM/BIDS spatial preprocessing requires external dcm2niix/fMRIPrep. BrainFC provides command adapters; it does not implement that preprocessing itself. The complete external raw-data chain has not been validated in this release. This package does not provide disease diagnosis or cohort-level inference.
88
+
89
+ ## Documentation and source
90
+
91
+ - [Quickstart](https://github.com/hanxiangmin/brainfc/blob/main/docs/quickstart.md)
92
+ - [Complete Python API](https://github.com/hanxiangmin/brainfc/blob/main/docs/api-reference.md)
93
+ - [Python usage guide](https://github.com/hanxiangmin/brainfc/blob/main/docs/python-api.md)
94
+ - [Input formats and processing contract](https://github.com/hanxiangmin/brainfc/blob/main/docs/formats.md)
95
+ - [Source code and issues](https://github.com/hanxiangmin/brainfc)
96
+
97
+ Licensed under Apache-2.0. The 3D viewer is adapted from Hyper-Brain; BrainFC runs independently. Dataset and atlas licenses remain with their original providers.
brainfc-0.3.0/PYPI.md ADDED
@@ -0,0 +1,52 @@
1
+ ![BrainFC: functional connectivity, made visible](https://raw.githubusercontent.com/hanxiangmin/brainfc/main/docs/assets/brainfc-hero.png)
2
+
3
+ # BrainFC
4
+
5
+ **fMRI → ROI time series → functional connectivity → matrix, eight-view and interactive 3D reports.**
6
+
7
+ BrainFC is a Python library with a command-line interface and a local graphical interface. Both interfaces use the same processing core. The default installation includes the GUI and an offline API manual. Python 3.11 or newer is required; ordinary users do not need Node.js.
8
+
9
+ ## Install and launch
10
+
11
+ ```shell
12
+ pip install brainfc
13
+ brainfc serve
14
+ ```
15
+
16
+ The interface opens at `http://127.0.0.1:8766`. Choose the built-in demo to generate synthetic NIfTI inputs and a complete report without downloading participant data. The offline manual is available at `/reference/` and the HTTP API schema at `/docs`.
17
+
18
+ ## Python API
19
+
20
+ ```python
21
+ from brainfc import Config, extract_connectome
22
+
23
+ # A TSV with a header: rows are time points, columns are ROI signals.
24
+ result = extract_connectome(
25
+ "signals.tsv",
26
+ config=Config(detrend=False, standardize=False),
27
+ )
28
+ matrix = result.connectivity
29
+ result.save("results/run-001")
30
+ ```
31
+
32
+ The destination must be new. For volume images, supply an integer-label atlas in the same explicitly named space and confirm that spatial preprocessing is complete. Filtering, confound regression and censoring must match the provenance of the input signals; the example above does not add temporal denoising.
33
+
34
+ ## Capabilities
35
+
36
+ - Read supported NiBabel volume containers, CIFTI time series, paired GIFTI data/labels, and CSV/TSV/TXT/1D/NPY/NPZ/MAT tables (excluding MAT v7.3).
37
+ - Extract ROI means; apply confound regression, temporal cleaning and censoring while retaining original frame indices.
38
+ - Compute Pearson, Spearman or Ledoit-Wolf partial correlations, with a separate Fisher-z matrix.
39
+ - Export arrays, tables, quality records, input fingerprints, figures and an offline interactive report.
40
+ - Synchronize selected connections and display thresholds between the 3D viewer and eight anatomical views. Display filtering does not modify the complete signed matrix.
41
+
42
+ Raw DICOM/BIDS spatial preprocessing requires external dcm2niix/fMRIPrep. BrainFC provides command adapters; it does not implement that preprocessing itself. The complete external raw-data chain has not been validated in this release. This package does not provide disease diagnosis or cohort-level inference.
43
+
44
+ ## Documentation and source
45
+
46
+ - [Quickstart](https://github.com/hanxiangmin/brainfc/blob/main/docs/quickstart.md)
47
+ - [Complete Python API](https://github.com/hanxiangmin/brainfc/blob/main/docs/api-reference.md)
48
+ - [Python usage guide](https://github.com/hanxiangmin/brainfc/blob/main/docs/python-api.md)
49
+ - [Input formats and processing contract](https://github.com/hanxiangmin/brainfc/blob/main/docs/formats.md)
50
+ - [Source code and issues](https://github.com/hanxiangmin/brainfc)
51
+
52
+ Licensed under Apache-2.0. The 3D viewer is adapted from Hyper-Brain; BrainFC runs independently. Dataset and atlas licenses remain with their original providers.