Metadata-Version: 2.5
Name: brainfc
Version: 0.4.1
Summary: Resting-state fMRI functional connectivity, connectome and brain network / hypergraph analysis with Python and a local GUI
Project-URL: Homepage, https://github.com/hanxiangmin/brainfc
Project-URL: Source, https://github.com/hanxiangmin/brainfc
Project-URL: Issues, https://github.com/hanxiangmin/brainfc/issues
Project-URL: Documentation, https://github.com/hanxiangmin/brainfc/tree/main/docs
Author: BrainFC contributors
License-Expression: Apache-2.0
License-File: LICENSE
License-File: NOTICE
License-File: src/brainfc/network/web/static/THIRD_PARTY_NOTICES.txt
License-File: src/brainfc/web/static/THIRD_PARTY_NOTICES.txt
Keywords: bids,brain-connectivity,brain-network,brain-visualization,cifti,connectivity-matrix,connectome,connectomics,fmri,functional-connectivity,hypergraph,hypergraph-analysis,network-analysis,neuroimaging,neuroscience,nifti,resting-state-fmri,roi-timeseries,rs-fmri,功能连接,功能连接矩阵,脑网络,超图分析,静息态fMRI
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Python: >=3.11
Requires-Dist: fastapi>=0.115
Requires-Dist: h5py>=3.10
Requires-Dist: matplotlib>=3.8
Requires-Dist: networkx>=3.2
Requires-Dist: nibabel>=5.2
Requires-Dist: nilearn<0.15,>=0.14
Requires-Dist: numpy>=1.26
Requires-Dist: pandas>=2.1
Requires-Dist: platformdirs>=4
Requires-Dist: python-multipart>=0.0.20
Requires-Dist: scikit-image>=0.23
Requires-Dist: scikit-learn>=1.4
Requires-Dist: scipy>=1.12
Requires-Dist: statsmodels>=0.14
Requires-Dist: uvicorn>=0.30
Requires-Dist: xgi>=0.9
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: hatchling>=1.27; extra == 'dev'
Requires-Dist: httpx>=0.27; extra == 'dev'
Requires-Dist: markdown>=3.6; extra == 'dev'
Requires-Dist: pydicom>=3; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: pyyaml>=6; extra == 'dev'
Requires-Dist: ruff>=0.9; extra == 'dev'
Requires-Dist: twine>=6; extra == 'dev'
Description-Content-Type: text/markdown

![BrainFC: functional connectivity, made visible](https://raw.githubusercontent.com/hanxiangmin/brainfc/main/docs/assets/brainfc-hero.png)

# BrainFC

**Resting-state fMRI (rs-fMRI) → functional connectivity → brain networks and hypergraphs.**

Neuroimaging, connectome visualization and network analysis in one Python package, with a local GUI and complete API. Requires Python 3.11+.

## Install and launch

```shell
pip install -U brainfc
brainfc serve
```

Choose **打开真实样例** to try the bundled rest01 example. No files or parameters to supply.

## Python API

```python
from brainfc import Config, extract_connectome

# A TSV with a header: rows are time points, columns are ROI signals.
result = extract_connectome(
    "signals.tsv",
    config=Config(detrend=False, standardize=False),
)
matrix = result.connectivity
result.save("results/run-001")
```

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.

## Capabilities

- 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).
- Extract ROI means; apply confound regression, temporal cleaning and censoring while retaining original frame indices.
- Compute Pearson, Spearman or Ledoit-Wolf partial correlations, with a separate Fisher-z matrix.
- Export arrays, tables, quality records, input fingerprints, figures and an offline interactive report.
- Synchronize selected connections and display thresholds between the 3D viewer and eight anatomical views. Display filtering does not modify the complete signed matrix.

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.

## Documentation and source

- [Quickstart](https://github.com/hanxiangmin/brainfc/blob/main/docs/quickstart.md)
- [Complete Python API](https://github.com/hanxiangmin/brainfc/blob/main/docs/api-reference.md)
- [Python usage guide](https://github.com/hanxiangmin/brainfc/blob/main/docs/python-api.md)
- [Input formats and processing contract](https://github.com/hanxiangmin/brainfc/blob/main/docs/formats.md)
- [Source code and issues](https://github.com/hanxiangmin/brainfc)

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.

## Network analysis

Choose **进入网络分析** after extraction to explore graphs, native hypergraphs and network metrics. The matrix and ROI mapping transfer automatically.

```python
from brainfc.network import AnalysisConfig

network = result.analyze_network(AnalysisConfig(k=5))
```

[Network guide](https://github.com/hanxiangmin/brainfc/blob/main/docs/network-analysis.md) · [Compatibility guide](https://github.com/hanxiangmin/brainfc/blob/main/docs/hyper-brain-migration.md)
