Metadata-Version: 2.4
Name: ustb
Version: 0.0.2
Summary: Python reimplementation of the UltraSound ToolBox (USTB) for beamforming, processing, and visualization of ultrasonic signals.
Project-URL: Homepage, https://www.ustb.no
Project-URL: Repository, https://github.com/unioslo/USTB
Project-URL: Documentation, https://olemarius90.github.io/USTB/documentation.html
Author: USTB Contributors
Author-email: Ole Marius Hoel Rindal <omrindal@ifi.uio.no>
License: MIT
Keywords: beamforming,medical-imaging,signal-processing,ultrasound
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
Requires-Python: >=3.9
Requires-Dist: matplotlib
Requires-Dist: numpy
Requires-Dist: pyuff-ustb>=3.0.0
Requires-Dist: scipy
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Description-Content-Type: text/markdown

# USTB for Python

Python reimplementation of the [UltraSound ToolBox (USTB)](https://www.ustb.no) — an open-source toolbox for beamforming, processing, and visualization of ultrasonic signals.

## Installation

```bash
pip install ustb
```

For development:

```bash
pip install -e ".[dev]"
```

## Quick Start

```python
from pyuff_ustb.objects.uff import Uff
from ustb.midprocess import DAS
from ustb.enums import Dimension, Window

# Read channel data from UFF file
channel_data = Uff("data.uff").read("channel_data")

# Set up beamformer (same API as MATLAB)
mid = DAS()
mid.channel_data = channel_data
mid.scan = scan
mid.dimension = Dimension.both
mid.transmit_apodization.window = Window.scanline
mid.receive_apodization.window = Window.none

# Beamform
b_data = mid.go()

# Plot scan-converted B-mode image
b_data.plot(title="My Image")
```

## Features

- **`midprocess.DAS`** — Generalized Delay-And-Sum beamformer
- **`preprocess.FastDemodulation`** — RF to IQ conversion
- **`postprocess.CoherenceFactor`** — Mallart-Fink coherence factor
- **`postprocess.Median`** — 2D median filter for speckle reduction
- **Scan-converted display** — sector and linear scan visualization
- **UFF I/O** — reads/writes USTB UFF files via [pyuff-ustb](https://github.com/magnusdk/pyuff_ustb)

## Examples

See the `examples/` directory:

- `minimal_example.py` — cardiac phased array imaging
- `maximal_example.py` — full pipeline (demod → DAS → CF → median)
- `cpwc_linear.py` — plane wave compound imaging
- `picmus_*.py` — PICMUS challenge datasets

## Relationship to MATLAB USTB

This package mirrors the MATLAB USTB API as closely as possible. The main classes (`DAS`, `Dimension`, `Window`, `Apodization`) use the same names, properties, and method signatures. Beamformed output matches MATLAB with >0.999 correlation across all tested examples.
