Metadata-Version: 2.4
Name: neuroimaging
Version: 0.1.0
Summary: Add your description here
Requires-Python: >=3.12.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: monai>=1.4.0
Requires-Dist: nibabel>=5.3.2
Requires-Dist: numpy>=1.26.4
Requires-Dist: torch>=2.9.0
Requires-Dist: torchsummary>=1.5.1
Requires-Dist: tqdm>=4.67.1
Requires-Dist: matplotlib>=3.8.0
Requires-Dist: scikit-image>=0.25.2
Requires-Dist: build>=1.3.0
Dynamic: license-file

# Model

## Setup

### Install uv

https://docs.astral.sh/uv/getting-started/installation/


```bash
uv venv                                     # creates venv
uv sync --all-extras --dev                  # installs dependencies on venv
uv run -m segmentation.examples.models      # this is how to run .py files
```

Format code with ruff
```bash
uv run ruff check --select I --fix    # format imports, or run without --fix to check only
uv run ruff format                    # format code, or run with --check
```

Check typing
```bash
uv run mypy . --config-file pyproject.toml  # runs type linter
```

## Library quickstart

Minimal, copy-pasteable way to predict the packaged TorchScript model on your own NIfTI image

```python
from pathlib import Path

import torch

from neuroimaging import VolumeSegmenter, Transforms

image_path = Path("path/to/your_scan.nii.gz")
device = "cpu"

input_tensor = VolumeSegmenter.prepare_input(image_path, device=device)

preprocessor = Transforms.normalize_input()
normalized_data = preprocessor({"image": input_tensor})
input_tensor = normalized_data["image"].to(device)

segmenter = VolumeSegmenter.from_pretrained(device=device)
mask = segmenter.predict(
    input_tensor, output_path=image_path.with_name("predicted_mask.nii.gz")
)
```
