Metadata-Version: 2.4
Name: simnibs-analyze
Version: 0.0.2
Summary: Modular pipeline for brain stimulation modelling (tDCS/TMS) with SimNIBS
License: MIT License
        
        Copyright (c) 2026 Hippolyte Dreyfus, ICM Frontlab CDPR
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: nibabel>=5.0
Requires-Dist: nilearn>=0.10
Requires-Dist: numpy>=1.24
Requires-Dist: pandas>=2.0
Requires-Dist: pydantic>=2.0
Requires-Dist: pyvista>=0.43
Requires-Dist: matplotlib>=3.7
Requires-Dist: pyyaml>=6.0
Requires-Dist: rich>=13.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Provides-Extra: citations
Requires-Dist: duecredit>=0.9; extra == "citations"
Dynamic: license-file

# simnibs-analyze

Post-processing and analysis pipeline for SimNIBS e-field outputs. Built to facilitate the analysis of simnibs simulations in the context of non-invasive brain stimulation studies (TMS/tDCS).

## What it does

Starting from SimNIBS outputs, the pipeline covers the full analysis workflow:

- **Target definition** — generate ROI masks in MNI and subject space from MNI coordinates or atlas parcels (sphere, atlas-based)
- **E-field preparation** — coregister, skull-strip, smooth, and mask NIfTI volumes; intra/extra-ROI decomposition
- **E-field analysis** — extract scalar features (mean, max, percentiles, focality ratio) per subject and condition
- **Single-subject optimisation assessment** — evaluate how well a given montage targets the intended ROI
- **Simulation robustness** — assess sensitivity of the e-field distribution to input variability
- **Stimulation method comparison** — contrast montages or stimulation parameters across conditions
- **Group-level analysis** — inter-subject summary statistics, condition comparisons, and effect-size reporting
- **Visualisation** — 2D slice overlays, 3D surface rendering, histograms, and group bar plots

## Installation

```bash
# TODO: publication sur PyPI
pip install simnibs-analyze
```

## **Prerequisite Data (Input structure from simnibs):**

You need to have already run:

- simnibs-simulation or/ andsimnibs-optimization folder
- simnibs-m2m folder

## Quick start:

- prepare a config file : use examples from (add link)
- then run:
  simnibs-analyze --config="pathToYourConfig.yaml"

## [Click here for a full documentation](https://icm-frontlab-cdpr.github.io/simnibs-analyze/)

| Ressource                                        | Description                                              |
| ------------------------------------------------ | -------------------------------------------------------- |
| [Documentation API](docs/api/simnibs_pipeline.html) | Classes et fonctions (généré par pdoc)                |
| [Référence config.yaml](docs/configuration.md)    | Toutes les clés du fichier de configuration             |
| [Structure des outputs](docs/output_structure.md)   | Fichiers générés dans simnibs_output/ et results_dir/ |

<!-- ## Citation

If you use this pipeline in your research, please cite it via the `CITATION.cff` file included in this repository.

The pipeline also depends on several open-source tools. Their references are printed automatically at the start of each run. For a machine-readable BibTeX summary, install [duecredit](https://github.com/duecredit/duecredit) (optional) and run:

```bash
pip install "simnibs-pipeline[citations]"  # installs duecredit
DUECREDIT_ENABLE=1 simnibs-analyze --config config.yaml
python -m duecredit summary --format bibtex
```

Key tools to cite: SimNIBS, ANTsPy, nilearn, nibabel, NumPy, pandas, matplotlib, PyVista. -->
