Skip to main content

TAPS

Build Tests Lint PyPI - Version PyPI - Python Version

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

lavlab_taps-0.1.0.tar.gz (73.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lavlab_taps-0.1.0-py3-none-any.whl (73.8 MB view details)

Uploaded Python 3

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

Hashes for lavlab_taps-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dca1687c4e32cefc02813036e1c135d038ea495a49560b715ad9c0a0fdf28cf6
MD5 cadcc0af7f1d7fc98b7f34486d9240d5
BLAKE2b-256 b04bb53a1d25885bb6c67648f8594aaeaebfac11f68c19e09c9297b02a498305

See more details on using hashes here.

Provenance

The following attestation bundles were made for lavlab_taps-0.1.0.tar.gz:

Publisher: publish.yml on laviolette-lab/taps

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for lavlab_taps-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 74bd6956156a7098946c229ecbc4df3cb08d2cb9ae6355d8385804aada63dd06
MD5 5d264417db21033f004e0d5de720efb7
BLAKE2b-256 0d213750f81216b8f4f50ac1e2162598e3e63e38d0b3b1a779a8d2b8dc024cbe

See more details on using hashes here.

Provenance

The following attestation bundles were made for lavlab_taps-0.1.0-py3-none-any.whl:

Publisher: publish.yml on laviolette-lab/taps

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page