anatractpy 0.6.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 (68) hide show
  1. anatractpy-0.6.0/.dockerignore +22 -0
  2. anatractpy-0.6.0/CHANGELOG.md +7 -0
  3. anatractpy-0.6.0/CITATION.cff +18 -0
  4. anatractpy-0.6.0/Dockerfile +32 -0
  5. anatractpy-0.6.0/LICENSE.txt +11 -0
  6. anatractpy-0.6.0/MANIFEST.in +8 -0
  7. anatractpy-0.6.0/PKG-INFO +120 -0
  8. anatractpy-0.6.0/PUBLICATION.md +53 -0
  9. anatractpy-0.6.0/README.md +84 -0
  10. anatractpy-0.6.0/THIRD_PARTY.md +11 -0
  11. anatractpy-0.6.0/containers/Apptainer.def +10 -0
  12. anatractpy-0.6.0/containers/MNE.Apptainer.def +10 -0
  13. anatractpy-0.6.0/containers/MNE.Dockerfile +18 -0
  14. anatractpy-0.6.0/containers/clean-runtime.py +46 -0
  15. anatractpy-0.6.0/containers/image-lock.json +28 -0
  16. anatractpy-0.6.0/containers/install-wheel.sh +3 -0
  17. anatractpy-0.6.0/containers/offline/Apptainer.def +10 -0
  18. anatractpy-0.6.0/containers/offline/MNE.Apptainer.def +10 -0
  19. anatractpy-0.6.0/containers/offline/README.md +28 -0
  20. anatractpy-0.6.0/containers/offline/export_images.py +292 -0
  21. anatractpy-0.6.0/containers/offline/images.json +28 -0
  22. anatractpy-0.6.0/containers/prune-examples.py +34 -0
  23. anatractpy-0.6.0/containers/verify-runtime.sh +29 -0
  24. anatractpy-0.6.0/environments/container-core.txt +11 -0
  25. anatractpy-0.6.0/environments/mne.lock.txt +36 -0
  26. anatractpy-0.6.0/environments/native-core.txt +10 -0
  27. anatractpy-0.6.0/pyproject.toml +84 -0
  28. anatractpy-0.6.0/setup.cfg +4 -0
  29. anatractpy-0.6.0/setup.py +10 -0
  30. anatractpy-0.6.0/src/anatractpy/__init__.py +3 -0
  31. anatractpy-0.6.0/src/anatractpy/__main__.py +3 -0
  32. anatractpy-0.6.0/src/anatractpy/argument_help.py +128 -0
  33. anatractpy-0.6.0/src/anatractpy/cli.py +364 -0
  34. anatractpy-0.6.0/src/anatractpy/cohort_connectivity.py +1078 -0
  35. anatractpy-0.6.0/src/anatractpy/connectivity.py +646 -0
  36. anatractpy-0.6.0/src/anatractpy/consensus.py +275 -0
  37. anatractpy-0.6.0/src/anatractpy/contracts.py +569 -0
  38. anatractpy-0.6.0/src/anatractpy/density.py +263 -0
  39. anatractpy-0.6.0/src/anatractpy/io.py +89 -0
  40. anatractpy-0.6.0/src/anatractpy/microstructure.py +696 -0
  41. anatractpy-0.6.0/src/anatractpy/nuclei.py +180 -0
  42. anatractpy-0.6.0/src/anatractpy/nucleus_connectivity.py +380 -0
  43. anatractpy-0.6.0/src/anatractpy/population/__init__.py +1 -0
  44. anatractpy-0.6.0/src/anatractpy/population/bootstrap_common.py +75 -0
  45. anatractpy-0.6.0/src/anatractpy/population/bootstrap_fixed.py +190 -0
  46. anatractpy-0.6.0/src/anatractpy/population/bootstrap_reconstruction.py +245 -0
  47. anatractpy-0.6.0/src/anatractpy/population/cli.py +115 -0
  48. anatractpy-0.6.0/src/anatractpy/population/engine.py +352 -0
  49. anatractpy-0.6.0/src/anatractpy/population/figures.py +145 -0
  50. anatractpy-0.6.0/src/anatractpy/population/files.py +75 -0
  51. anatractpy-0.6.0/src/anatractpy/population/inventory.py +351 -0
  52. anatractpy-0.6.0/src/anatractpy/population/matcher.cpp +194 -0
  53. anatractpy-0.6.0/src/anatractpy/population/products.py +368 -0
  54. anatractpy-0.6.0/src/anatractpy/population/science.py +245 -0
  55. anatractpy-0.6.0/src/anatractpy/population/stages.py +250 -0
  56. anatractpy-0.6.0/src/anatractpy/qc.py +716 -0
  57. anatractpy-0.6.0/src/anatractpy/qc_report.py +555 -0
  58. anatractpy-0.6.0/src/anatractpy/records.py +64 -0
  59. anatractpy-0.6.0/src/anatractpy/spatial_qc.py +697 -0
  60. anatractpy-0.6.0/src/anatractpy/tractography.py +825 -0
  61. anatractpy-0.6.0/src/anatractpy/versions.py +24 -0
  62. anatractpy-0.6.0/src/anatractpy/visualization.py +524 -0
  63. anatractpy-0.6.0/src/anatractpy.egg-info/PKG-INFO +120 -0
  64. anatractpy-0.6.0/src/anatractpy.egg-info/SOURCES.txt +66 -0
  65. anatractpy-0.6.0/src/anatractpy.egg-info/dependency_links.txt +1 -0
  66. anatractpy-0.6.0/src/anatractpy.egg-info/entry_points.txt +43 -0
  67. anatractpy-0.6.0/src/anatractpy.egg-info/requires.txt +14 -0
  68. anatractpy-0.6.0/src/anatractpy.egg-info/top_level.txt +1 -0
