TAPS
TAPS deploys a trained prostate MRI segmentation model as a Python package and command-line application. It accepts a NIfTI image and writes a binary NIfTI mask aligned with the original input image.
See https://github.com/laviolette-lab/TAPS-Training-Code for the original training code used to create this model and write the paper.
Install
pip install lavlab-taps
The installation includes PyTorch, MONAI, NumPy, and NiBabel. Install a CUDA-compatible PyTorch build first when GPU inference is required.
CLI
taps segment input_image.nii.gz prostate_mask.nii.gz
TAPS uses the bundled checkpoint by default and selects CUDA automatically when it is available. Override either with --checkpoint and --device:
taps segment input_image.nii.gz prostate_mask.nii.gz \
--checkpoint best_segresnet_model.pth --device cpu
The package applies the validation preprocessing pipeline, performs sliding-window inference, then restores the prediction to the source image's voxel space before saving it.
Python API
from taps import segment
segment(
"input_image.nii.gz",
"prostate_mask.nii.gz",
checkpoint=None, # use the bundled model
)
Project Structure
taps/
├── src/
│ └── taps/
│ ├── __init__.py # Public API & version export
│ ├── __about__.py # Version string
│ ├── cli.py # CLI entry point (thin wrapper)
│ ├── inference.py # Preprocessing, model loading & segmentation
│ ├── py.typed # PEP 561 marker
│ └── resources/
│ └── model_v1.pth # Bundled checkpoint
├── tests/
├── docs/ # MkDocs source files
└── pyproject.toml
Development
Prerequisites: Python 3.9+ and Hatch.
git clone https://github.com/laviolette-lab/taps.git
cd taps
pip install hatch
| Task | Command |
|---|---|
| Run tests | hatch run test:test |
| Tests + coverage | hatch run test:cov |
| Lint | hatch run lint:check |
| Format | hatch run lint:format |
| Auto-fix lint | hatch run lint:fix |
| Type check | hatch run types:check |
| Build docs | hatch run docs:build-docs |
| Serve docs | hatch run docs:serve-docs |
| Build wheel | hatch build |
Or via the Makefile: make test, make lint, make build, etc.
Docker
# Run tests via Docker
docker build --target hatch -t taps:hatch .
docker run --rm -e HATCH_ENV=test taps:hatch cov
# Production image (just the installed wheel)
docker build --target prod -t taps:prod .
Contributing
See CONTRIBUTING.md for development guidelines.
License
taps is distributed under the terms of the MIT license.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lavlab_taps-0.1.0.tar.gz.
File metadata
- Download URL: lavlab_taps-0.1.0.tar.gz
- Upload date:
- Size: 73.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dca1687c4e32cefc02813036e1c135d038ea495a49560b715ad9c0a0fdf28cf6
|
|
| MD5 |
cadcc0af7f1d7fc98b7f34486d9240d5
|
|
| BLAKE2b-256 |
b04bb53a1d25885bb6c67648f8594aaeaebfac11f68c19e09c9297b02a498305
|
Provenance
The following attestation bundles were made for lavlab_taps-0.1.0.tar.gz:
Publisher:
publish.yml on laviolette-lab/taps
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lavlab_taps-0.1.0.tar.gz -
Subject digest:
dca1687c4e32cefc02813036e1c135d038ea495a49560b715ad9c0a0fdf28cf6 - Sigstore transparency entry: 2467399922
- Sigstore integration time:
-
Permalink:
laviolette-lab/taps@13f9616f1bb845c741b6148b8d60e543ace47d9a -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/laviolette-lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@13f9616f1bb845c741b6148b8d60e543ace47d9a -
Trigger Event:
release
-
Statement type:
File details
Details for the file lavlab_taps-0.1.0-py3-none-any.whl.
File metadata
- Download URL: lavlab_taps-0.1.0-py3-none-any.whl
- Upload date:
- Size: 73.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74bd6956156a7098946c229ecbc4df3cb08d2cb9ae6355d8385804aada63dd06
|
|
| MD5 |
5d264417db21033f004e0d5de720efb7
|
|
| BLAKE2b-256 |
0d213750f81216b8f4f50ac1e2162598e3e63e38d0b3b1a779a8d2b8dc024cbe
|
Provenance
The following attestation bundles were made for lavlab_taps-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on laviolette-lab/taps
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lavlab_taps-0.1.0-py3-none-any.whl -
Subject digest:
74bd6956156a7098946c229ecbc4df3cb08d2cb9ae6355d8385804aada63dd06 - Sigstore transparency entry: 2467399943
- Sigstore integration time:
-
Permalink:
laviolette-lab/taps@13f9616f1bb845c741b6148b8d60e543ace47d9a -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/laviolette-lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@13f9616f1bb845c741b6148b8d60e543ace47d9a -
Trigger Event:
release
-
Statement type: