simnibs-reader 0.1.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 (34) hide show
  1. simnibs_reader-0.1.0/LICENSE +21 -0
  2. simnibs_reader-0.1.0/PKG-INFO +85 -0
  3. simnibs_reader-0.1.0/README.md +40 -0
  4. simnibs_reader-0.1.0/pyproject.toml +42 -0
  5. simnibs_reader-0.1.0/setup.cfg +4 -0
  6. simnibs_reader-0.1.0/simnibs_reader/__init__.py +57 -0
  7. simnibs_reader-0.1.0/simnibs_reader/__later__/_0_anatomical_preparer.py +487 -0
  8. simnibs_reader-0.1.0/simnibs_reader/__later__/_field.py +26 -0
  9. simnibs_reader-0.1.0/simnibs_reader/__later__/_mesh.py +29 -0
  10. simnibs_reader-0.1.0/simnibs_reader/_typing.py +7 -0
  11. simnibs_reader-0.1.0/simnibs_reader/core/ToIntegrate_loaders-mask.py +79 -0
  12. simnibs_reader-0.1.0/simnibs_reader/core/__init__.py +7 -0
  13. simnibs_reader-0.1.0/simnibs_reader/core/_base.py +104 -0
  14. simnibs_reader-0.1.0/simnibs_reader/core/optimization.py +119 -0
  15. simnibs_reader-0.1.0/simnibs_reader/core/segmentation.py +153 -0
  16. simnibs_reader-0.1.0/simnibs_reader/core/simulation.py +155 -0
  17. simnibs_reader-0.1.0/simnibs_reader/efield/__init__.py +14 -0
  18. simnibs_reader-0.1.0/simnibs_reader/efield/accessor.py +96 -0
  19. simnibs_reader-0.1.0/simnibs_reader/efield/postprocess.py +76 -0
  20. simnibs_reader-0.1.0/simnibs_reader/efield/roi.py +432 -0
  21. simnibs_reader-0.1.0/simnibs_reader/efield/stats.py +93 -0
  22. simnibs_reader-0.1.0/simnibs_reader/io/__init__.py +6 -0
  23. simnibs_reader-0.1.0/simnibs_reader/io/export.py +88 -0
  24. simnibs_reader-0.1.0/simnibs_reader/io/nifti.py +140 -0
  25. simnibs_reader-0.1.0/simnibs_reader/tests/__init__.py +1 -0
  26. simnibs_reader-0.1.0/simnibs_reader/tests/conftest.py +6 -0
  27. simnibs_reader-0.1.0/simnibs_reader/tests/test_efield.py +3 -0
  28. simnibs_reader-0.1.0/simnibs_reader/tests/test_segmentation.py +3 -0
  29. simnibs_reader-0.1.0/simnibs_reader/tests/test_simulation.py +3 -0
  30. simnibs_reader-0.1.0/simnibs_reader.egg-info/PKG-INFO +85 -0
  31. simnibs_reader-0.1.0/simnibs_reader.egg-info/SOURCES.txt +32 -0
  32. simnibs_reader-0.1.0/simnibs_reader.egg-info/dependency_links.txt +1 -0
  33. simnibs_reader-0.1.0/simnibs_reader.egg-info/requires.txt +17 -0
  34. simnibs_reader-0.1.0/simnibs_reader.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hippolyte Dreyfus, ICM Frontlab CDPR
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,85 @@
1
+ Metadata-Version: 2.4
2
+ Name: simnibs-reader
3
+ Version: 0.1.0
4
+ Summary: Lightweight reader for SimNIBS output directories (segmentation, simulation, optimization)
5
+ License: MIT License
6
+
7
+ Copyright (c) 2026 Hippolyte Dreyfus, ICM Frontlab CDPR
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+
27
+ Requires-Python: >=3.10
28
+ Description-Content-Type: text/markdown
29
+ License-File: LICENSE
30
+ Requires-Dist: nibabel>=5.0
31
+ Requires-Dist: nilearn>=0.10
32
+ Requires-Dist: numpy>=1.24
33
+ Requires-Dist: pandas>=2.0
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=7.0; extra == "dev"
36
+ Requires-Dist: pytest-cov; extra == "dev"
37
+ Requires-Dist: ruff; extra == "dev"
38
+ Provides-Extra: docs
39
+ Requires-Dist: mkdocs-material; extra == "docs"
40
+ Requires-Dist: mkdocstrings[python]; extra == "docs"
41
+ Requires-Dist: mkdocs-jupyter; extra == "docs"
42
+ Provides-Extra: opti
43
+ Requires-Dist: h5py>=3.0; extra == "opti"
44
+ Dynamic: license-file
45
+
46
+ -doit récupérer toute la logique d'input contenu dans io_pipeline de simnibs-analyze pour la réinjecter ensuite sous forme d'une dépdance propre.
47
+
48
+
49
+ # simnibs-reader
50
+
51
+ Python API for easy access of simnibs results with 3 level of organization.
52
+
53
+
54
+ **Simnibs-bids-structure :**
55
+
56
+ A standardization of the name of the simnibs folders (with bids logic) for multi-simulation/optimiation experiments... check if this is a commun use or not ? because it could lead to overuseof "simulation" rather than "optimization" expe... So what could be the real usecase of this ?
57
+
58
+ (TO DECIDE : hierarchy of simnibs simulation parameters : electrodes_currents_conductivities (see Simnibs Data Structures)
59
+
60
+
61
+ **Description of the files accessible in a folder of simnibs results:**
62
+
63
+ *Folder type : simulation folder / optimization folder /m2m folder*
64
+
65
+ - les resultats E-nifti en particulier
66
+ - les surfaces ?
67
+ - dans m2m... les fichiers de preparation de simulations (pour pouvoir spécialisé la simulation)
68
+
69
+ **Description of the variables extractable , for each files :**
70
+
71
+ --> For each nifti file produced:
72
+
73
+ 1- ROI-based easy querying [IMPORTANT : Checker le tool qui permet de creer des ROIs aisement (en native comme en mni)]
74
+
75
+ 2- postprocessing filters (to check si ça doit rester dans analyze ou si c'est necessairement dans le reader !?)
76
+
77
+ 3- metrics extractions
78
+
79
+ - efield-niftii specific : mean
80
+ - label_preps specific : total amount of a specific label + width / length measure (check the nilearn tool for this)
81
+
82
+ --> other type of file ?
83
+
84
+
85
+ This querying tool allows both "a la volée python traitement" ou des save propres de metrics utile pour des analyses futures.
@@ -0,0 +1,40 @@
1
+ -doit récupérer toute la logique d'input contenu dans io_pipeline de simnibs-analyze pour la réinjecter ensuite sous forme d'une dépdance propre.
2
+
3
+
4
+ # simnibs-reader
5
+
6
+ Python API for easy access of simnibs results with 3 level of organization.
7
+
8
+
9
+ **Simnibs-bids-structure :**
10
+
11
+ A standardization of the name of the simnibs folders (with bids logic) for multi-simulation/optimiation experiments... check if this is a commun use or not ? because it could lead to overuseof "simulation" rather than "optimization" expe... So what could be the real usecase of this ?
12
+
13
+ (TO DECIDE : hierarchy of simnibs simulation parameters : electrodes_currents_conductivities (see Simnibs Data Structures)
14
+
15
+
16
+ **Description of the files accessible in a folder of simnibs results:**
17
+
18
+ *Folder type : simulation folder / optimization folder /m2m folder*
19
+
20
+ - les resultats E-nifti en particulier
21
+ - les surfaces ?
22
+ - dans m2m... les fichiers de preparation de simulations (pour pouvoir spécialisé la simulation)
23
+
24
+ **Description of the variables extractable , for each files :**
25
+
26
+ --> For each nifti file produced:
27
+
28
+ 1- ROI-based easy querying [IMPORTANT : Checker le tool qui permet de creer des ROIs aisement (en native comme en mni)]
29
+
30
+ 2- postprocessing filters (to check si ça doit rester dans analyze ou si c'est necessairement dans le reader !?)
31
+
32
+ 3- metrics extractions
33
+
34
+ - efield-niftii specific : mean
35
+ - label_preps specific : total amount of a specific label + width / length measure (check the nilearn tool for this)
36
+
37
+ --> other type of file ?
38
+
39
+
40
+ This querying tool allows both "a la volée python traitement" ou des save propres de metrics utile pour des analyses futures.
@@ -0,0 +1,42 @@
1
+ [build-system]
2
+ requires = ["setuptools>=42", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "simnibs-reader"
7
+ version = "0.1.0"
8
+ description = "Lightweight reader for SimNIBS output directories (segmentation, simulation, optimization)"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { file = "LICENSE" }
12
+
13
+ dependencies = [
14
+ "nibabel>=5.0",
15
+ "nilearn>=0.10",
16
+ "numpy>=1.24",
17
+ "pandas>=2.0",
18
+ ]
19
+
20
+ [project.optional-dependencies]
21
+ dev = [
22
+ "pytest>=7.0",
23
+ "pytest-cov",
24
+ "ruff",
25
+ ]
26
+ docs = [
27
+ "mkdocs-material",
28
+ "mkdocstrings[python]",
29
+ "mkdocs-jupyter",
30
+ ]
31
+
32
+ opti = [
33
+ "h5py>=3.0",
34
+ ]
35
+
36
+ [tool.setuptools.packages.find]
37
+ where = ["."]
38
+ include = ["simnibs_reader*"]
39
+
40
+ [tool.ruff]
41
+ line-length = 100
42
+ target-version = "py310"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,57 @@
1
+ """
2
+ simnibs-reader
3
+ ==============
4
+
5
+ Lightweight reader for SimNIBS output directories.
6
+
7
+ Quick start
8
+ -----------
9
+ >>> import simnibs_reader as snr
10
+ >>> sim = snr.simulation("path/to/simulation_folder")
11
+ >>> sim.magnE.data # lazy-loaded NIfTI array
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ from .core.simulation import SimulationResult
17
+ from .core.segmentation import SegmentationResult
18
+ from .core.optimization import OptimizationResult
19
+
20
+ __version__ = "0.1.0"
21
+
22
+
23
+ # ── Public factory functions ──────────────────────────────────────────────
24
+
25
+
26
+ def simulation(path: str) -> SimulationResult:
27
+ """Load a SimNIBS simulation output folder.
28
+
29
+ Parameters
30
+ ----------
31
+ path : str or Path
32
+ Path to the simulation directory (contains ``mni_volumes/``,
33
+ ``subject_volumes/``, ``fields_summary.txt``, etc.).
34
+ """
35
+ return SimulationResult(path)
36
+
37
+
38
+ def segmentation(path: str) -> SegmentationResult:
39
+ """Load a SimNIBS head-model folder (``m2m_<subID>``).
40
+
41
+ Parameters
42
+ ----------
43
+ path : str or Path
44
+ Path to the ``m2m_*`` directory produced by ``charm`` / ``headreco``.
45
+ """
46
+ return SegmentationResult(path)
47
+
48
+
49
+ def optimization(path: str) -> OptimizationResult:
50
+ """Load a SimNIBS optimization / leadfield folder.
51
+
52
+ Parameters
53
+ ----------
54
+ path : str or Path
55
+ Path to the optimization output directory.
56
+ """
57
+ return OptimizationResult(path)