Metadata-Version: 2.5
Name: aiod_utils
Version: 0.2.0
Summary: Utilities for AI OnDemand
Project-URL: homepage, https://github.com/FrancisCrickInstitute/aiod_utils
Project-URL: documentation, https://franciscrickinstitute.github.io/aiod_docs/
Project-URL: source, https://github.com/FrancisCrickInstitute/aiod_utils
Author-email: Cameron Shand <cameron.shand@crick.ac.uk>, Fiona Young <fiona.young@crick.ac.uk>, Numan Ahmed <numan.ahmed@crick.ac.uk>, Qin Yu <qin.yu@crick.ac.uk>, Jon Smith <jon.smith@crick.ac.uk>
License: MIT License
        
        Copyright (c) 2026 Cameron Shand
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: image analysis,segmentation
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: File Formats
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Image Processing
Classifier: Topic :: Utilities
Requires-Python: <3.13,>=3.11
Requires-Dist: bioio-czi
Requires-Dist: bioio-imageio>=1.1.0
Requires-Dist: bioio-lif
Requires-Dist: bioio-nd2
Requires-Dist: bioio-ome-tiff
Requires-Dist: bioio-ome-zarr>=2
Requires-Dist: bioio-tifffile>=1.2.0
Requires-Dist: bioio>=3.2.0
Requires-Dist: numcodecs
Requires-Dist: numpy<2.0,>=1.26
Requires-Dist: opencv-python-headless
Requires-Dist: pandas<2.3.0
Requires-Dist: pyyaml
Requires-Dist: scikit-image>0.20
Requires-Dist: scipy>=1.17.1
Requires-Dist: tifffile
Requires-Dist: zarr>=3.1.5
Provides-Extra: bioformats
Requires-Dist: bioio-bioformats; extra == 'bioformats'
Description-Content-Type: text/markdown

# AI OnDemand (AIoD) Utilities

A central package to unify helpful utilities for AI OnDemand that are useful/used across the Nextflow pipeline, [Segment-Flow](https://github.com/FrancisCrickInstitute/Segment-Flow), and the [Napari plugin](https://github.com/FrancisCrickInstitute/aiod_napari). This primarily covers a centralisation of I/O and the implementation of RLE format.


## Installation
Requires Python 3.11 or 3.12.

Using pip:

```bash
pip install aiod_utils
```

Using `uv`:

```bash
uv add aiod_utils  # or uv pip install aiod_utils
```

For Bio-Formats support, install the optional extra:

```bash
pip install "aiod_utils[bioformats]"
```

## What's included

- **`aiod_utils.io`** — Load images via [BioIO](https://github.com/bioio-devs/bioio), with automatic reader selection for common formats (TIFF, OME-TIFF, Zarr, ND2, and more), and save them back out as OME-TIFF or OME-Zarr. Also centralises image/mask naming so the Napari front-end (and potential others) and [Segment-Flow](https://github.com/FrancisCrickInstitute/Segment-Flow) backend derive filenames identically.
- **`aiod_utils.rle`** — Encode and decode segmentation masks (binary and instance) as COCO-compatible _Run-Length Encoding_, with save/load support.
    - Note that there are some optimisations here to help improve encode/decode times for dense segmentation masks, particularly for storing instance masks!
- **`aiod_utils.stacks`** — Utilities for splitting large volumetric images into memory-bounded substacks for use in our Nextflow pipeline ([Segment-Flow](https://github.com/FrancisCrickInstitute/Segment-Flow)). Is generally useful for dividing images/arrays into subsets to parallelise/iterate over, with optional memory budget.
- **`aiod_utils.preprocess`** — Modular image preprocessing steps (e.g. CLAHE, downsampling) with a base class for defining custom steps. Easily extendable for use in [Segment-Flow](https://github.com/FrancisCrickInstitute/Segment-Flow) or our [Napari plugin](https://github.com/FrancisCrickInstitute/aiod_napari).


## Documentation

For the wider AIoD documentation, please see our [docs](https://franciscrickinstitute.github.io/aiod_docs/).

## License

MIT — see [LICENSE](LICENSE).