Metadata-Version: 2.4
Name: myopari
Version: 0.1.2
Summary: User-Friendly AI Software for Automated Quantitative CMR Reporting on Low-Cost, Energy-Efficient Devices
License: MIT
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Framework :: napari
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Image Processing
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: napari
Requires-Dist: scikit-image
Requires-Dist: onnxruntime-gpu
Requires-Dist: huggingface-hub
Requires-Dist: llama-cpp-python
Requires-Dist: napari-itk-io
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# myopari

myopari is a napari plugin for cardiac MRI segmentation and report generation.
It provides an interactive widget to:

- select a 2D or 3D image layer,
- run ONNX-based segmentation,
- compute basic volumetric metrics,
- optionally enrich the report with an LLM rewrite,
- save a markdown report.

## Main Features

- Napari dock widget for interactive segmentation
- Built-in segmentation models:
	- `TIRAMISU_ACDC`
	- `TIRAMISU_EMIDEC`
- Works with both 2D images and 3D volumes
- Optional myocardium-only segmentation mode
- Markdown report generation with:
	- per-class volumes (mL)
	- myocardium mass estimate (g)
	- optional external patient info files (`.cfg`, `.txt`, `.md`)
- Optional LLM-based report rewriting (via `llama-cpp-python`)


## Installation with pip

```bash
pip install myopari
```

## Quick Start in napari

1. Launch napari.
2. Load a cardiac image (2D or 3D).
3. Open the widget:
	 - `Plugins -> myopari -> myopari`
4. In the widget:
	 - Click `Select image layer`
	 - Choose `Edge device`
	 - Choose `Segmentation model`
	 - (Optional) Enable `Myocardium only`
	 - Click `Segment`
5. A labels layer is added with a name like:
	 - `segmentation_<input_layer_name>_<count>`

## Report Workflow

After segmentation:

1. (Optional) Click `Choose patient info files` and pick `.cfg`, `.txt`, or `.md` files.
2. (Optional) Enable `Use LLM for report`.
3. Click `Create report`.
4. Click `Save report to .md` to export.

Notes:

- The report includes per-label volumes in mL and myocardium mass estimate.
- If a logo asset exists in `Resources`, it is embedded in the report and copied next to the saved markdown file.


## Troubleshooting

- Segmentation runtime/provider issues:
	- Check installed ONNX Runtime package (`onnxruntime` vs `onnxruntime-gpu`)
	- Ensure CUDA and driver versions match your `onnxruntime-gpu` build
- LLM report generation fails:
	- Install `llama-cpp-python`
	- Ensure internet access for first model download
	- Disable `Use LLM for report` to keep standard report generation

## License

MIT. See `LICENSE`.
