AIND MRI Utils
MRI utilities library for aind teams.
Installation
pip install aind-mri-utils
For development, clone the repository and run:
git clone https://github.com/AllenNeuralDynamics/aind-mri-utils
cd aind-mri-utils
uv sync
Usage
# Arc angle conversions for probe positioning systems
from aind_mri_utils.arc_angles import vector_to_arc_angles, arc_angles_to_vector
probe_vector = [0.0, 0.5, -0.866] # 30° from vertical
arc_angles = vector_to_arc_angles(probe_vector) # → (30.0, 0.0)
# Reticle calibration from measurement data
from aind_mri_utils.reticle_calibrations import fit_rotation_params_from_parallax
calibration_file = "path/to/parallax_measurements.xlsx"
rotation_params = fit_rotation_params_from_parallax(calibration_file)
# Chemical shift correction for MRI images
from aind_mri_utils.chemical_shift import compute_chemical_shift
import SimpleITK as sitk
mri_image = sitk.ReadImage("brain_scan.nii")
shift_vector = compute_chemical_shift(mri_image, ppm=3.5, mag_freq=599.0)
# 3D geometric measurements
from aind_mri_utils.measurement import find_circle, dist_point_to_line
circle_center, radius = find_circle(measurement_points)
distance = dist_point_to_line(point, line_start, line_end)
# Medical image I/O
from aind_mri_utils.file_io import read_dicom, write_nii
dicom_volume = read_dicom("dicom_folder/")
write_nii(processed_volume, "output.nii")
Development
Please test your changes using the full linting and testing suite:
./scripts/run_linters_and_checks.sh -c
Or run individual commands:
uv run --frozen ruff format # Code formatting
uv run --frozen ruff check # Linting
uv run --frozen mypy # Type checking
uv run --frozen interrogate -v src # Documentation coverage
uv run --frozen codespell --check-filenames # Spell checking
uv run --frozen pytest --cov aind_mri_utils # Tests with coverage
Pull requests
For internal members, please create a branch. For external members, please fork the repository and open a pull request from the fork. We use Angular style commit messages, roughly:
<type>(<scope>): <short summary>
where scope (optional) describes the packages affected by the code changes and type (mandatory) is one of:
- build: Changes that affect build tools or external dependencies (example scopes: pyproject.toml)
- ci: Changes to our CI configuration files and scripts (examples: .github/workflows/ci-call.yml)
- docs: Documentation only changes
- feat: A new feature
- fix: A bugfix
- perf: A code change that improves performance
- refactor: A code change that neither fixes a bug nor adds a feature
- test: Adding missing tests or correcting existing tests
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for aind-mri-utils 0.13.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aind_mri_utils-0.13.2.tar.gz | 265.0 kB | Without provenance | Details for aind_mri_utils-0.13.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aind_mri_utils-0.13.2-py3-none-any.whl | Python 3 | none | any | Details for aind_mri_utils-0.13.2-py3-none-any.whl |
Total release size: 328.1 kB
Release files / aind_mri_utils-0.13.2.tar.gz
| Download URL | aind_mri_utils-0.13.2.tar.gz |
|---|---|
| Size | 265.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5f7452dee1ebc9985a687f296a2a37f32c8535098400abde24015f6667b6b978
|
|
BLAKE2b-256 checksum How to use checksums |
7f2afa3a8244b63ddf799dd05f1715ae9b50b3530b7700795d816073ce808768
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / aind_mri_utils-0.13.2-py3-none-any.whl
| Download URL | aind_mri_utils-0.13.2-py3-none-any.whl |
|---|---|
| Size | 63.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2057a901c82622636f304a21ea238ec26834d03c86f4062bbd0151ff4ed678d7
|
|
BLAKE2b-256 checksum How to use checksums |
c0fce8aafeedcd2ba11aa93e76e76f5addb86053346910911be9ca7dfbede8ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for aind-mri-utils 0.13.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.