For developers

Contributing

NiFreeze is a project of the NiPreps Community, which specifies the contributing guidelines. Before delving into the code, please make sure you have read all the guidelines offered online.

Documentation

Documentation sources are found under the docs/ folder, and builds are archived in the gh-pages branch of the repository. With GitHub Pages, the documentation is posted under https://www.nipreps.org/nifreeze. We maintain versioned documentation, by storing git tags under <major>.<minor>/ folders, i.e., we do not archive every patch release, but only every minor release. In other words, folder 0.1/ of the documentation tree contains the documents for the latest release within the 0.1.x series. With every commit (or merge commit) to main, the development version of the documentation under the folder main/ is updated too. The gh-pages branch is automatically maintained with a GitHub Action. Please, do not commit manually to gh-pages.

To build the documentation locally, you first need to make sure that setuptools_scm[toml] >= 6.2 is installed in your environment and then:

cd <nifreeze-repository>/
python -m setuptools_scm  # This will generate ``src/nifreeze/_version.py``
make -C docs/ html

Benchmarking

NiFreeze uses asv for performance benchmarking. Benchmarking code is found under the benchmarks/ folder. Maintaining reasonable runtime and memory consumption of core NiFreeze components (e.g., models, data I/O, estimator) is critical for the efficiency of pipelines using it.

The benchmarks measure the memory that operations allocate, their peak resident memory, their CPU time and their wall time. Every pull request is benchmarked together with the tip of main in the same job, and fails if it makes a benchmark regress past the threshold of its kind; the job summary lists every result. The results of each commit to main are published in the nifreeze dashboard. benchmarks/README.rst describes the thresholds, how to run the benchmarks locally, and how to write new ones.

End-to-end tests

test/test_e2e_motion.py moves every diffusion-weighted volume of DIPY’s Sherbrooke dataset by a known random rigid transform, runs the command line with several models, and compares the estimated motion with the ground truth. These tests are deselected by default; they need ANTs and run with:

pytest -m e2e test/test_e2e_motion.py

The End-to-end tests workflow runs them weekly, on demand, and on pull requests that change them, and lists the errors of every model in its job summary.

Library API (application program interface)

Information on specific functions, classes, and methods.