@@ -0,0 +1,22 @@
1
+ **
2
+ !Dockerfile
3
+ !pyproject.toml
4
+ !setup.py
5
+ !README.md
6
+ !LICENSE.txt
7
+ !THIRD_PARTY.md
8
+ !MANIFEST.in
9
+ !src/
10
+ !src/anatractpy/
11
+ !src/anatractpy/*.py
12
+ !src/anatractpy/population/
13
+ !src/anatractpy/population/*.py
14
+ !src/anatractpy/population/matcher.cpp
15
+ !containers/
16
+ !containers/MNE.Dockerfile
17
+ !containers/install-wheel.sh
18
+ !containers/verify-runtime.sh
19
+ !environments/
20
+ !environments/container-core.txt
21
+ !containers/clean-runtime.py
22
+ !containers/prune-examples.py
@@ -0,0 +1,7 @@
1
+ # Release history
2
+
3
+ ## 0.6.0
4
+
5
+ First public-release candidate under the name AnaTractPy (Tractography Analysis in Python). The validated implementation previously distributed as NeuroLines-tools 2.1.0 now uses the Python namespace `anatractpy` and the CLI prefix `anatractpy_`. The workflow integration is NeuroLines 0.6.0. NeuroLines 0.5.0 identifies the historical V1 pipeline. That number has no independent AnaTractPy release.
6
+
7
+ The microstructural panel explicitly labels positive-density rows where all FA observations are missing. Missing trajectories retain their white category. The population matching kernel, distance definitions, FA thresholds and treatment of nonfinite values are inherited from the validated implementation.
@@ -0,0 +1,18 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use this software, please cite it using these metadata."
3
+ title: "AnaTractPy: Tractography Analysis in Python"
4
+ type: software
5
+ authors:
6
+ - family-names: "Penault"
7
+ given-names: "Marvin"
8
+ version: "0.6.0"
9
+ license: BSD-3-Clause
10
+ repository-code: "https://github.com/Marvinmate/AnaTractPy"
11
+ abstract: "Python/C++ library for diffusion MRI, streamline processing, tractography and structural brain connectivity analysis."
12
+ keywords:
13
+ - diffusion MRI
14
+ - tractography
15
+ - streamlines
16
+ - structural connectivity
17
+ - neuroimaging
18
+ - connectomics
@@ -0,0 +1,32 @@
1
+ ARG WHEEL_SOURCE=builder
2
+ FROM marvinp45/neurolines_scilus@sha256:d01a65dc58f0a5066d100f1f8fe82a0627543914ad7878cf449d404464b62398 AS builder
3
+ ENV SOURCE_DATE_EPOCH=1796169600 PYTHONDONTWRITEBYTECODE=1
4
+ WORKDIR /build
5
+ COPY pyproject.toml setup.py MANIFEST.in README.md LICENSE.txt THIRD_PARTY.md ./
6
+ COPY src ./src
7
+ RUN python3 setup.py --quiet bdist_wheel -d /wheels
8
+
9
+ FROM ${WHEEL_SOURCE} AS wheel_source
10
+
11
+ FROM marvinp45/neurolines_scilus@sha256:d01a65dc58f0a5066d100f1f8fe82a0627543914ad7878cf449d404464b62398 AS sanitized
12
+ COPY containers/clean-runtime.py /opt/clean-runtime.py
13
+ WORKDIR /
14
+ RUN touch /opt/neurolines-build-clean-rootfs && python3 -B /opt/clean-runtime.py && rm /opt/clean-runtime.py /opt/neurolines-build-clean-rootfs
15
+
16
+ COPY containers/prune-examples.py /opt/prune-examples.py
17
+ RUN touch /opt/neurolines-build-clean-rootfs && python3 -B /opt/prune-examples.py && rm /opt/prune-examples.py /opt/neurolines-build-clean-rootfs
18
+
19
+ FROM scratch
20
+ COPY --from=sanitized --exclude=human-data / /
21
+ ENV PATH=/scilpy/src/scilpy/cli:/opt/venvs/scilpy/bin:/root/.local/bin:/fsl/share/fsl/bin:/mrtrix3_install/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/ants/bin \
22
+ LD_LIBRARY_PATH=/usr/local/nvidia/lib:/usr/local/nvidia/lib64:/fsl:/fsl/bin \
23
+ FSLDIR=/fsl FSLOUTPUTTYPE=NIFTI_GZ ANTSPATH=/ants/bin/ \
24
+ NUMBA_CACHE_DIR=/tmp/numba-cache MPLCONFIGDIR=/tmp/matplotlib \
25
+ LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 MPLBACKEND=Agg
26
+ CMD ["/bin/bash"]
27
+ LABEL org.opencontainers.image.title="AnaTractPy" org.opencontainers.image.version="0.6.0" org.opencontainers.image.description="Scientific tractography commands and precompiled exact matching engine" org.neurolines.science-reference="772bcea0b767fbf665c6eea18ad43efcfe798b22"
28
+ COPY --from=wheel_source /wheels/*.whl /opt/anatractpy/wheels/
29
+ COPY environments/container-core.txt /opt/anatractpy/container-core.txt
30
+ COPY containers/install-wheel.sh containers/verify-runtime.sh /opt/anatractpy/
31
+ RUN sh /opt/anatractpy/install-wheel.sh && sh /opt/anatractpy/verify-runtime.sh
32
+ ENV OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 MPLBACKEND=Agg
@@ -0,0 +1,11 @@
1
+ Copyright (c) 2026 Marvin Penault.
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
+
7
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+
9
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
+
11
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,8 @@
1
+ include THIRD_PARTY.md LICENSE.txt Dockerfile .dockerignore
2
+ include src/anatractpy/population/matcher.cpp
3
+ recursive-include containers *.sh *.py *.def *.Dockerfile
4
+ recursive-include environments *.txt
5
+ prune tests
6
+ global-exclude *.pyc *.so *.dylib .DS_Store
7
+ include CHANGELOG.md CITATION.cff PUBLICATION.md containers/image-lock.json
8
+ recursive-include containers/offline *.json *.md
@@ -0,0 +1,120 @@
1
+ Metadata-Version: 2.4
2
+ Name: anatractpy
3
+ Version: 0.6.0
4
+ Summary: Tractography Analysis in Python. Python/C++ library for diffusion MRI, streamline processing, tractography and structural connectivity analysis.
5
+ Author: Marvin Penault
6
+ License-Expression: BSD-3-Clause
7
+ Project-URL: Homepage, https://github.com/Marvinmate/AnaTractPy
8
+ Project-URL: Repository, https://github.com/Marvinmate/AnaTractPy
9
+ Project-URL: Documentation, https://anatractpy.readthedocs.io/
10
+ Project-URL: Issues, https://github.com/Marvinmate/AnaTractPy/issues
11
+ Keywords: diffusion MRI,tractography,streamlines,connectivity
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: C++
16
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
17
+ Classifier: Operating System :: POSIX :: Linux
18
+ Classifier: Operating System :: MacOS :: MacOS X
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE.txt
22
+ License-File: THIRD_PARTY.md
23
+ Requires-Dist: numpy
24
+ Requires-Dist: scipy
25
+ Requires-Dist: pandas
26
+ Requires-Dist: nibabel
27
+ Requires-Dist: dipy
28
+ Requires-Dist: matplotlib
29
+ Requires-Dist: PyYAML
30
+ Requires-Dist: Pillow
31
+ Provides-Extra: render
32
+ Requires-Dist: mne-connectivity==0.9.0; extra == "render"
33
+ Provides-Extra: science
34
+ Requires-Dist: scilpy==2.3.0; extra == "science"
35
+ Dynamic: license-file
36
+
37
+ # AnaTractPy 0.6.0 — Tractography Analysis in Python
38
+
39
+ AnaTractPy (Tractography Analysis in Python) is a Python/C++ library for diffusion MRI, streamline processing, tractography and structural connectivity analysis. It runs independently of Nextflow. The reference scientific implementation is NeuroLines 772bcea. The package builds its C++ matcher once and loads the installed library through ctypes.
40
+
41
+ Install this candidate from the verified wheel or source archive. The public PyPI and TestPyPI project lookups for `anatractpy` returned HTTP 404 during preparation on 2026-12-03. A project-name lookup does not reserve the name. After the approved publication, install the tagged release with `python -m pip install anatractpy==0.6.0`. See [installation and publication](PUBLICATION.md).
42
+
43
+ ## Installing the source
44
+
45
+ Use a C++17 compiler and a CPython scientific environment. The validated native qualification used CPython 3.12.7 and the exact library versions in `environments/native-core.txt`. Install the pipeline’s native executable dependencies (including MRtrix3 and scilpy) on PATH when running outside the container.
46
+
47
+ ```sh
48
+ python3.12 -m venv .venv
49
+ . .venv/bin/activate
50
+ python -m pip install -r environments/native-core.txt
51
+ python -m pip install .
52
+ anatractpy_population_match --version
53
+ anatractpy_population_match --help
54
+ anatractpy_tool_versions anatractpy numpy nibabel
55
+ ```
56
+
57
+ The build uses setuptools and compiles `population/matcher.cpp` once. Its C ABI is loaded with ctypes. Published wheels must match the Python ABI and operating system. The source archive can be rebuilt on Linux x86-64 or macOS with a compatible toolchain. Numerical stability depends on the pinned environment and compilation flags.
58
+
59
+ ## Command-line interface
60
+
61
+ Each `anatractpy_*` process has `--help` and `--version`. Arguments accept explicit input/output paths. Commands that produce standardized filenames describe their output in help and write into their current working directory. Scientific commands consume the participant and session identifiers from their inputs. The package supports use from a shell, Python or Nextflow. Arguments and default policies remain available even when only the command-line metadata are being inspected.
62
+
63
+ ```sh
64
+ anatractpy_contracts_input --help
65
+ anatractpy_tractography_classify --help
66
+ anatractpy_connectivity_cohort_matrix --help
67
+ anatractpy_microstructure_subject --help
68
+ anatractpy_population_inventory --help
69
+ anatractpy_population_bootstrap_reconstruction --help
70
+ anatractpy_tool_versions numpy nibabel anatractpy
71
+ ```
72
+
73
+ The 15 population operations cover inventory, stage-specific inputs, participant preparation, master creation, the two geometric matching passes, stratified and geometric reductions, microstructure, two consensus products, bootstrap reference/fixed/reconstruction/summary, and rendering. The reconstruction command takes `--first` and `--count` so an external scheduler can allocate independent replicate ranges. Supply `--workers` only to operations with independent participant work. The container defaults to one OpenMP/BLAS thread and allows explicit allocation of process workers.
74
+
75
+ The whole-brain and regional tractography, hemispheric assignment, thalamic classification, cohort presence and DTI policies are maintained in their original domain modules. The package calls scilpy and MRtrix3 directly when they implement a step of the scientific contract. It uses the original double-ended matching criteria and tie breaking. A standard deviation or weighted mean must preserve the validated support, missing-value policy and population denominator.
76
+
77
+ The matching development checkout supplies the scientific test suite. From that checkout use `python -m unittest discover -s tests -v`. The distribution contains the installed scientific commands and build recipes.
78
+
79
+ ## Building the tools images
80
+
81
+ These commands build locally on Linux x86-64 or in an explicitly selected amd64 Docker VM. Apple Silicon executes this target under emulation. The science base digest preserves the shipped CLI binaries and versions. The MNE renderer uses the reference renderer environment for its NumPy/MNE combination. `environments/container-core.txt` records the runtime actually measured in the historical science image (Python 3.12.3, MRtrix3 3.0.7, scilpy 2.2.0). The native development environment used Python 3.12.7, MRtrix3 3.0.8 and scilpy 2.3.0. Compare numerical results and timings within the same environment.
82
+
83
+ ```sh
84
+ # Build the wheel from the checked-out sources.
85
+ docker build --platform linux/amd64 --network=none --provenance=false -t anatractpy:0.6.0 .
86
+ # Build using the exact manylinux wheel distributed with the release.
87
+ : "${WHEEL_CONTEXT:?Set the path of a new wheel context directory}"
88
+ : "${RELEASE_DIST:?Set the path of the verified release distributions}"
89
+ mkdir -p "$WHEEL_CONTEXT/wheels"
90
+ cp "$RELEASE_DIST/anatractpy-0.6.0-cp312-cp312-manylinux_2_24_x86_64.whl" "$WHEEL_CONTEXT/wheels/"
91
+ docker build --platform linux/amd64 --network=none --provenance=false \
92
+ --build-context qualifiedwheel="$WHEEL_CONTEXT" --build-arg WHEEL_SOURCE=qualifiedwheel -t anatractpy:0.6.0 .
93
+ docker build --platform linux/amd64 --network=none --provenance=false -t anatractpy_mne:0.6.0 -f containers/MNE.Dockerfile .
94
+ docker run --rm --platform linux/amd64 --network=none anatractpy:0.6.0 sh /opt/anatractpy/verify-runtime.sh
95
+ docker run --rm --platform linux/amd64 --network=none anatractpy_mne:0.6.0 anatractpy_visualization_connectograms --help
96
+ ```
97
+
98
+ For the release build, set `RELEASE_DIST` to the directory containing the checked wheel and `WHEEL_CONTEXT` to a new empty directory. Docker may need to fetch the two declared base images on the first build. The default build compiles the wheel in the image. The release build installs the verified manylinux wheel. The final runtime filesystem is reconstructed after dropping inherited neuroimaging examples, BIDS-like filenames and distribution caches. The Docker build context admits only the explicitly declared source files. Display maps, tracking data and participant selections are mounted only at execution.
99
+
100
+ ## Preparing Apptainer locally
101
+
102
+ Build the Docker images once and save their local artifacts. From this directory, on a Linux system with Apptainer:
103
+
104
+ ```sh
105
+ docker image save anatractpy:0.6.0 -o anatractpy-0.6.0-linux-amd64.tar
106
+ docker image save anatractpy_mne:0.6.0 -o anatractpy_mne-0.6.0-linux-amd64.tar
107
+ apptainer build anatractpy-0.6.0.sif containers/Apptainer.def
108
+ apptainer build anatractpy_mne-0.6.0.sif containers/MNE.Apptainer.def
109
+ apptainer test anatractpy-0.6.0.sif
110
+ apptainer test anatractpy_mne-0.6.0.sif
111
+ sha256sum anatractpy*.sif
112
+ ```
113
+
114
+ The SIF build uses the exported local OCI/Docker content. The NF pipeline can use those local SIF paths on a shared filesystem. Keep full images on the site’s shared container storage and place only paths in the site profile.
115
+
116
+ ## Scientific conditions
117
+
118
+ The population estimator resamples to 24 arc-length points, uses strictly MDF <4 mm and both endpoint distances ≤6 mm, and limits each participant to one contributing trajectory per anchor. It keeps deterministic ordering, the rounded arithmetic-mean master size, 50/75/90% support thresholds, 1,000 fixed-anchor bootstrap draws and 50 full reconstructions. FA tractograms reuse the coordinates and order of their corresponding stratified tractograms; TSF/TSV carry the metric information. Scalar zero and absence are distinct. Synthetic profiles permit numerical validation of interpolation and projection. Human FA qualification requires verified individual DTI inputs.
119
+
120
+ On the command line, every stage works in its own working directory and receives the necessary scientific artifacts explicitly. Geometry preparation, exact matching, DTI, consensus, bootstraps and figure production can therefore be qualified without a Nextflow installation. See [licenses and software providers](THIRD_PARTY.md).
@@ -0,0 +1,53 @@
1
+ # Local releases and publication
2
+
3
+ AnaTractPy (Tractography Analysis in Python) uses `anatractpy` for its distribution and import names. Public JSON endpoints returned HTTP 404 for this name on PyPI and TestPyPI on 2026-12-03. Install the local candidate by its verified filename until the owners approve a publication. Check both indexes again immediately before an upload.
4
+
5
+ ## Install a checked file
6
+
7
+ Verify the SHA-256 against the release manifest. Create a new virtual environment and install the file by path. For an offline environment, supply the wheelhouse with the pinned scientific dependencies. A source install also needs the specified setuptools and a C++ compiler.
8
+
9
+ ```sh
10
+ python3.12 -m venv ./env
11
+ ./env/bin/python -m pip install --no-index --find-links /path/to/dependencies /path/to/anatractpy-0.6.0-PLATFORM.whl
12
+ ./env/bin/python -I -c 'from importlib.metadata import version; import anatractpy; print(version("anatractpy"))'
13
+ ./env/bin/anatractpy_population_inventory --version
14
+ ```
15
+
16
+ Applications calling MRtrix3, scilpy or ANTs executables require the corresponding runtime, independent of the core Python install. Production versions and search paths appear in the repository README, frozen Dockerfiles and images. The optional `science` and `render` extras declare scilpy and MNE dependencies in Python packaging.
17
+
18
+ ## Rebuild and review
19
+
20
+ Build the source release with `python -m build --sdist` and verify packages using `python -m twine check --strict dist/*`. The wheel workflow uses cibuildwheel with CPython 3.12 on Linux x86-64 and macOS universal2. It runs scientific tests against the installed distribution and uploads artifacts for local review. A matching tag and the manually triggered container workflow support further qualification. Build the science image first, then the smaller renderer. The container runner label `anatractpy-container-build` identifies a trusted Linux x86-64 runner with Docker BuildKit and room for the expanded upstream stages. Only the repository's default branch can run that private job.
21
+
22
+ ## First publication
23
+
24
+ AnaTractPy is authored by Marvin Penault. Version 0.6.0 declares the BSD-3-Clause license and includes author and project URL metadata. The copyright holders must approve redistribution terms and confirm the public attribution, URLs and repository ownership. For a first release, create a pending trusted publisher on each selected index for the exact project name, owner, repository, workflow and protected environment. A pending publisher reserves no name. Confirm authorization for the first upload using the index-specific repository variable described in the workflow. [Creating a project through OIDC](https://docs.pypi.org/trusted-publishers/creating-a-project-through-oidc/)
25
+
26
+ Trusted Publishing uses GitHub's OIDC identity and protected environments named `testpypi` and `pypi`. Configure access to the reviewed repository, this exact `publish.yml` workflow, the tag and required human reviewers. Set the repository confirmation variable for each index only after the rights holder approves that destination and configures its trusted publisher. The manual job only accepts the matching reviewed tag and checks the confirmation for the selected index. Build/test CI has read-only repository permissions. Only the upload job receives the OIDC permission. Recheck candidate file hashes before release approval.
27
+
28
+ For isolated TestPyPI qualification after an approved first publication, download the exact candidate artifact from its verified project record, compare its hash, then install the file into a clean venv by path. Resolve dependencies from a reviewed wheelhouse. This avoids mixed-index name resolution.
29
+
30
+ [PyPA Trusted Publishers](https://docs.pypi.org/trusted-publishers/) · [PEP 440](https://peps.python.org/pep-0440/) · [cibuildwheel](https://cibuildwheel.pypa.io/)
31
+
32
+
33
+ ## Container registry release and Apptainer retrieval
34
+
35
+ After the owner has selected a registry namespace, granted redistribution rights for the full images and approved publication, authenticate to that registry using its supported credential helper. Use the approved prefix (for example a chosen GHCR organization or Docker Hub namespace), verify the two local digests against `containers/image-lock.json`, then execute:
36
+
37
+ ```sh
38
+ : "${REGISTRY_NAMESPACE:?Set the approved registry and namespace}"
39
+ for image in anatractpy anatractpy_mne; do
40
+ docker image tag "$image:0.6.0" "$REGISTRY_NAMESPACE/$image:0.6.0"
41
+ docker image push "$REGISTRY_NAMESPACE/$image:0.6.0"
42
+ docker buildx imagetools inspect "$REGISTRY_NAMESPACE/$image:0.6.0"
43
+ done
44
+ ```
45
+
46
+ Record each remote manifest digest after push. Use the verified remote manifest when a Linux workstation can access that registry:
47
+
48
+ ```sh
49
+ apptainer pull --arch amd64 anatractpy-0.6.0.sif "docker://$REGISTRY_NAMESPACE/anatractpy@$SCIENCE_MANIFEST"
50
+ apptainer pull --arch amd64 anatractpy_mne-0.6.0.sif "docker://$REGISTRY_NAMESPACE/anatractpy_mne@$MNE_MANIFEST"
51
+ ```
52
+
53
+ For an offline site, use the local tar recipes in `containers/offline`. A SIF has its own SHA-256. Record and verify it on the destination.
@@ -0,0 +1,84 @@
1
+ # AnaTractPy 0.6.0 — Tractography Analysis in Python
2
+
3
+ AnaTractPy (Tractography Analysis in Python) is a Python/C++ library for diffusion MRI, streamline processing, tractography and structural connectivity analysis. It runs independently of Nextflow. The reference scientific implementation is NeuroLines 772bcea. The package builds its C++ matcher once and loads the installed library through ctypes.
4
+
5
+ Install this candidate from the verified wheel or source archive. The public PyPI and TestPyPI project lookups for `anatractpy` returned HTTP 404 during preparation on 2026-12-03. A project-name lookup does not reserve the name. After the approved publication, install the tagged release with `python -m pip install anatractpy==0.6.0`. See [installation and publication](PUBLICATION.md).
6
+
7
+ ## Installing the source
8
+
9
+ Use a C++17 compiler and a CPython scientific environment. The validated native qualification used CPython 3.12.7 and the exact library versions in `environments/native-core.txt`. Install the pipeline’s native executable dependencies (including MRtrix3 and scilpy) on PATH when running outside the container.
10
+
11
+ ```sh
12
+ python3.12 -m venv .venv
13
+ . .venv/bin/activate
14
+ python -m pip install -r environments/native-core.txt
15
+ python -m pip install .
16
+ anatractpy_population_match --version
17
+ anatractpy_population_match --help
18
+ anatractpy_tool_versions anatractpy numpy nibabel
19
+ ```
20
+
21
+ The build uses setuptools and compiles `population/matcher.cpp` once. Its C ABI is loaded with ctypes. Published wheels must match the Python ABI and operating system. The source archive can be rebuilt on Linux x86-64 or macOS with a compatible toolchain. Numerical stability depends on the pinned environment and compilation flags.
22
+
23
+ ## Command-line interface
24
+
25
+ Each `anatractpy_*` process has `--help` and `--version`. Arguments accept explicit input/output paths. Commands that produce standardized filenames describe their output in help and write into their current working directory. Scientific commands consume the participant and session identifiers from their inputs. The package supports use from a shell, Python or Nextflow. Arguments and default policies remain available even when only the command-line metadata are being inspected.
26
+
27
+ ```sh
28
+ anatractpy_contracts_input --help
29
+ anatractpy_tractography_classify --help
30
+ anatractpy_connectivity_cohort_matrix --help
31
+ anatractpy_microstructure_subject --help
32
+ anatractpy_population_inventory --help
33
+ anatractpy_population_bootstrap_reconstruction --help
34
+ anatractpy_tool_versions numpy nibabel anatractpy
35
+ ```
36
+
37
+ The 15 population operations cover inventory, stage-specific inputs, participant preparation, master creation, the two geometric matching passes, stratified and geometric reductions, microstructure, two consensus products, bootstrap reference/fixed/reconstruction/summary, and rendering. The reconstruction command takes `--first` and `--count` so an external scheduler can allocate independent replicate ranges. Supply `--workers` only to operations with independent participant work. The container defaults to one OpenMP/BLAS thread and allows explicit allocation of process workers.
38
+
39
+ The whole-brain and regional tractography, hemispheric assignment, thalamic classification, cohort presence and DTI policies are maintained in their original domain modules. The package calls scilpy and MRtrix3 directly when they implement a step of the scientific contract. It uses the original double-ended matching criteria and tie breaking. A standard deviation or weighted mean must preserve the validated support, missing-value policy and population denominator.
40
+
41
+ The matching development checkout supplies the scientific test suite. From that checkout use `python -m unittest discover -s tests -v`. The distribution contains the installed scientific commands and build recipes.
42
+
43
+ ## Building the tools images
44
+
45
+ These commands build locally on Linux x86-64 or in an explicitly selected amd64 Docker VM. Apple Silicon executes this target under emulation. The science base digest preserves the shipped CLI binaries and versions. The MNE renderer uses the reference renderer environment for its NumPy/MNE combination. `environments/container-core.txt` records the runtime actually measured in the historical science image (Python 3.12.3, MRtrix3 3.0.7, scilpy 2.2.0). The native development environment used Python 3.12.7, MRtrix3 3.0.8 and scilpy 2.3.0. Compare numerical results and timings within the same environment.
46
+
47
+ ```sh
48
+ # Build the wheel from the checked-out sources.
49
+ docker build --platform linux/amd64 --network=none --provenance=false -t anatractpy:0.6.0 .
50
+ # Build using the exact manylinux wheel distributed with the release.
51
+ : "${WHEEL_CONTEXT:?Set the path of a new wheel context directory}"
52
+ : "${RELEASE_DIST:?Set the path of the verified release distributions}"
53
+ mkdir -p "$WHEEL_CONTEXT/wheels"
54
+ cp "$RELEASE_DIST/anatractpy-0.6.0-cp312-cp312-manylinux_2_24_x86_64.whl" "$WHEEL_CONTEXT/wheels/"
55
+ docker build --platform linux/amd64 --network=none --provenance=false \
56
+ --build-context qualifiedwheel="$WHEEL_CONTEXT" --build-arg WHEEL_SOURCE=qualifiedwheel -t anatractpy:0.6.0 .
57
+ docker build --platform linux/amd64 --network=none --provenance=false -t anatractpy_mne:0.6.0 -f containers/MNE.Dockerfile .
58
+ docker run --rm --platform linux/amd64 --network=none anatractpy:0.6.0 sh /opt/anatractpy/verify-runtime.sh
59
+ docker run --rm --platform linux/amd64 --network=none anatractpy_mne:0.6.0 anatractpy_visualization_connectograms --help
60
+ ```
61
+
62
+ For the release build, set `RELEASE_DIST` to the directory containing the checked wheel and `WHEEL_CONTEXT` to a new empty directory. Docker may need to fetch the two declared base images on the first build. The default build compiles the wheel in the image. The release build installs the verified manylinux wheel. The final runtime filesystem is reconstructed after dropping inherited neuroimaging examples, BIDS-like filenames and distribution caches. The Docker build context admits only the explicitly declared source files. Display maps, tracking data and participant selections are mounted only at execution.
63
+
64
+ ## Preparing Apptainer locally
65
+
66
+ Build the Docker images once and save their local artifacts. From this directory, on a Linux system with Apptainer:
67
+
68
+ ```sh
69
+ docker image save anatractpy:0.6.0 -o anatractpy-0.6.0-linux-amd64.tar
70
+ docker image save anatractpy_mne:0.6.0 -o anatractpy_mne-0.6.0-linux-amd64.tar
71
+ apptainer build anatractpy-0.6.0.sif containers/Apptainer.def
72
+ apptainer build anatractpy_mne-0.6.0.sif containers/MNE.Apptainer.def
73
+ apptainer test anatractpy-0.6.0.sif
74
+ apptainer test anatractpy_mne-0.6.0.sif
75
+ sha256sum anatractpy*.sif
76
+ ```
77
+
78
+ The SIF build uses the exported local OCI/Docker content. The NF pipeline can use those local SIF paths on a shared filesystem. Keep full images on the site’s shared container storage and place only paths in the site profile.
79
+
80
+ ## Scientific conditions
81
+
82
+ The population estimator resamples to 24 arc-length points, uses strictly MDF <4 mm and both endpoint distances ≤6 mm, and limits each participant to one contributing trajectory per anchor. It keeps deterministic ordering, the rounded arithmetic-mean master size, 50/75/90% support thresholds, 1,000 fixed-anchor bootstrap draws and 50 full reconstructions. FA tractograms reuse the coordinates and order of their corresponding stratified tractograms; TSF/TSV carry the metric information. Scalar zero and absence are distinct. Synthetic profiles permit numerical validation of interpolation and projection. Human FA qualification requires verified individual DTI inputs.
83
+
84
+ On the command line, every stage works in its own working directory and receives the necessary scientific artifacts explicitly. Geometry preparation, exact matching, DTI, consensus, bootstraps and figure production can therefore be qualified without a Nextflow installation. See [licenses and software providers](THIRD_PARTY.md).
@@ -0,0 +1,11 @@
1
+ # Third-party software and provenance
2
+
3
+ The Python modules and C++ matcher originate from NeuroLines 772bcea0b767fbf665c6eea18ad43efcfe798b22. The original AnaTractPy code is licensed under BSD-3-Clause. See LICENSE.txt. Third-party components retain their respective licenses.
4
+
5
+ | Component | Distribution |
6
+ | --- | --- |
7
+ | scilpy | Installed as a separate scientific tool. [Repository and MIT license](https://github.com/scilus/scilpy) |
8
+ | MRtrix3 | External commands for tractography, maps and TSF validation. [Source and licensing](https://github.com/MRtrix3/mrtrix3) |
9
+ | NumPy, SciPy, pandas, DIPY, NiBabel, Matplotlib, PyYAML, Pillow | Python distributions with their respective license metadata and published source. Versions are recorded under environments/. |
10
+ | MNE-Connectivity | Separate rendering environment. [Project and BSD license](https://github.com/mne-tools/mne-connectivity) |
11
+ | Linux runtime | The Dockerfiles pin the existing images by OCI digest. Inherited packages retain their original terms. No FreeSurfer license is required to build this package. |
@@ -0,0 +1,10 @@
1
+ Bootstrap: docker-archive
2
+ From: anatractpy-0.6.0-linux-amd64.tar
3
+
4
+ %labels
5
+ org.opencontainers.image.title AnaTractPy
6
+ org.opencontainers.image.version 0.6.0
7
+ org.neurolines.science-reference 772bcea0b767fbf665c6eea18ad43efcfe798b22
8
+
9
+ %test
10
+ sh /opt/anatractpy/verify-runtime.sh
@@ -0,0 +1,10 @@
1
+ Bootstrap: docker-archive
2
+ From: anatractpy_mne-0.6.0-linux-amd64.tar
3
+
4
+ %labels
5
+ org.opencontainers.image.title AnaTractPy MNE renderer
6
+ org.opencontainers.image.version 0.6.0
7
+
8
+ %test
9
+ anatractpy_visualization_connectograms --version
10
+ python -c 'from anatractpy.visualization import connectograms'
@@ -0,0 +1,18 @@
1
+ ARG TOOLS_IMAGE=anatractpy:0.6.0
2
+ FROM ${TOOLS_IMAGE} AS science
3
+ FROM marvin45700/neurolines-mne-connectograms@sha256:7aae37cc91b8881ab4129c3de5ba2ab7e283b8201f69bf815b0428a624b287bb AS sanitized
4
+ COPY containers/clean-runtime.py /tmp/clean-runtime.py
5
+ WORKDIR /
6
+ RUN touch /opt/neurolines-build-clean-rootfs && python -B /tmp/clean-runtime.py && rm /tmp/clean-runtime.py /opt/neurolines-build-clean-rootfs
7
+
8
+ COPY containers/prune-examples.py /opt/prune-examples.py
9
+ RUN touch /opt/neurolines-build-clean-rootfs && python3 -B /opt/prune-examples.py && rm /opt/prune-examples.py /opt/neurolines-build-clean-rootfs
10
+
11
+ FROM scratch
12
+ COPY --from=sanitized / /
13
+ ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin LANG=C.UTF-8 MPLBACKEND=Agg
14
+ CMD ["python3"]
15
+ LABEL org.opencontainers.image.title="AnaTractPy MNE renderer" org.opencontainers.image.version="0.6.0"
16
+ COPY --from=science /opt/anatractpy/wheels /opt/anatractpy/wheels
17
+ RUN python -m pip install --no-deps --no-index /opt/anatractpy/wheels/*.whl && anatractpy_visualization_connectograms --version && python -c 'from anatractpy.visualization import connectograms; from importlib.metadata import version; assert version("mne-connectivity") == "0.9.0"'
18
+ ENV MPLBACKEND=Agg OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1
@@ -0,0 +1,46 @@
1
+ """Construct a runtime filesystem without inherited sample neuroimaging data.
2
+
3
+ Run inside the intermediate container layer as root. The final image starts at
4
+ scratch, so removed assets do not remain accessible in an OCI parent layer.
5
+ """
6
+ from pathlib import Path
7
+ import os
8
+ import re
9
+ import shutil
10
+
11
+ # Package caches and version-control trees may contain complete old archives.
12
+ if not Path("/opt/neurolines-build-clean-rootfs").is_file() or Path.cwd() != Path("/"):
13
+ raise SystemExit("This build helper only runs in the intermediate image filesystem.")
14
+
15
+ for name in ("/root/.cache", "/var/cache/apt/archives", "/fsl/pkgs",
16
+ "/root/.ssh", "/root/.docker", "/root/.aws", "/root/.config",
17
+ "/var/lib/apt/lists", "/numba_cache"):
18
+ path = Path(name)
19
+ if path.is_dir() and not path.is_symlink():
20
+ shutil.rmtree(path)
21
+ Path("/numba_cache").mkdir(mode=0o1777)
22
+ os.chmod("/numba_cache", 0o1777)
23
+ for root, dirs, files in os.walk("/", topdown=True):
24
+ parent = Path(root)
25
+ if root == "/":
26
+ dirs[:] = [x for x in dirs if x in {"ants", "opt", "fsl", "root", "home", "usr", "etc", "var", "lib", "mrtrix3_install", "scilpy"}]
27
+ for name in list(dirs):
28
+ p = parent / name
29
+ if (name in {".git", ".hg", ".svn", ".aws", ".ssh", "__pycache__"}
30
+ or (name in {"tests", "testdata"} and ("site-packages" in p.parts or p.parts[1] == "scilpy") and "numpy" not in p.parts)
31
+ or re.search(r"^sub-[A-Za-z0-9]+(?:_|$)", name)):
32
+ if p.is_symlink():
33
+ p.unlink()
34
+ else:
35
+ shutil.rmtree(p)
36
+ dirs.remove(name)
37
+ for name in files:
38
+ p = parent / name
39
+ lower = name.lower()
40
+ medical = (".nii", ".nii.gz", ".mgz", ".mgh", ".dcm", ".dicom", ".ima", ".trk", ".tck",
41
+ ".tsf", ".gii", ".gii.gz", ".mnc", ".mif", ".mif.gz", ".nii.bz2", ".v16", ".nhdr",
42
+ ".nrrd", ".nrrd.gz", ".head", ".brik", ".brik.gz", ".img", ".img.gz", ".hdr")
43
+ if (lower.endswith(medical) or re.search(r"(^|_)sub-[a-z0-9]+(?:_|\.|$)", lower)
44
+ or name in {".bash_history", ".python_history", ".netrc", ".license", "id_rsa", "id_ed25519"}
45
+ or (lower == "license.txt" and "freesurfer" in str(p).lower())):
46
+ p.unlink()
@@ -0,0 +1,28 @@
1
+ {
2
+ "science": {
3
+ "tag": "anatractpy:0.6.0",
4
+ "oci_image_manifest_digest": "sha256:c7ca496a5d75d01689916094c576a849843c72d48659035e724fa1d379b1fb40",
5
+ "oci_image_config_digest": "sha256:3942611416e23a04e8f71cf10cf028b0752d1852df8a3396c51717e0ac0a2ab1",
6
+ "platform": "linux/amd64",
7
+ "docker_image_inspect_size_bytes": 6444652138,
8
+ "archive": "anatractpy-0.6.0-linux-amd64.tar",
9
+ "recipe": "Apptainer.def",
10
+ "recipe_sha256": "849d5c26ff79042ecc3770d791c29c0de42f8b71f8f9807c3b110b8e0ca3de74",
11
+ "upstream_base": "marvinp45/neurolines_scilus@sha256:d01a65dc58f0a5066d100f1f8fe82a0627543914ad7878cf449d404464b62398",
12
+ "embedded_wheel_sha256": "c1650dfb24f8d01eca5eb315648779ef4bbe80a685012752d783430bf3d206fb",
13
+ "matcher_elf_sha256": "d14bcc3caa5ebe6ec4c1b22338230d6f978e7c9066c55f06fdbb565d43cb50f9"
14
+ },
15
+ "mne": {
16
+ "tag": "anatractpy_mne:0.6.0",
17
+ "oci_image_manifest_digest": "sha256:81f052ab5e4bdd0badf85cd79f3ae181f216da64a56908f1a7127fbc17c4831c",
18
+ "oci_image_config_digest": "sha256:52bd029e4784baa81d5a32468720b89b6c027815e62221fabe2852562a09ae60",
19
+ "platform": "linux/amd64",
20
+ "docker_image_inspect_size_bytes": 170513803,
21
+ "archive": "anatractpy_mne-0.6.0-linux-amd64.tar",
22
+ "recipe": "MNE.Apptainer.def",
23
+ "recipe_sha256": "2a698d92ded85d353b4791423c81d159bca26f116ae8e4cda9f5d9500583aca0",
24
+ "upstream_base": "marvin45700/neurolines-mne-connectograms@sha256:7aae37cc91b8881ab4129c3de5ba2ab7e283b8201f69bf815b0428a624b287bb",
25
+ "embedded_wheel_sha256": "c1650dfb24f8d01eca5eb315648779ef4bbe80a685012752d783430bf3d206fb",
26
+ "matcher_elf_sha256": "d14bcc3caa5ebe6ec4c1b22338230d6f978e7c9066c55f06fdbb565d43cb50f9"
27
+ }
28
+ }
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+ set -eu
3
+ uv pip install --offline --no-deps --python "$(command -v python3)" /opt/anatractpy/wheels/*.whl
@@ -0,0 +1,10 @@
1
+ Bootstrap: docker-archive
2
+ From: anatractpy-0.6.0-linux-amd64.tar
3
+
4
+ %labels
5
+ org.opencontainers.image.title AnaTractPy
6
+ org.opencontainers.image.version 0.6.0
7
+ org.neurolines.science-reference 772bcea0b767fbf665c6eea18ad43efcfe798b22
8
+
9
+ %test
10
+ sh /opt/anatractpy/verify-runtime.sh
@@ -0,0 +1,10 @@
1
+ Bootstrap: docker-archive
2
+ From: anatractpy_mne-0.6.0-linux-amd64.tar
3
+
4
+ %labels
5
+ org.opencontainers.image.title AnaTractPy MNE renderer
6
+ org.opencontainers.image.version 0.6.0
7
+
8
+ %test
9
+ anatractpy_visualization_connectograms --version
10
+ python -c 'from anatractpy.visualization import connectograms'
@@ -0,0 +1,28 @@
1
+ # AnaTractPy 0.6.0 offline containers
2
+
3
+ The local Docker build produces two Linux x86-64 images. The science and MNE tags, OCI manifests, configs, byte counts, base digests and Apptainer recipe hashes are in `images.json`. Allow at least 7 GiB on the export volume and additional space in Docker for unpacked images.
4
+
5
+ ```sh
6
+ python3 -B export_images.py inspect
7
+ python3 -B export_images.py export /destination/Images-AnaTractPy-0.6.0
8
+ cd /destination/Images-AnaTractPy-0.6.0
9
+ python3 -B export_images.py verify .
10
+ docker image load --input anatractpy-0.6.0-linux-amd64.tar
11
+ docker image load --input anatractpy_mne-0.6.0-linux-amd64.tar
12
+ docker run --rm --network none --pull never anatractpy:0.6.0 anatractpy_population_inventory --version
13
+ docker run --rm --network none --pull never anatractpy_mne:0.6.0 anatractpy_visualization_connectograms --version
14
+ ```
15
+
16
+ The exporter uses locally available images, reads each OCI blob, checks its SHA-256 and writes the archive set atomically. It supports a Docker engine with the containerd image store and manifest availability reporting. A recipient can verify the exported directory with standard-library Python on Linux or macOS. Transfer the release SHA256SUMS digest through a trusted channel.
17
+
18
+ On an x86-64 Linux host with Apptainer, select a suitable temporary volume for the expanded root filesystems, keep the TARs alongside the recipes and run:
19
+
20
+ ```sh
21
+ apptainer build --disable-cache anatractpy-0.6.0.sif Apptainer.def
22
+ apptainer build --disable-cache anatractpy_mne-0.6.0.sif MNE.Apptainer.def
23
+ apptainer test anatractpy-0.6.0.sif
24
+ apptainer test anatractpy_mne-0.6.0.sif
25
+ sha256sum *.sif
26
+ ```
27
+
28
+ Pass the resulting absolute SIF paths as the pipeline's `container_tools` and `container_mne`. Use the cluster's published launcher and bind paths for project inputs and outputs.