Skip to content

Commit 09e5575

Browse files
committed
docs: Updates README with status badges and refined documentation
Refreshes the project documentation to include status badges, updated usage examples reflecting recent API changes, and formal acknowledgments. Key changes: - Adds PyPI, build, and license badges. - Updates code examples to reflect the latest API changes, such as `get_geometry`. - Adds acknowledgments for DKFZ and Helmholtz Imaging. - Refines the project description and feature list for better clarity.
1 parent 9891c4b commit 09e5575

1 file changed

Lines changed: 62 additions & 61 deletions

File tree

README.md

Lines changed: 62 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,82 @@
11
# MedVol
22

3-
`medvol` is a small wrapper around `SimpleITK`, `nibabel`, and `pynrrd` that
4-
provides one interface for reading and writing 2D, 3D, and 4D NIfTI and NRRD
5-
images.
6-
7-
## Features
8-
9-
- One `MedVol` API across `SimpleITK`, `nibabel`, and `pynrrd`
10-
- Automatic backend selection by extension
11-
- NIfTI defaults to `nibabel`
12-
- NRRD defaults to `pynrrd`
13-
- Explicit backend override with `backend=...`
14-
- Canonical `RAS+` orientation by default across backends with `canonicalize=True`
15-
- Optional geometry-only deobliquing with `remove_obliqueness=True`
16-
- `affine` as the single source of truth
17-
- Derived geometry properties:
18-
- `spacing`
19-
- `origin`
20-
- `direction`
21-
- `translation`
22-
- `rotation`
23-
- `scale`
24-
- `shear`
25-
- `coordinate_system`
26-
- Raw backend-native header access via `header`
27-
28-
## Installation
3+
[![PyPI version](https://img.shields.io/pypi/v/medvol)](https://pypi.org/project/medvol/)
4+
[![Python versions](https://img.shields.io/pypi/pyversions/medvol)](https://pypi.org/project/medvol/)
5+
[![Build status](https://img.shields.io/github/actions/workflow/status/MIC-DKFZ/MedVol/test_and_deploy.yml?branch=main)](https://github.com/MIC-DKFZ/MedVol/actions)
6+
[![License](https://img.shields.io/github/license/MIC-DKFZ/MedVol)](https://github.com/MIC-DKFZ/MedVol/blob/main/LICENSE)
7+
8+
A lightweight Python wrapper that unifies **SimpleITK**, **nibabel**, and **pynrrd** under a single, simple API for reading and writing 2‑D, 3‑D, and 4‑D medical images in NIfTI (`.nii/.nii.gz`) and NRRD (`.nrrd`) formats.
9+
10+
11+
## ✨ Features
12+
13+
- **Unified API** – one `MedVol` class works with all three back‑ends.
14+
- **Automatic backend selection** based on file extension:
15+
- `.nii/.nii.gz``nibabel`
16+
- `.nrrd``pynrrd`
17+
- **Explicit backend override** via the `backend=` argument.
18+
- **Canonical `RAS+` orientation** by default (no interpolation).
19+
- Optional **de‑obliquing** via `get_geometry(deoblique=True)`.
20+
- Geometry is stored in a single source of truth – the affine matrix.
21+
- Convenient derived properties: `spacing`, `origin`, `direction`, `rotation`, `shear`, `coordinate_system`.
22+
- Direct access to the raw backend header through `header`.
23+
24+
25+
## 📦 Installation
2926

3027
```bash
3128
pip install medvol
3229
```
3330

34-
## Example
31+
32+
## 🚀 Quick start
3533

3634
```python
3735
from medvol import MedVol
3836

39-
# Uses the bundled 3D NIfTI example.
40-
image = MedVol("examples/data/3d_img.nii.gz")
41-
42-
print("Backend:", image.backend)
43-
print("Shape:", image.array.shape)
44-
print("Coordinate system:", image.coordinate_system)
45-
print("Spacing:", image.spacing)
46-
print("Origin:", image.origin)
47-
print("Direction:\n", image.direction)
48-
print("Affine:\n", image.affine)
49-
print("Rotation:\n", image.rotation)
50-
print("Header type:", type(image.header).__name__)
51-
print("Center voxel:", image.array[tuple(size // 2 for size in image.array.shape)])
52-
53-
# Opt out of canonicalization to inspect backend-native geometry.
54-
native_image = MedVol("examples/data/3d_img.nii.gz", backend="simpleitk", canonicalize=False)
55-
print("Native coordinate system:", native_image.coordinate_system)
37+
# Load the bundled 3‑D example image (NIfTI).
38+
img = MedVol("examples/data/3d_img.nii.gz")
39+
40+
print("Backend:", img.backend)
41+
print("Shape:", img.array.shape)
42+
print("Coordinate system:", img.coordinate_system)
43+
print("Spacing:", img.spacing)
44+
print("Origin:", img.origin)
45+
print("Direction:\n", img.direction)
46+
print("Affine:\n", img.affine)
47+
print("Rotation:\n", img.rotation)
48+
print("Header type:", type(img.header).__name__)
49+
50+
# Access the centre voxel value.
51+
center = tuple(s // 2 for s in img.array.shape)
52+
print("Center voxel:", img.array[center])
5653
```
5754

58-
See [example_showcase_3d_nifti.py](/home/k539i/Documents/projects/medvol/examples/example_showcase_3d_nifti.py) for a runnable version.
55+
To inspect the native geometry without canonicalisation:
56+
57+
```python
58+
native = MedVol(
59+
"examples/data/3d_img.nii.gz",
60+
backend="simpleitk",
61+
canonicalize=False,
62+
)
63+
print("Native coordinate system:", native.coordinate_system)
64+
```
5965

60-
## Notes
66+
See the runnable demo at `examples/example_showcase_3d_nifti.py`.
6167

62-
- By default, MedVol canonicalizes loaded images to the closest array-aligned
63-
`RAS+` orientation without interpolating voxel values.
64-
- Use `canonicalize=False` to preserve backend-native array order and geometry.
65-
- Use `remove_obliqueness=True` together with canonicalization to strip
66-
obliqueness from the affine while leaving voxel values untouched.
67-
- For 4D NIfTI, `nibabel` and the `SimpleITK` NIfTI path only support
68-
block-separable affines where the spatial axes do not couple to the 4th axis.
69-
Unsupported 5x5 affines raise a `ValueError`.
7068

71-
## Development
69+
## Contributing
7270

73-
Run the test suite with:
71+
Contributions are welcome! Please open a pull request with clear changes and add tests when appropriate.
7472

75-
```bash
76-
pytest -q
77-
```
73+
## Acknowledgments
7874

79-
## License
75+
<p align="left">
76+
<img src="https://github.com/MIC-DKFZ/vidata/raw/main/imgs/Logos/HI_Logo.png" width="150"> &nbsp;&nbsp;&nbsp;&nbsp;
77+
<img src="https://github.com/MIC-DKFZ/vidata/raw/main/imgs/Logos/DKFZ_Logo.png" width="500">
78+
</p>
8079

81-
Distributed under the terms of the Apache Software License 2.0.
80+
This repository is developed and maintained by the Applied Computer Vision Lab (ACVL)
81+
of [Helmholtz Imaging](https://www.helmholtz-imaging.de/) and the
82+
[Division of Medical Image Computing](https://www.dkfz.de/en/medical-image-computing) at DKFZ.

0 commit comments

Comments
 (0)