Metadata-Version: 2.4
Name: btsp-cli
Version: 0.1.0
Summary: NRRD slice export CLI
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: typer<1.0,>=0.12
Requires-Dist: simpleitk<3.0,>=2.4
Requires-Dist: numpy<3,>=2
Requires-Dist: pillow<12,>=11
Requires-Dist: pandas<3,>=2
Requires-Dist: tqdm<5,>=4.66
Provides-Extra: dev
Requires-Dist: pytest<9,>=8; extra == "dev"

# btsp-cli

`btsp-cli` is a Python command-line tool for exporting orthogonal slice PNGs from paired NRRD image and label volumes.

## Environment Setup

Create and activate the Conda environment:

```bash
conda create -n sp python=3.11
conda activate sp
```

Install the project in editable mode with development dependencies:

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

## Single-File Usage

Export 6 PNG slices for one paired sample:

```bash
sp print \
  --nrrd \
  --data data/MR201202161060.image.nrrd \
  --label label/MR201202161060.label.nrrd \
  --point "[120,180,9]" \
  --output output \
  --header se
```

This writes:

- `{header}_{point}_x_image.png`
- `{header}_{point}_x_label.png`
- `{header}_{point}_y_image.png`
- `{header}_{point}_y_label.png`
- `{header}_{point}_z_image.png`
- `{header}_{point}_z_label.png`

## Directory Usage

Apply one shared point to every matched sample pair in two directories:

```bash
sp print \
  --nrrd \
  --data data \
  --label label \
  --point "[120,180,9]" \
  --output output \
  --workers 4
```

Samples with out-of-bounds shared points are skipped without aborting the full batch.

## Directory Usage With CSV Points

Use a CSV file to supply per-sample points and restrict processing to listed samples only.

CSV schema:

```text
name_header,point
MR201202161060,"[120,180,9]"
MR201206080468,"[98,164,8]"
```

Command:

```bash
sp print \
  --nrrd \
  --data data \
  --label label \
  --point-csv points.csv \
  --output output \
  --header se \
  --workers 4
```

In directory mode, output headers are automatically expanded to `{header}_{sample_name}` to avoid overwriting files across samples.
